Documentation
¶
Overview ¶
Package postgres contains repository implementations using PostgreSQL as the underlying database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(cfg config.PostgresConfig) (*sqlx.DB, error)
Connect creates a connection to the PostgreSQL instance and applies any unapplied database migrations. A non-nil error is returned to indicate failure.
func NewPoliciesRepository ¶
func NewPoliciesRepository(db Database, log *zap.Logger) policies.Repository
Types ¶
type Database ¶
type Database interface {
NamedExecContext(context.Context, string, interface{}) (sql.Result, error)
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
QueryRowxContext(context.Context, string, ...interface{}) *sqlx.Row
QueryxContext(context.Context, string, ...interface{}) (*sqlx.Rows, error)
NamedQueryContext(context.Context, string, interface{}) (*sqlx.Rows, error)
GetContext(context.Context, interface{}, string, ...interface{}) error
BeginTxx(context.Context, *sql.TxOptions) (*sqlx.Tx, error)
Rebind(string) string
}
Database provides a database interface
func NewDatabase ¶
NewDatabase creates a ThingDatabase instance
Click to show internal directories.
Click to hide internal directories.