Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldsSlice ¶
type FieldsSlice []string
func FieldNames ¶
func FieldNames(tx *sqlx.Tx, arg interface{}) (FieldsSlice, error)
FieldNames returns the current list of fields associated with a type. By using the sqlx.Tx, we can use the existing reflection mapper functionality to get the field names back.
func (FieldsSlice) Join ¶
func (f FieldsSlice) Join() string
type SQLDatabase ¶
type SQLDatabase struct {
// contains filtered or unexported fields
}
SQLDatabase creates a new SQL Database for handling transactions with the required retry semantics.
func NewSQLDatabase ¶
func NewSQLDatabase(db *sql.DB, driverName string) *SQLDatabase
NewSQLDatabase creates a new SQLDatabase from a given *sql.DB
func (*SQLDatabase) CreateTxn ¶
func (s *SQLDatabase) CreateTxn(ctx context.Context) (TxnBuilder, error)
CreateTxn creates a transaction builder. The transaction builder accumulates a series of functions that can be executed on a given commit.
type TxnBuilder ¶
type TxnBuilder interface {
Stage(func(context.Context, *sqlx.Tx) error) TxnBuilder
Commit() error
}
TxnBuilder allows the building of a series of functions that will be called during a transaction commit. Only upon commit is the transaction constructed and the function called. The functions in the txn builder maybe called multiple times depending on how many retries are employed.