exp-godis: github.com/simonz05/exp-godis Index | Files | Directories

package godis

import "github.com/simonz05/exp-godis"

package godis implements a db client for Redis.


Package Files

godis.go reply.go bufio.go parse.go connection.go format.go pool.go


const IOBUFLEN = 1024


var (
    ErrFullBuf  = errors.New("Full buffer")
    ErrNotFound = errors.New("Not found")
var ConnSum = 0
var (
    ErrProtocol = errors.New("godis: protocol error")
var MaxConnections = 50

type AsyncClient

type AsyncClient struct {
    // contains filtered or unexported fields

func NewAsyncClient

func NewAsyncClient(addr string) *AsyncClient

func (*AsyncClient) Call

func (ac *AsyncClient) Call(args ...interface{}) (err error)

func (*AsyncClient) Close

func (ac *AsyncClient) Close()

func (*AsyncClient) Poll

func (ac *AsyncClient) Poll() (*Reply, error)

type Client

type Client struct {
    Addr  string
    Proto string
    // contains filtered or unexported fields

func NewClient

func NewClient(addr string) *Client

func (*Client) AsyncClient

func (c *Client) AsyncClient() *AsyncClient

func (*Client) Call

func (c *Client) Call(args ...interface{}) (*Reply, error)

func (*Client) Connect

func (c *Client) Connect() (conn Connection, err error)

pop a connection from pool

func (*Client) Push

func (c *Client) Push(conn Connection)

return connection to pool

type Conn

type Conn struct {
    // contains filtered or unexported fields

func NewConn

func NewConn(addr, proto string) (*Conn, error)

New connection

func (*Conn) Close

func (c *Conn) Close() error

close socket connection

func (*Conn) Read

func (c *Conn) Read() (*Reply, error)

read and parse a reply from socket

func (*Conn) Sock

func (c *Conn) Sock() net.Conn

returns the net.Conn for the struct

func (*Conn) Write

func (c *Conn) Write(args ...interface{}) error

write args to socket

type Connection

type Connection interface {
    Write(args ...interface{}) error
    Read() (*Reply, error)
    Close() error
    Sock() net.Conn

type Elem

type Elem []byte

func (Elem) Bool

func (e Elem) Bool() bool

func (Elem) Bytes

func (e Elem) Bytes() []byte

func (Elem) Float64

func (e Elem) Float64() float64

func (Elem) Int

func (e Elem) Int() int

func (Elem) Int64

func (e Elem) Int64() int64

func (Elem) String

func (e Elem) String() string

type Message

type Message struct {
    Channel string
    Elem    Elem

type Reply

type Reply struct {
    Err   error
    Elem  Elem
    Elems []*Reply

func Parse

func Parse(buf *reader) *Reply

func (*Reply) BytesArray

func (r *Reply) BytesArray() [][]byte

func (*Reply) Hash

func (r *Reply) Hash() map[string]Elem

func (*Reply) IntArray

func (r *Reply) IntArray() []int64

func (*Reply) Len

func (r *Reply) Len() int

func (*Reply) Message

func (r *Reply) Message() *Message

func (*Reply) StringArray

func (r *Reply) StringArray() []string

func (*Reply) StringMap

func (r *Reply) StringMap() map[string]string



Package godis imports 8 packages (graph) and is imported by 2 packages. Updated 2013-03-21. Refresh now. Tools for package owners.