40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
(load "redis.carp")
|
|
|
|
(Project.config "title" "redis")
|
|
(Project.config "docs-directory" "./docs/")
|
|
(Project.config "docs-logo" "")
|
|
(Project.config "docs-url" "https://git.veitheller.de/carpentry/redis")
|
|
(Project.config "docs-styling" "../style.css")
|
|
(Project.config "docs-prelude" "is a Redis client library for Carp, supporting Redis 7.x.
|
|
|
|
## Installation
|
|
|
|
```
|
|
(load \"https://git.veitheller.de/carpentry/redis.git@0.1.0\")
|
|
```
|
|
|
|
## Example
|
|
|
|
```
|
|
(defn main []
|
|
(match (Redis.open \"127.0.0.1\")
|
|
(Result.Success r)
|
|
(do
|
|
(println* &(Redis.set &r @\"key\" @\"value\"))
|
|
(println* &(Redis.get &r @\"key\"))
|
|
(println* &(Redis.lrange &r @\"mylist\" @\"0\" @\"-1\"))
|
|
(match (Redis.get &r @\"key\")
|
|
(Result.Success resp)
|
|
(match resp
|
|
(RESP.Str s) (println* \"got: \" &s)
|
|
(RESP.Null) (println* \"not found\")
|
|
_ (println* \"unexpected type\"))
|
|
(Result.Error e) (println* \"error: \" &e))
|
|
(Redis.close r))
|
|
(Result.Error err) (IO.errorln &err)))
|
|
```
|
|
")
|
|
|
|
(save-docs RESP Redis)
|
|
(quit)
|