connection

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

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

Connection represents a connection with a redis-cli

func NewConn

func NewConn(conn net.Conn) *Connection

NewConn creates Connection instance

func (*Connection) AddTxError added in v1.2.9

func (c *Connection) AddTxError(err error)

AddTxError stores syntax error within transaction

func (*Connection) ClearQueuedCmds added in v1.2.7

func (c *Connection) ClearQueuedCmds()

ClearQueuedCmds clears queued commands of current transaction

func (*Connection) Close

func (c *Connection) Close() error

Close disconnect with the client

func (*Connection) EnqueueCmd added in v1.2.7

func (c *Connection) EnqueueCmd(cmdLine [][]byte)

EnqueueCmd enqueues command of current transaction

func (*Connection) GetChannels

func (c *Connection) GetChannels() []string

GetChannels returns all subscribing channels

func (*Connection) GetDBIndex added in v1.2.8

func (c *Connection) GetDBIndex() int

GetDBIndex returns selected db

func (*Connection) GetPassword

func (c *Connection) GetPassword() string

GetPassword get password for authentication

func (*Connection) GetQueuedCmdLine added in v1.2.7

func (c *Connection) GetQueuedCmdLine() [][][]byte

GetQueuedCmdLine returns queued commands of current transaction

func (*Connection) GetTxErrors added in v1.2.9

func (c *Connection) GetTxErrors() []error

GetTxErrors returns syntax error within transaction

func (*Connection) GetWatching added in v1.2.7

func (c *Connection) GetWatching() map[string]uint32

GetWatching returns watching keys and their version code when started watching

func (*Connection) InMultiState added in v1.2.7

func (c *Connection) InMultiState() bool

InMultiState tells is connection in an uncommitted transaction

func (*Connection) IsMaster added in v1.2.9

func (c *Connection) IsMaster() bool

func (*Connection) IsSlave added in v1.2.9

func (c *Connection) IsSlave() bool

func (*Connection) Name added in v1.2.9

func (c *Connection) Name() string

func (*Connection) RemoteAddr

func (c *Connection) RemoteAddr() net.Addr

RemoteAddr returns the remote network address

func (*Connection) SelectDB added in v1.2.8

func (c *Connection) SelectDB(dbNum int)

SelectDB selects a database

func (*Connection) SetMaster added in v1.2.9

func (c *Connection) SetMaster()

func (*Connection) SetMultiState added in v1.2.7

func (c *Connection) SetMultiState(state bool)

SetMultiState sets transaction flag

func (*Connection) SetPassword

func (c *Connection) SetPassword(password string)

SetPassword stores password for authentication

func (*Connection) SetSlave added in v1.2.9

func (c *Connection) SetSlave()

func (*Connection) SubsCount

func (c *Connection) SubsCount() int

SubsCount returns the number of subscribing channels

func (*Connection) Subscribe

func (c *Connection) Subscribe(channel string)

Subscribe add current connection into subscribers of the given channel

func (*Connection) UnSubscribe

func (c *Connection) UnSubscribe(channel string)

UnSubscribe removes current connection into subscribers of the given channel

func (*Connection) Write

func (c *Connection) Write(b []byte) (int, error)

Write sends response to client over tcp connection

type FakeConn

type FakeConn struct {
	Connection
	// contains filtered or unexported fields
}

FakeConn implements redis.Connection for test

func NewFakeConn added in v1.2.9

func NewFakeConn() *FakeConn

func (*FakeConn) Bytes

func (c *FakeConn) Bytes() []byte

Bytes returns written data

func (*FakeConn) Clean

func (c *FakeConn) Clean()

Clean resets the buffer

func (*FakeConn) Close added in v1.2.9

func (c *FakeConn) Close() error

func (*FakeConn) Read added in v1.2.9

func (c *FakeConn) Read(p []byte) (int, error)

Read reads data from buffer

func (*FakeConn) Write

func (c *FakeConn) Write(b []byte) (int, error)

Write writes data to buffer

Jump to

Keyboard shortcuts

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