Documentation ¶
Index ¶
- type PatchFuncType
- type SQLDb
- func (sdb *SQLDb) BeginTrans() error
- func (sdb *SQLDb) CommitOnNoError(err error) error
- func (sdb *SQLDb) CommitOnSuccess(success bool) error
- func (sdb *SQLDb) CommitSavePoint(name string) error
- func (sdb *SQLDb) CommitSavePointOnNoError(name string, err error) error
- func (sdb *SQLDb) CommitSavePointOnSuccess(name string, success bool) error
- func (sdb *SQLDb) CommitTrans() error
- func (sdb *SQLDb) CreateIndex(indexDef string) error
- func (sdb *SQLDb) CreateSavePoint(name string) error
- func (sdb *SQLDb) CreateTable(tableDef string) error
- func (sdb *SQLDb) DropTable(tableDef string) error
- func (sdb *SQLDb) Exec(stmt string, args ...interface{}) error
- func (sdb *SQLDb) ExecResults(stmt string, args ...interface{}) (sql.Result, error)
- func (sdb *SQLDb) ExecWithSavePoint(spName string, fn func() error) error
- func (sdb *SQLDb) GetGkey() (int, error)
- func (sdb *SQLDb) MultiQuery(stmt string, action func(rows *sql.Rows) error) error
- func (sdb *SQLDb) PatchDb(patchFuncs []PatchFuncType) error
- func (sdb *SQLDb) RollbackSavePoint(name string) error
- func (sdb *SQLDb) RollbackTrans() error
- func (sdb *SQLDb) SingleQuery(stmt string, args ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PatchFuncType ¶
type PatchFuncType struct { // PatchID is not necessarily sequential. It just needs to be unique, but convention is sequential. PatchID int // PatchFunc will perform patch operations on the database. PatchFunc func(sdb *SQLDb) error }
PatchFuncType contains unique patch ID and a patch function to run.
type SQLDb ¶
SQLDb - SQL Database wrapper with extended patching functions.
func OpenAndPatchDb ¶
func OpenAndPatchDb(dbFilename string, patchFuncs []PatchFuncType) (*SQLDb, error)
OpenAndPatchDb - Open and Patch a database if necessary.
func (*SQLDb) CommitOnNoError ¶
CommitOnNoError - Commit the transaction if the error is nil
func (*SQLDb) CommitOnSuccess ¶
CommitOnSuccess - Commit the transaction if the expression evaluates to true.
func (*SQLDb) CommitSavePoint ¶
CommitSavePoint - Commit up to the named save point, which rolls it up into parent transaction.
func (*SQLDb) CommitSavePointOnNoError ¶
CommitSavePointOnNoError - Commit up to the save point (or merge with parent transaction) if the error is nil.
func (*SQLDb) CommitSavePointOnSuccess ¶
CommitSavePointOnSuccess - Commit up to the save point (or merge with parent transaction) if the expression evaluates to true.
func (*SQLDb) CreateIndex ¶
CreateIndex - Create the index definition.
func (*SQLDb) CreateSavePoint ¶
CreateSavePoint - Create a save point for rollback or commit.
func (*SQLDb) CreateTable ¶
CreateTable - Create the table definition.
func (*SQLDb) ExecResults ¶
ExecResults - Execute the statement with the bound arguments.
func (*SQLDb) ExecWithSavePoint ¶ added in v1.0.2
ExecWithSavePoint - Execute the database function wrapped inside of a named Save Point.
func (*SQLDb) MultiQuery ¶
MultiQuery - Execute a function on the returned query rows.
func (*SQLDb) PatchDb ¶
func (sdb *SQLDb) PatchDb(patchFuncs []PatchFuncType) error
PatchDb - Patch a database if necessary.
func (*SQLDb) RollbackSavePoint ¶
RollbackSavePoint - Rollback a save point
func (*SQLDb) RollbackTrans ¶
RollbackTrans - Rollback transaction
func (*SQLDb) SingleQuery ¶
SingleQuery - Query the database, and retrieve the results. Expected single value return.