yaorm: github.com/geoffreybauduin/yaorm/_vendor/github.com/loopfz/gadgeto/zesty Index | Files | Directories

package zesty

import "github.com/geoffreybauduin/yaorm/_vendor/github.com/loopfz/gadgeto/zesty"

zesty is based on gorp, and abstracts DB transaction specifics. You can create a zesty.DB by calling NewDB(). You can then register this DB by calling RegisterDB(). This lets you instantiate DBProviders for this DB with NewDBProvider(), which is the main object that you manipulate. A DBProvider contains a DB instance, and provides Tx functionalities. You access the DB by calling provider.DB() By calling provider.Tx(), you create a new transaction. Future calls to provider.DB() will provide the Tx instead of the main DB object, allowing caller code to be completely ignorant of transaction context. Transactions can be nested infinitely, and each nesting level can be rolled back independantly. Only the final commit will end the transaction and commit the changes to the DB.

Index

Package Files

zesty.go

func RegisterDB Uses

func RegisterDB(db DB, name string) error

func UnregisterDB Uses

func UnregisterDB(name string) error

type DB Uses

type DB interface {
    gorp.SqlExecutor
    Begin() (Tx, error)
    Close() error
    Ping() error
    Stats() sql.DBStats
}

func GetDB Uses

func GetDB(name string) (DB, error)

func NewDB Uses

func NewDB(dbmap *gorp.DbMap) DB

type DBProvider Uses

type DBProvider interface {
    DB() gorp.SqlExecutor
    Tx() error
    Commit() error
    Rollback() error
    Close() error
    Ping() error
    Stats() sql.DBStats
}

func NewDBProvider Uses

func NewDBProvider(name string) (DBProvider, error)

func NewTempDBProvider Uses

func NewTempDBProvider(db DB) DBProvider

type Tx Uses

type Tx interface {
    gorp.SqlExecutor
    Commit() error
    Rollback() error
    Savepoint(string) error
    RollbackToSavepoint(string) error
}

Directories

PathSynopsis
utils/rekordo

Package zesty imports 5 packages (graph) and is imported by 2 packages. Updated 2018-09-07. Refresh now. Tools for package owners.