capsule

package
v0.0.0-...-60a21d4 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

func Query() query.Query

func Schema

func Schema() schema.Schema

Types

type Connection

type Connection struct {
	sqlx.DB
	Config *dbal.Config
}

func (*Connection) Ping

func (conn *Connection) Ping(timeout time.Duration) (err error)

type Manager

type Manager struct {
	Pool        *Pool
	Connections *sync.Map
	Option      *dbal.Option
}
var Global *Manager = nil

func Add

func Add(name string, driver string, dsn string) (*Manager, error)

func AddConn

func AddConn(name string, driver string, datasource string, timeout ...time.Duration) *Manager

func AddRead

func AddRead(name string, driver string, dsn string) (*Manager, error)

func AddReadConn

func AddReadConn(name string, driver string, datasource string, timeout ...time.Duration) *Manager

func New

func New() *Manager

func NewWithOption

func NewWithOption(option dbal.Option) *Manager

func (*Manager) Add

func (manager *Manager) Add(name string, driver string, datasource string, readonly bool) (*Manager, error)

func (*Manager) AddConn

func (manager *Manager) AddConn(name string, driver string, datasource string, timeout ...time.Duration) *Manager

func (*Manager) AddConnection

func (manager *Manager) AddConnection(name string, driver string, datasource string, readonly bool, timeouts ...time.Duration) *Manager

func (*Manager) AddReadConn

func (manager *Manager) AddReadConn(name string, driver string, datasource string, timeout ...time.Duration) *Manager

func (*Manager) Close

func (manager *Manager) Close() error

func (*Manager) Primary

func (manager *Manager) Primary() (*Connection, error)

func (*Manager) Query

func (manager *Manager) Query() query.Query

func (*Manager) ReadOnly

func (manager *Manager) ReadOnly() (*Connection, error)

func (*Manager) Schema

func (manager *Manager) Schema() schema.Schema

func (*Manager) SetAsGlobal

func (manager *Manager) SetAsGlobal()

func (*Manager) SetOption

func (manager *Manager) SetOption(option dbal.Option)

type Pool

type Pool struct {
	Primary  []*Connection
	Readonly []*Connection
}

func (Pool) RandPrimary

func (pool Pool) RandPrimary() (*Connection, error)

func (*Pool) RandReadOnly

func (pool *Pool) RandReadOnly() (*Connection, error)

Jump to

Keyboard shortcuts

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