Documentation ¶
Index ¶
- Variables
- type Conn
- func (cn *Conn) Close() error
- func (cn *Conn) LockReaderBuffer()
- func (cn *Conn) NetConn() net.Conn
- func (cn *Conn) NextId() string
- func (cn *Conn) RemoteAddr() net.Addr
- func (cn *Conn) SetNetConn(netConn net.Conn)
- func (cn *Conn) SetUsedAt(tm time.Time)
- func (cn *Conn) UsedAt() time.Time
- func (cn *Conn) WithReader(timeout time.Duration, fn func(rd *Reader) error) error
- func (cn *Conn) WithWriter(timeout time.Duration, fn func(wb *WriteBuffer) error) error
- type ConnPool
- func (p *ConnPool) Close() error
- func (p *ConnPool) CloseConn(cn *Conn) error
- func (p *ConnPool) Filter(fn func(*Conn) bool) error
- func (p *ConnPool) Get() (*Conn, error)
- func (p *ConnPool) IdleLen() int
- func (p *ConnPool) Len() int
- func (p *ConnPool) NewConn() (*Conn, error)
- func (p *ConnPool) Put(cn *Conn)
- func (p *ConnPool) ReapStaleConns() (int, error)
- func (p *ConnPool) Remove(cn *Conn)
- func (p *ConnPool) Stats() *Stats
- type ElasticBufReader
- func (b *ElasticBufReader) Buffer() []byte
- func (b *ElasticBufReader) Buffered() int
- func (b *ElasticBufReader) Bytes() []byte
- func (b *ElasticBufReader) ReadByte() (byte, error)
- func (b *ElasticBufReader) ReadLine() (line []byte, err error)
- func (b *ElasticBufReader) ReadN(n int) ([]byte, error)
- func (b *ElasticBufReader) ReadSlice(delim byte) (line []byte, err error)
- func (b *ElasticBufReader) Reset(rd io.Reader)
- func (b *ElasticBufReader) ResetBuffer(buf []byte)
- type Options
- type Pooler
- type Reader
- type SingleConnPool
- func (p *SingleConnPool) Close() error
- func (p *SingleConnPool) CloseConn(*Conn) error
- func (p *SingleConnPool) Get() (*Conn, error)
- func (p *SingleConnPool) IdleLen() int
- func (p *SingleConnPool) Len() int
- func (p *SingleConnPool) NewConn() (*Conn, error)
- func (p *SingleConnPool) Put(cn *Conn)
- func (p *SingleConnPool) Remove(cn *Conn)
- func (p *SingleConnPool) Stats() *Stats
- type Stats
- type WriteBuffer
- func (buf *WriteBuffer) Buffer() []byte
- func (buf *WriteBuffer) FinishMessage()
- func (buf *WriteBuffer) FinishNullParam()
- func (buf *WriteBuffer) FinishParam()
- func (buf *WriteBuffer) ReadFrom(r io.Reader) (int64, error)
- func (buf *WriteBuffer) Reset()
- func (buf *WriteBuffer) ResetBuffer(b []byte)
- func (buf *WriteBuffer) StartMessage(c byte)
- func (buf *WriteBuffer) StartParam()
- func (buf *WriteBuffer) Write(b []byte) (int, error)
- func (buf *WriteBuffer) WriteByte(c byte) error
- func (buf *WriteBuffer) WriteBytes(b []byte)
- func (buf *WriteBuffer) WriteInt16(num int16)
- func (buf *WriteBuffer) WriteInt32(num int32)
- func (buf *WriteBuffer) WriteString(s string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClosed = errors.New("pg: database is closed")
View Source
var ErrPoolTimeout = errors.New("pg: connection pool timeout")
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { InitedAt time.Time ProcessId int32 SecretKey int32 // contains filtered or unexported fields }
func (*Conn) LockReaderBuffer ¶
func (cn *Conn) LockReaderBuffer()
func (*Conn) RemoteAddr ¶
func (*Conn) SetNetConn ¶
func (*Conn) WithReader ¶
func (*Conn) WithWriter ¶
type ConnPool ¶
type ConnPool struct {
// contains filtered or unexported fields
}
func NewConnPool ¶
func (*ConnPool) ReapStaleConns ¶
type ElasticBufReader ¶
type ElasticBufReader struct {
// contains filtered or unexported fields
}
ElasticBufReader is like bufio.Reader but instead of returning ErrBufferFull it automatically grows the buffer.
func NewElasticBufReader ¶
func NewElasticBufReader(rd io.Reader) *ElasticBufReader
func (*ElasticBufReader) Buffer ¶
func (b *ElasticBufReader) Buffer() []byte
func (*ElasticBufReader) Buffered ¶
func (b *ElasticBufReader) Buffered() int
Buffered returns the number of bytes that can be read from the current buffer.
func (*ElasticBufReader) Bytes ¶
func (b *ElasticBufReader) Bytes() []byte
func (*ElasticBufReader) ReadByte ¶
func (b *ElasticBufReader) ReadByte() (byte, error)
func (*ElasticBufReader) ReadLine ¶
func (b *ElasticBufReader) ReadLine() (line []byte, err error)
func (*ElasticBufReader) ReadSlice ¶
func (b *ElasticBufReader) ReadSlice(delim byte) (line []byte, err error)
func (*ElasticBufReader) Reset ¶
func (b *ElasticBufReader) Reset(rd io.Reader)
func (*ElasticBufReader) ResetBuffer ¶
func (b *ElasticBufReader) ResetBuffer(buf []byte)
type Reader ¶
type Reader struct { *ElasticBufReader Columns [][]byte }
func NewReader ¶
func NewReader(buf *ElasticBufReader) *Reader
func (*Reader) ReadString ¶
type SingleConnPool ¶
type SingleConnPool struct {
// contains filtered or unexported fields
}
func NewSingleConnPool ¶
func NewSingleConnPool(cn *Conn) *SingleConnPool
func (*SingleConnPool) Close ¶
func (p *SingleConnPool) Close() error
func (*SingleConnPool) CloseConn ¶
func (p *SingleConnPool) CloseConn(*Conn) error
func (*SingleConnPool) Get ¶
func (p *SingleConnPool) Get() (*Conn, error)
func (*SingleConnPool) IdleLen ¶
func (p *SingleConnPool) IdleLen() int
func (*SingleConnPool) Len ¶
func (p *SingleConnPool) Len() int
func (*SingleConnPool) NewConn ¶
func (p *SingleConnPool) NewConn() (*Conn, error)
func (*SingleConnPool) Put ¶
func (p *SingleConnPool) Put(cn *Conn)
func (*SingleConnPool) Remove ¶
func (p *SingleConnPool) Remove(cn *Conn)
func (*SingleConnPool) Stats ¶
func (p *SingleConnPool) Stats() *Stats
type Stats ¶
type Stats struct { Hits uint32 // number of times free connection was found in the pool Misses uint32 // number of times free connection was NOT found in the pool Timeouts uint32 // number of times a wait timeout occurred TotalConns uint32 // number of total connections in the pool IdleConns uint32 // number of idle connections in the pool StaleConns uint32 // number of stale connections removed from the pool }
Stats contains pool state information and accumulated stats.
type WriteBuffer ¶
type WriteBuffer struct { Bytes []byte // contains filtered or unexported fields }
func NewWriteBuffer ¶
func NewWriteBuffer() *WriteBuffer
func (*WriteBuffer) Buffer ¶
func (buf *WriteBuffer) Buffer() []byte
func (*WriteBuffer) FinishMessage ¶
func (buf *WriteBuffer) FinishMessage()
func (*WriteBuffer) FinishNullParam ¶
func (buf *WriteBuffer) FinishNullParam()
func (*WriteBuffer) FinishParam ¶
func (buf *WriteBuffer) FinishParam()
func (*WriteBuffer) Reset ¶
func (buf *WriteBuffer) Reset()
func (*WriteBuffer) ResetBuffer ¶
func (buf *WriteBuffer) ResetBuffer(b []byte)
func (*WriteBuffer) StartMessage ¶
func (buf *WriteBuffer) StartMessage(c byte)
func (*WriteBuffer) StartParam ¶
func (buf *WriteBuffer) StartParam()
func (*WriteBuffer) WriteByte ¶
func (buf *WriteBuffer) WriteByte(c byte) error
func (*WriteBuffer) WriteBytes ¶
func (buf *WriteBuffer) WriteBytes(b []byte)
func (*WriteBuffer) WriteInt16 ¶
func (buf *WriteBuffer) WriteInt16(num int16)
func (*WriteBuffer) WriteInt32 ¶
func (buf *WriteBuffer) WriteInt32(num int32)
func (*WriteBuffer) WriteString ¶
func (buf *WriteBuffer) WriteString(s string)
Click to show internal directories.
Click to hide internal directories.