Documentation ¶
Index ¶
- type Account
- type MigrationHook
- type MigrationHooks
- type Operator
- type PaginatedAccounts
- type PaginatedOperators
- type PaginatedUsers
- type Pagination
- type TxWrapper
- func (w *TxWrapper) Commit() error
- func (w *TxWrapper) GetAccountSubject(ctx context.Context, name, operatorName string) (subj string, err error)
- func (w *TxWrapper) GetJWTMigrationVersion(ctx context.Context) (int, error)
- func (w *TxWrapper) GetOperatorSubject(ctx context.Context, name string) (subj string, err error)
- func (w *TxWrapper) GetUserSubject(ctx context.Context, name, accountName, operatorName string) (subj string, err error)
- func (w *TxWrapper) ListAccountsRe(ctx context.Context, offset int, nameRegex, operatorNameRegex string) (p PaginatedAccounts, err error)
- func (w *TxWrapper) ListJWTs(ctx context.Context, offset int) (p paginatedJWTs, err error)
- func (w *TxWrapper) ListOperatorsRe(ctx context.Context, offset int, regex string) (p PaginatedOperators, err error)
- func (w *TxWrapper) ListUsersRe(ctx context.Context, offset int, ...) (p PaginatedUsers, err error)
- func (w *TxWrapper) Rollback() error
- func (w *TxWrapper) WalkAccountSubjectsRe(ctx context.Context, nameRegex, operatorNameRegex string, ...) error
- func (w *TxWrapper) WalkJWTs(ctx context.Context, f func(subj string) bool) error
- func (w *TxWrapper) WalkOperatorSubjectsRe(ctx context.Context, regex string, f func(o Operator) bool) error
- func (w *TxWrapper) WalkUserSubjectsRe(ctx context.Context, nameRegex, accountNameRegex, operatorNameRegex string, ...) error
- type User
- type Wrapper
- func (w *Wrapper) BeginTxx(ctx context.Context, opts *sql.TxOptions) (*TxWrapper, error)
- func (w *Wrapper) Close() error
- func (w *Wrapper) CreateAccount(ctx context.Context, name, subject, operatorSubject string) error
- func (w *Wrapper) CreateOperator(ctx context.Context, name, subject string) error
- func (w *Wrapper) CreateUser(ctx context.Context, name, subject, accountSubject string) error
- func (w *Wrapper) GetAccountSubject(ctx context.Context, name, operatorName string) (subj string, err error)
- func (w *Wrapper) GetJWTMigrationVersion(ctx context.Context) (int, error)
- func (w *Wrapper) GetOperatorSubject(ctx context.Context, name string) (subj string, err error)
- func (w *Wrapper) GetUserSubject(ctx context.Context, name, accountName, operatorName string) (subj string, err error)
- func (w *Wrapper) ListAccountsRe(ctx context.Context, offset int, nameRegex, operatorNameRegex string) (p PaginatedAccounts, err error)
- func (w *Wrapper) ListJWTs(ctx context.Context, offset int) (p paginatedJWTs, err error)
- func (w *Wrapper) ListOperatorsRe(ctx context.Context, offset int, regex string) (p PaginatedOperators, err error)
- func (w *Wrapper) ListUsersRe(ctx context.Context, offset int, ...) (p PaginatedUsers, err error)
- func (w *Wrapper) SetJWTMigrationVersion(ctx context.Context, to int) error
- func (w *Wrapper) WalkAccountSubjectsRe(ctx context.Context, nameRegex, operatorNameRegex string, ...) error
- func (w *Wrapper) WalkJWTs(ctx context.Context, f func(subj string) bool) error
- func (w *Wrapper) WalkOperatorSubjectsRe(ctx context.Context, regex string, f func(o Operator) bool) error
- func (w *Wrapper) WalkUserSubjectsRe(ctx context.Context, nameRegex, accountNameRegex, operatorNameRegex string, ...) error
- type WrapperOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MigrationHook ¶
MigrationHook is a function which runs before/after each migration.
type MigrationHooks ¶
type MigrationHooks struct { // Hooks to run before each migration. Before []MigrationHook // Hooks to run after each migration. After []MigrationHook }
MigrationHooks contains hooks to run before/after each migration.
type PaginatedAccounts ¶
type PaginatedAccounts struct { Pagination Accounts []Account }
type PaginatedOperators ¶
type PaginatedOperators struct { Pagination Operators []Operator }
type PaginatedUsers ¶
type PaginatedUsers struct { Pagination Users []User }
type Pagination ¶
type TxWrapper ¶
type TxWrapper struct {
// contains filtered or unexported fields
}
TxWrapper is a database wrapper, with each call running in the same transaction.
func (*TxWrapper) GetAccountSubject ¶
func (*TxWrapper) GetJWTMigrationVersion ¶
func (*TxWrapper) GetOperatorSubject ¶
func (*TxWrapper) GetUserSubject ¶
func (*TxWrapper) ListAccountsRe ¶
func (*TxWrapper) ListOperatorsRe ¶
func (*TxWrapper) ListUsersRe ¶
func (*TxWrapper) Rollback ¶
Rollback rolls back the transaction if it has not already been committed.
func (*TxWrapper) WalkAccountSubjectsRe ¶
func (*TxWrapper) WalkOperatorSubjectsRe ¶
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
Wrapper wraps the PostgreSQL database (connection pool). It can start transactions.
func (*Wrapper) BeginTxx ¶
BeginTxx creates a new TxWrapper. opts can be specified as nil to use default options.
func (*Wrapper) CreateAccount ¶
func (*Wrapper) CreateOperator ¶
func (*Wrapper) CreateUser ¶
func (*Wrapper) GetAccountSubject ¶
func (*Wrapper) GetJWTMigrationVersion ¶
func (*Wrapper) GetOperatorSubject ¶
func (*Wrapper) GetUserSubject ¶
func (*Wrapper) ListAccountsRe ¶
func (*Wrapper) ListOperatorsRe ¶
func (*Wrapper) ListUsersRe ¶
func (*Wrapper) SetJWTMigrationVersion ¶
func (*Wrapper) WalkAccountSubjectsRe ¶
func (*Wrapper) WalkOperatorSubjectsRe ¶
type WrapperOpt ¶
type WrapperOpt func(w wrapperOpts) wrapperOpts
WrapperOpt is a function which configures the options for the Wrapper.
func WithMigrationHooks ¶
func WithMigrationHooks(h MigrationHooks) WrapperOpt
WithMigrationHooks adds migration hooks.
func WithMigrationsURL ¶
func WithMigrationsURL(url string) WrapperOpt
WithMigrationsURL sets the URL at which the migrations can be found.