Documentation ¶
Index ¶
- Variables
- func SetIdleCheckFrequency(d time.Duration)
- type Conn
- func (cn *Conn) CheckHealth() error
- func (cn *Conn) Close() error
- func (cn *Conn) FlushWriter() error
- func (cn *Conn) NetConn() net.Conn
- func (cn *Conn) NextId() string
- func (cn *Conn) ReadN(n int) ([]byte, error)
- func (cn *Conn) RemoteAddr() net.Addr
- func (cn *Conn) SetNetConn(netConn net.Conn)
- func (cn *Conn) SetReadWriteTimeout(rt, wt time.Duration)
- type ConnPool
- func (p *ConnPool) Close() error
- func (p *ConnPool) Closed() bool
- func (p *ConnPool) FreeLen() int
- func (p *ConnPool) Get() (*Conn, bool, error)
- func (p *ConnPool) Len() int
- func (p *ConnPool) NewConn() (*Conn, error)
- func (p *ConnPool) PopFree() *Conn
- func (p *ConnPool) Put(cn *Conn) error
- func (p *ConnPool) ReapStaleConns() (int, error)
- func (p *ConnPool) Remove(cn *Conn, reason error) error
- func (p *ConnPool) Stats() *Stats
- type Options
- type Pooler
- type Stats
- type WriteBuffer
- 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) StartMessage(c byte)
- func (buf *WriteBuffer) StartParam()
- func (buf *WriteBuffer) Write(b []byte) (int, error)
- func (buf *WriteBuffer) WriteByte(c byte)
- 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") ErrPoolTimeout = errors.New("pg: connection pool timeout") )
Functions ¶
func SetIdleCheckFrequency ¶
Types ¶
type Conn ¶
type Conn struct { Rd *bufio.Reader Columns [][]byte Wr *WriteBuffer InitedAt time.Time UsedAt time.Time ProcessId int32 SecretKey int32 // contains filtered or unexported fields }
func (*Conn) CheckHealth ¶
func (*Conn) FlushWriter ¶
func (*Conn) RemoteAddr ¶
func (*Conn) SetNetConn ¶
func (*Conn) SetReadWriteTimeout ¶
type ConnPool ¶
type ConnPool struct {
// contains filtered or unexported fields
}
func NewConnPool ¶
func (*ConnPool) ReapStaleConns ¶
type Stats ¶
type Stats struct { Requests uint32 // number of times a connection was requested by the pool Hits uint32 // number of times free connection was found in the pool Timeouts uint32 // number of times a wait timeout occurred TotalConns uint32 // the number of total connections in the pool FreeConns uint32 // the number of free connections in 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) 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) StartMessage ¶
func (buf *WriteBuffer) StartMessage(c byte)
func (*WriteBuffer) StartParam ¶
func (buf *WriteBuffer) StartParam()
func (*WriteBuffer) WriteByte ¶
func (buf *WriteBuffer) WriteByte(c byte)
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.