Skip to content

Instantly share code, notes, and snippets.

@wttw
Created January 18, 2018 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wttw/20b8800eab5c11ef01e175faf2feae7b to your computer and use it in GitHub Desktop.
Save wttw/20b8800eab5c11ef01e175faf2feae7b to your computer and use it in GitHub Desktop.
// Databaser is implemented by pgx.ConnPool, pgx.Conn and pgx.Tx
// model.XODB is a subset of global.Database
type Databaser interface {
Exec(string, ...interface{}) (pgx.CommandTag, error)
Query(sql string, args ...interface{}) (*pgx.Rows, error)
QueryRow(sql string, args ...interface{}) *pgx.Row
Prepare(name, sql string) (*pgx.PreparedStatement, error)
}
// Txer is implemented by pgx.ConnPool and pgx.Conn
type Txer interface {
Databaser
Begin() (*pgx.Tx, error)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment