https://github.com/huntsman-li/resp
redis resp
https://github.com/huntsman-li/resp
Last synced: 2 months ago
JSON representation
redis resp
- Host: GitHub
- URL: https://github.com/huntsman-li/resp
- Owner: huntsman-li
- Created: 2019-05-04T07:40:02.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-04T08:09:47.000Z (about 6 years ago)
- Last Synced: 2023-03-21T20:19:42.884Z (about 2 years ago)
- Language: Go
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# github.com/huntsman-li/resp
## Installation
Use `go get` to instal or upgrade (`-u`) the `resp` package:
```
go get -u github.com/huntsman-ly/resp
```## Usage
```
package mainimport (
"fmt"
"github.com/huntsman-li/resp"
)func main() {
//decoder()
encoder()
}func decoder() {
var dest string
if err := resp.Unmarshal([]byte("+OK\r\n"), &dest); err != nil {
panic(err)
}
fmt.Println(dest)
}func encoder() {
buf, err := resp.Marshal("Foo") // RESP: $3\r\nFoo\r\n
if err != nil {
panic(err)
}fmt.Printf("buf: %s\n", string(buf))
}
```