MCPcopy Create free account
hub / github.com/distributedio/titan / SimpleString

Method SimpleString

encoding/resp/resp.go:194–210  ·  view source on GitHub ↗

SimpleString parses a RESP simplestring

()

Source from the content-addressed store, hash-verified

192
193//SimpleString parses a RESP simplestring
194func (r *Decoder) SimpleString() (string, error) {
195 buf, err := r.r.ReadBytes('\n')
196 if err != nil {
197 return "", err
198 }
199 l := len(buf)
200 if l < len("+\r\n") {
201 return "", ErrInvalidProtocol
202 }
203 if buf[l-2] != '\r' {
204 return "", ErrInvalidProtocol
205 }
206 if buf[0] != '+' {
207 return "", ErrInvalidProtocol
208 }
209 return string(buf[1 : l-2]), nil
210}
211
212//BulkString parses a RESP bulkstring
213func (r *Decoder) BulkString() (string, error) {

Callers 1

TestSimpleString_DecodeFunction · 0.95

Implementers 2

Encoderencoding/resp/resp.go
Decoderencoding/resp/resp.go

Calls 1

ReadBytesMethod · 0.80

Tested by 1

TestSimpleString_DecodeFunction · 0.76