Documentation ¶
Index ¶
- type DBService
- func (s *DBService) Begin() (*sql.Tx, error)
- func (s *DBService) Exec(query string, args ...interface{}) (sql.Result, error)
- func (s *DBService) GetDB() *sql.DB
- func (s *DBService) Init(_ *kernel.Kernel) error
- func (s *DBService) MaxIdle(maxIdle int) *DBService
- func (s *DBService) MaxLifetime(maxLifetime time.Duration) *DBService
- func (s *DBService) MaxOpen(maxOpen int) *DBService
- func (s *DBService) Prepare(sql string) (*sql.Stmt, error)
- func (s *DBService) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (s *DBService) QueryRow(query string, args ...interface{}) *sql.Row
- func (s *DBService) SetDB(postgresURI string) *DBService
- func (s *DBService) Start() error
- func (s *DBService) Stop()
- func (s *DBService) Update(f TxHandler) error
- type OnCommit
- type Tx
- func (tx *Tx) BeforeCommit(f TxHandler)
- func (tx *Tx) DeleteFrom(table string) (sql.Result, error)
- func (tx *Tx) Exec(query string, args ...interface{}) (sql.Result, error)
- func (tx *Tx) ExecBeforeCommit(query string, args ...interface{})
- func (tx *Tx) ExecOnCommit(query string, args ...interface{})
- func (tx *Tx) OnCommit(f OnCommit)
- func (tx *Tx) OnCommitCluster(table, column string)
- func (tx *Tx) OnCommitVacuum(table string)
- func (tx *Tx) OnCommitVacuumFull(table string)
- func (tx *Tx) Prepare(query string) (*sql.Stmt, error)
- func (tx *Tx) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tx *Tx) QueryRow(query string, args ...interface{}) *sql.Row
- func (tx *Tx) SetEncoding(enc string) error
- func (tx *Tx) SetEncodingUTF8() error
- func (tx *Tx) SetEncodingWIN1252() error
- func (tx *Tx) UpdateOnCommit(f TxHandler)
- type TxHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBService ¶
type DBService struct { // Set to true to enable additional debugging Debug bool // contains filtered or unexported fields }
DBService database/sql bound with github.com/lib/pq as a Kernel Service
func (*DBService) MaxLifetime ¶
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx wrapper around sql.Tx with additional functionality
func (*Tx) BeforeCommit ¶
BeforeCommit will call the supplied function when the transaction is about to commit but before the actual commit.
func (*Tx) DeleteFrom ¶
DeleteFrom is a wrapper around deleting from a table
func (*Tx) ExecBeforeCommit ¶
ExecBeforeCommit will execute a query once this transaction commits BUT BEFORE the actual transaction commits.
Unlike ExecOnCommit this runs within this transaction, it's just queued so that it will be run before the transaction is finally Committed. Note this will not be within a transaction, see UpdateOnCommit for that
func (*Tx) ExecOnCommit ¶
ExecOnCommit will execute a query once this transaction commits. Note this will not be within a transaction, see UpdateOnCommit for that
func (*Tx) OnCommitCluster ¶
func (*Tx) OnCommitVacuum ¶
func (*Tx) OnCommitVacuumFull ¶
func (*Tx) SetEncoding ¶
func (*Tx) SetEncodingUTF8 ¶
Set's the connection encoding to "UTF8" - the default in the database. Use if SetEncodingWIN1252 or SetEncoding has been used.
func (*Tx) SetEncodingWIN1252 ¶
Set's the connection encoding to "WIN1252" - use with csv style imports which have latin characters rather than UTF8
func (*Tx) UpdateOnCommit ¶
UpdateOnCommit will start a new update/transaction once this transaction commits