proto

package
v2.13.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Nil     = "$-1\r\n"
	NilList = "*-1\r\n"
)

Variables

View Source
var (
	ErrProtocol   = errors.New("invalid request")
	ErrUnexpected = errors.New("not what you asked for")
)

Functions

func Array

func Array(args ...string) string

Array assembles the args in a list. Args should be raw redis commands. Example: Array(String("foo"), String("bar"))

func Error

func Error(s string) string

Error

func Inline

func Inline(s string) string

Inline string

func Int

func Int(n int) string

Int

func Ints

func Ints(args ...int) string

Ints is a helper to build 1 dimensional int arrays.

func Parse

func Parse(b string) (interface{}, error)

Parse into interfaces. `b` must contain exactly a single command (which can be nested).

func Read

func Read(r *bufio.Reader) (string, error)

Read a single command, returning it raw. Used to read replies from redis. Understands RESP3 proto.

func ReadArray

func ReadArray(b string) ([]string, error)

Read an array, with all elements are the raw redis commands

func ReadError

func ReadError(b string) (string, error)

func ReadString

func ReadString(b string) (string, error)

func ReadStrings

func ReadStrings(b string) ([]string, error)

func String

func String(s string) string

Byte-safe string

func Strings

func Strings(args ...string) string

Strings is a helper to build 1 dimensional string arrays.

func Write

func Write(w io.Writer, cmd []string) error

Write a command in RESP3 proto. Used to write commands to redis. Currently only supports string arrays.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func Dial

func Dial(addr string) (*Client, error)

func DialTLS

func DialTLS(addr string, cfg *tls.Config) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Do

func (c *Client) Do(cmd ...string) (string, error)

func (*Client) DoStrings

func (c *Client) DoStrings(cmd ...string) ([]string, error)

Do() + ReadStrings()

func (*Client) Read

func (c *Client) Read() (string, error)

Jump to

Keyboard shortcuts

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