From aed741f76a406f1c6a44b9476b37f3509960df53 Mon Sep 17 00:00:00 2001 From: Rebaz Raouf Date: Wed, 13 Jul 2022 22:48:48 +0300 Subject: [PATCH] Add Readme and LICENSE --- LICENSE | 21 ++++++++++++ README.md | 98 +++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 94 insertions(+), 25 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..17900de --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Upstash, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 8b55e73..a5bff5e 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,87 @@ - +This Dart package mirrors the design of official upstash-redis typescript library. Find the documentation [here](https://github.com/upstash/upstash-redis). -TODO: Put a short description of the package here that helps potential users -know whether this package might be useful for them. +It is the only connectionless (HTTP based) Redis client and designed for: -## Features +- Serverless functions (AWS Lambda ...) +- Cloudflare Workers +- Fastly Compute@Edge +- Client side web/mobile applications +- WebAssembly +- and other environments where HTTP is preferred over TCP. -TODO: List what your package can do. Maybe include images, gifs, or videos. +See +[the list of APIs](https://docs.upstash.com/features/restapi#rest---redis-api-compatibility) +supported. -## Getting started +## Quick Start -TODO: List prerequisites and provide or point to information on how to -start using the package. +### Install -## Usage +```bash +dart pub add upstash_redis +``` + +### Create database -TODO: Include short and useful examples for package users. Add longer examples -to `/example` folder. +Create a new redis database on [upstash](https://console.upstash.com/) + +## Basic Usage: ```dart -const like = 'sample'; +import 'package:upstash_redis/upstash_redis.dart'; + +void main() async { + const redis = new Redis( + url: '', + token: '', + ); + + // string + await redis.set('key', 'value'); + final value1 = await redis.get('key'); + print(value1); + + await redis.set('key2', 'value2', ex: 1); + + // sorted set + await redis.zadd('scores', score: 1, member: 'team1'); + final value2 = await redis.zrange('scores', 0, 100); + print(value1); + + // list + await redis.lpush('elements', ['magnesium']); + final value3 = await redis.lrange('elements', 0, 100); + print(value3); + + // hash + await redis.hset('people', {'name': 'joe'}); + final value4 = await redis.hget('people', 'name'); + print(value4); + + // sets + await redis.sadd('animals', ['cat']); + final value5 = await redis.spop('animals', 1); + print(value5); +} ``` -## Additional information +## Contributing + +- Fork the repo on [GitHub](https://github.com/rebaz94/upstash-redis) +- Clone the project to your own machine +- Commit changes to your own branch +- Push your work back up to your fork +- Submit a Pull request so that we can review your changes and merge + +## License + +This repo is licenced under MIT. + +## Credits -TODO: Tell users more about the package: where to find more information, how to -contribute to the package, how to file issues, what response they can expect -from the package authors, and more. +- https://github.com/upstash/upstash-redis/ \ No newline at end of file