Skip to content
Go implementation for RESP (REdis Serialization Protocol)
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
decode.go
decode_test.go

README.md

Build Status Coverage Status codebeat badge Go Report Card CII Best Practices FOSSA Status

goresp

Go implementation for RESP (REdis Serialization Protocol)

Documentation

For documentation see Godoc.

Data types

This table has examples for how data will be encoded and decoded.

RESP Representation Human-readable RESP Type Go Representation
"\r\n" (empty) undefined nil
":1\r\n" 1 Integer int64(1)
"+abc\r\n" "abc" Simple String []byte{'a','b','c'}
"+\r\n" "" Simple String []byte{}
"-abc\r\n" "abc" Error error (msg=abc)
"-\r\n" "" Error error
"$5\r\nabc\r\n\r\n" "abc\r\n" Bulk String []byte{'a','b','c'}
"$0\r\n\r\n" "" Bulk String []byte{}
"*0\r\n" [] Array []interface{}{}
"*2\r\n$3\r\nfoo\r\n$3\r\nbar\r\n" ["foo", "bar"] Array []interface{}{[]byte{'f','o','o'}, []byte{'b','a','r'}}
"*2\r\n:1\r\n$3\r\nfoo\r\n" [6, "foobar"] Array (mixed) []interface{}{int64(1), []byte{'f', 'o', 'o'}}

Benchmarks

Benchmark name (1) (2) (3) (4)
BenchmarkReadSmallString 20000000 88.7 16 2
BenchmarkReadInteger 10000000 126 16 3
BenchmarkReadBulkString 20000000 107 16 3
BenchmarkReadArray 3000000 580 176 14
  • (1): Total Repetitions achieved in constant time, higher means more confident result
  • (2): Single Repetition Duration (ns/op), lower is better
  • (3): Heap Memory (B/op), lower is better
  • (4): Average Allocations per Repetition (allocs/op), lower is better

TODO List

[ ] Change Simple string decoded type to string

License

Unless otherwise noted, All source files in this library are distributed under the Apache License 2.0 found in the LICENSE file.

FOSSA Status

You can’t perform that action at this time.