Documentation
¶
Index ¶
- Constants
- Variables
- type Conn
- func (co *Conn) Close()
- func (co *Conn) CreateContext(ctx context.Context) (context.Context, context.CancelFunc)
- func (co *Conn) Exec(sql string, arg ...any) (sql.Result, error)
- func (co *Conn) Open() error
- func (co *Conn) Ping() error
- func (co *Conn) SetConnLifeTime(d time.Duration)
- func (co *Conn) SetMaxOpenConns(n int)
- func (co *Conn) SetPoolLifeTime(d time.Duration)
- func (co *Conn) SetSizePool(n int)
- func (co *Conn) StartTransaction() (*Transaction, error)
- func (co *Conn) StartTransactionContext(ctx context.Context) (*Transaction, error)
- type DialectType
- type Transaction
Constants ¶
View Source
const ( NENHUM DialectType = 0 FIREBIRD = 1 INTERBASE = 2 MYSQL = 3 ORACLE = 4 POSTGRESQL = 5 SQLSERVER = 6 SQLITE = 7 )
Variables ¶
View Source
var DialectDrive = [7]string{"firebird", "interbase", "mysql", "oracle", "pgx", "sqlserver", "sqlite"}
View Source
var DialectList = [7]DialectType{FIREBIRD, INTERBASE, MYSQL, ORACLE, POSTGRESQL, SQLSERVER, SQLITE}
View Source
var DialectLow = [7]string{"FIRE", "INTER", "MYSQL", "ORA", "PG", "SQLSERVER", "SQLITE"}
View Source
var DialectName = [7]string{"Firebird", "Interbase", "MySQL", "Oracle", "PostgreSQL", "SQL Server", "SQLite"}
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
DB *sql.DB
Dialect DialectType
DSN string
Log bool
PoolSize int
PoolLifetime time.Duration
MaxOpenConns int
ConnLifetime time.Duration
// contains filtered or unexported fields
}
func (*Conn) CreateContext ¶
func (*Conn) SetConnLifeTime ¶
SetConnLifeTime Tempo de vida das conexões
func (*Conn) SetMaxOpenConns ¶
SetMaxOpenConns Maximo de conexões abertas
func (*Conn) SetPoolLifeTime ¶
SetPoolLifeTime Tempo de vida do Pool de conexões
func (*Conn) SetSizePool ¶
SetSizePool Tamanho maximo do Pool de conexão
func (*Conn) StartTransaction ¶
func (co *Conn) StartTransaction() (*Transaction, error)
func (*Conn) StartTransactionContext ¶
func (co *Conn) StartTransactionContext(ctx context.Context) (*Transaction, error)
type DialectType ¶
type DialectType uint8
func DialectDriveFromString ¶
func DialectDriveFromString(s string) DialectType
func DialectLowFromString ¶
func DialectLowFromString(s string) DialectType
func DialectNameFromString ¶
func DialectNameFromString(s string) DialectType
func (DialectType) String ¶
func (d DialectType) String() string
type Transaction ¶
func NewTransaction ¶
func NewTransaction(conn *Conn) (*Transaction, error)
func NewTransactionCtx ¶
func NewTransactionCtx(conn *Conn, ctx context.Context) (*Transaction, error)
func (*Transaction) Commit ¶
func (t *Transaction) Commit() error
func (*Transaction) Rollback ¶
func (t *Transaction) Rollback() error
Click to show internal directories.
Click to hide internal directories.