parser

package
v0.0.0-...-36ec2b2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2014 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorResp = iota
	SimpleString
	IntegerResp
	BulkResp
	MultiResp
	NoKey
)

Variables

View Source
var (
	NEW_LINE   = []byte("\r\n")
	EMPTY_LINE []byte
)

* redis protocal : Resp protocol * http://redis.io/topics/protocol

Functions

func Btoi

func Btoi(b []byte) (int, error)

todo: overflow

func IsLetter

func IsLetter(c byte) bool

func Itoa

func Itoa(i int) []byte

func ReadBulk

func ReadBulk(r *bufio.Reader, size int) ([]byte, error)

Types

type Resp

type Resp struct {
	Type    int
	Error   string
	Status  string
	Integer int64  // Support Redis 64bit integer
	Bulk    []byte // Support Redis Null Bulk Resp
	Multi   []*Resp
}

func Parse

func Parse(r *bufio.Reader) (*Resp, error)

func (*Resp) Bytes

func (r *Resp) Bytes() ([]byte, error)

func (*Resp) Key

func (r *Resp) Key() ([]byte, error)

func (*Resp) Keys

func (r *Resp) Keys() ([][]byte, error)

func (*Resp) Op

func (r *Resp) Op() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL