sql

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(name string, pingInterval time.Duration,
	pingTimesForChangeStatus int, pool *pools.ResourcePool) proto.DB

Types

type DB

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

func (*DB) Active

func (db *DB) Active() int64

Active returns the number of active (i.e. non-nil) connections either in the pool or claimed for use

func (*DB) Available

func (db *DB) Available() int64

Available returns the number of currently unused and available connections.

func (*DB) Begin

func (db *DB) Begin(ctx context.Context) (proto.Tx, proto.Result, error)

func (*DB) Capacity

func (db *DB) Capacity() int64

Capacity returns the capacity.

func (*DB) Close

func (db *DB) Close()

func (*DB) ExecuteFieldList

func (db *DB) ExecuteFieldList(ctx context.Context, table, wildcard string) ([]proto.Field, error)

func (*DB) ExecuteSql

func (db *DB) ExecuteSql(ctx context.Context, sql string, args ...interface{}) (proto.Result, uint16, error)

func (*DB) ExecuteStmt

func (db *DB) ExecuteStmt(ctx context.Context, stmt *proto.Stmt) (proto.Result, uint16, error)

func (*DB) Exhausted

func (db *DB) Exhausted() int64

Exhausted returns the number of times Available dropped below 1

func (*DB) IdleClosed

func (db *DB) IdleClosed() int64

IdleClosed returns the count of connections closed due to idle timeout.

func (*DB) IdleTimeout

func (db *DB) IdleTimeout() time.Duration

IdleTimeout returns the idle timeout.

func (*DB) InUse

func (db *DB) InUse() int64

InUse returns the number of claimed connections from the pool

func (*DB) IsClosed

func (db *DB) IsClosed() (closed bool)

IsClosed returns true if the db is closed.

func (*DB) MaxCap

func (db *DB) MaxCap() int64

MaxCap returns the max capacity.

func (*DB) Name

func (db *DB) Name() string

func (*DB) Ping

func (db *DB) Ping()

func (*DB) Query

func (db *DB) Query(ctx context.Context, query string) (proto.Result, uint16, error)

func (*DB) SetCapacity

func (db *DB) SetCapacity(capacity int) error

func (*DB) SetConnectionPostFilters

func (db *DB) SetConnectionPostFilters(filters []proto.DBConnectionPostFilter)

func (*DB) SetConnectionPreFilters

func (db *DB) SetConnectionPreFilters(filters []proto.DBConnectionPreFilter)

func (*DB) SetIdleTimeout

func (db *DB) SetIdleTimeout(idleTimeout time.Duration)

func (*DB) StatsJSON

func (db *DB) StatsJSON() string

StatsJSON returns the stats in JSON format.

func (*DB) Status

func (db *DB) Status() proto.DBStatus

func (*DB) TestConn

func (db *DB) TestConn() error

func (*DB) UseDB

func (db *DB) UseDB(ctx context.Context, schema string) error

func (*DB) WaitCount

func (db *DB) WaitCount() int64

WaitCount returns the total number of waits.

func (*DB) WaitTime

func (db *DB) WaitTime() time.Duration

WaitTime returns the total wait time.

type Tx

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

func (*Tx) Close

func (tx *Tx) Close()

func (*Tx) Commit

func (tx *Tx) Commit(ctx context.Context) (result proto.Result, err error)

func (*Tx) ExecuteSql

func (tx *Tx) ExecuteSql(ctx context.Context, sql string, args ...interface{}) (proto.Result, uint16, error)

func (*Tx) ExecuteStmt

func (tx *Tx) ExecuteStmt(ctx context.Context, stmt *proto.Stmt) (proto.Result, uint16, error)

func (*Tx) Query

func (tx *Tx) Query(ctx context.Context, query string) (proto.Result, uint16, error)

func (*Tx) Rollback

func (tx *Tx) Rollback(ctx context.Context) (result proto.Result, err error)

Jump to

Keyboard shortcuts

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