Documentation ¶
Overview ¶
Package postgres contains Key repository implementations using PostgreSQL as the underlying database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
Connect creates a connection to the PostgreSQL instance and applies any unapplied database migrations. A non-nil error is returned to indicate failure.
func New ¶
func New(db Database) auth.KeyRepository
New instantiates a PostgreSQL implementation of key repository.
func NewMembersRepo ¶ added in v0.24.0
func NewMembersRepo(db Database) auth.MembersRepository
NewMembersRepo instantiates a PostgreSQL implementation of members repository.
func NewOrgRepo ¶
func NewOrgRepo(db Database) auth.OrgRepository
NewOrgRepo instantiates a PostgreSQL implementation of org repository.
func NewRolesRepo ¶
func NewRolesRepo(db Database) auth.RolesRepository
NewRolesRepo instantiates a PostgreSQL implementation of roles repository.
Types ¶
type Config ¶
type Config struct { Host string Port string User string Pass string Name string SSLMode string SSLCert string SSLKey string SSLRootCert string }
Config defines the options that are used when connecting to a PostgreSQL instance
type Database ¶
type Database interface { NamedExecContext(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) BeginTxx(ctx context.Context, opts *sql.TxOptions) (*sqlx.Tx, error) }
Database provides a database interface
func NewDatabase ¶
NewDatabase creates a ThingDatabase instance