Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQL ¶
type SQL interface { Close() error // Will close all open database connection. Writer() SQLExecutor Reader() SQLExecutor NewTransaction(ctx context.Context) (Transaction, error) }
SQL can be use writer or read replica only.
func NewConnection ¶
NewConnection will create new connection for selected package.
type SQLExecutor ¶
type SQLExecutor interface { Query(ctx context.Context, destination interface{}, query string, args ...interface{}) error Exec(ctx context.Context, query string, args ...interface{}) error }
SQLExecutor should implements query and exec. You must select whether it use master or slave database.
type Transaction ¶
type Transaction interface { Query(ctx context.Context, destination interface{}, query string, args ...interface{}) error Exec(ctx context.Context, query string, args ...interface{}) error Commit(ctx context.Context) error Rollback(ctx context.Context) error }
Transaction must always using writer/master database.
Click to show internal directories.
Click to hide internal directories.