memory

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct{}

func (Factory) NewStorer

func (f Factory) NewStorer(ctx context.Context) (scopes.Storer, error)

func (Factory) TeardownStorers

func (f Factory) TeardownStorers() error

type Storer

type Storer struct {
	// contains filtered or unexported fields
}

Storer is an in-memory implementation of the Storer interface.

func NewStorer

func NewStorer() (*Storer, error)

NewStorer returns a Storer instance that is ready to be used as a Storer.

func (*Storer) Create

func (s *Storer) Create(ctx context.Context, scope scopes.Scope) error

Create inserts the passed Scope into the Storer, returning an ErrScopeAlreadyExists error if a Scope with the same ID already exists in the Storer.

func (*Storer) Delete

func (s *Storer) Delete(ctx context.Context, id string) error

Delete removes the Scope that matches the specified ID from the Storer, if any Scope matches the specified ID in the Storer.

func (*Storer) GetMulti

func (s *Storer) GetMulti(ctx context.Context, ids []string) (map[string]scopes.Scope, error)

GetMulti retrieves the Scopes specified by the passed IDs from the Storer, 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

func (s *Storer) ListDefault(ctx context.Context) ([]scopes.Scope, error)

ListDefault returns all the Scopes with IsDefault set to true. sorted lexicographically by their ID.

func (*Storer) Update

func (s *Storer) Update(ctx context.Context, id string, change scopes.Change) error

Update applies the passed Change to the Scope that matches the specified ID in the Storer, if any Scope matches the specified ID in the Storer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL