Documentation ¶
Index ¶
- Constants
- type Factory
- type Scope
- type Storer
- func (s *Storer) Create(ctx context.Context, scope scopes.Scope) error
- func (s *Storer) Delete(ctx context.Context, id string) error
- func (s *Storer) GetMulti(ctx context.Context, ids []string) (map[string]scopes.Scope, error)
- func (s *Storer) ListDefault(ctx context.Context) ([]scopes.Scope, error)
- func (s *Storer) Update(ctx context.Context, id string, change scopes.Change) error
Constants ¶
const (
TestConnStringEnvVar = "PG_TEST_DB"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func (*Factory) TeardownStorers ¶
type Scope ¶
type Scope struct { ID string `sql_column:"id"` UserPolicy string `sql_column:"user_policy"` UserExceptions pqarrays.StringArray `sql_column:"user_exceptions"` ClientPolicy string `sql_column:"client_policy"` ClientExceptions pqarrays.StringArray `sql_column:"client_exceptions"` IsDefault bool `sql_column:"is_default"` }
func (Scope) GetSQLTableName ¶
type Storer ¶
type Storer struct {
// contains filtered or unexported fields
}
Storer is an implementation of the Storer interface that stores data in a PostgreSQL database.
func NewStorer ¶
NewStorer returns a Storer instance that is backed by the specified *sql.DB. The returned Storer instance is ready to be used as a Storer.
func (*Storer) Create ¶
Create inserts the passed Scope into the database, returning an ErrScopeAlreadyExists error if a Scope with the same ID already exists in the database.
func (*Storer) Delete ¶
Delete removes the Scope that matches the specified ID from the Memstore, if any Scope matches the specified ID in the Memstore.
func (*Storer) GetMulti ¶
GetMulti retrieves the Scopes specified by the passed IDs from the database, returning an empty map if no matching Scopes are found. If a Scope is not found, no error will be returned, it will just be omitted from the map.
func (*Storer) ListDefault ¶
ListDefault returns all the Scopes with IsDefault set to true. sorted lexicographically by their ID.