Documentation ¶
Index ¶
- Constants
- Variables
- func Btoi64(b []byte) (int64, error)
- func Encode(w io.Writer, r *Resp) error
- func EncodeToBytes(r *Resp) ([]byte, error)
- func IsTimeout(err error) bool
- type Conn
- type Decoder
- type Encoder
- type FlushEncoder
- type Resp
- func Decode(r io.Reader) (*Resp, error)
- func DecodeFromBytes(p []byte) (*Resp, error)
- func DecodeMultiBulkFromBytes(p []byte) ([]*Resp, error)
- func NewArray(array []*Resp) *Resp
- func NewBulkBytes(value []byte) *Resp
- func NewError(value []byte) *Resp
- func NewErrorf(format string, args ...interface{}) *Resp
- func NewInt(value []byte) *Resp
- func NewString(value []byte) *Resp
- type RespType
Constants ¶
View Source
const ( MaxBulkBytesLen = 1024 * 1024 * 512 MaxArrayLen = 1024 * 1024 )
Variables ¶
View Source
var ( ErrBadCRLFEnd = errors.New("bad CRLF end") ErrBadArrayLen = errors.New("bad array len") ErrBadArrayLenTooLong = errors.New("bad array len, too long") ErrBadBulkBytesLen = errors.New("bad bulk bytes len") ErrBadBulkBytesLenTooLong = errors.New("bad bulk bytes len, too long") ErrBadMultiBulkLen = errors.New("bad multi-bulk len") ErrBadMultiBulkContent = errors.New("bad multi-bulk content, should be bulkbytes") )
View Source
var ErrFailedDecoder = errors.New("use of failed decoder")
View Source
var ErrFailedEncoder = errors.New("use of failed encoder")
Functions ¶
func EncodeToBytes ¶
Types ¶
type Conn ¶
type Conn struct { Sock net.Conn *Decoder *Encoder ReaderTimeout time.Duration WriterTimeout time.Duration LastWrite time.Time }
func DialTimeout ¶
func (*Conn) CloseReader ¶
func (*Conn) FlushEncoder ¶
func (c *Conn) FlushEncoder() *FlushEncoder
func (*Conn) RemoteAddr ¶
type Decoder ¶
type Decoder struct { Err error // contains filtered or unexported fields }
func NewDecoder ¶
func NewDecoderBuffer ¶
func (*Decoder) DecodeMultiBulk ¶
type Encoder ¶
type Encoder struct { Err error // contains filtered or unexported fields }
func NewEncoder ¶
func NewEncoderBuffer ¶
func (*Encoder) EncodeMultiBulk ¶
type FlushEncoder ¶
type FlushEncoder struct { Conn *Conn MaxInterval time.Duration MaxBuffered int // contains filtered or unexported fields }
func (*FlushEncoder) Encode ¶
func (p *FlushEncoder) Encode(resp *Resp) error
func (*FlushEncoder) EncodeMultiBulk ¶
func (p *FlushEncoder) EncodeMultiBulk(multi []*Resp) error
func (*FlushEncoder) Flush ¶
func (p *FlushEncoder) Flush(force bool) error
func (*FlushEncoder) NeedFlush ¶
func (p *FlushEncoder) NeedFlush() bool
type Resp ¶
func DecodeFromBytes ¶
func NewBulkBytes ¶
func (*Resp) IsBulkBytes ¶
Click to show internal directories.
Click to hide internal directories.