Documentation ¶
Overview ¶
Package memory provides an in-memory implementation of the lockbox.dev/accounts.Storer interface.
This implementation is useful for testing and demo setups in which data is not meant to be stored reliably or for a long time. All the data will be permanently lost when the service process exits.
Index ¶
- type Factory
- type Storer
- func (s *Storer) Create(ctx context.Context, account accounts.Account) error
- func (s *Storer) Delete(ctx context.Context, id string) error
- func (s *Storer) Get(ctx context.Context, id string) (accounts.Account, error)
- func (s *Storer) ListByProfile(ctx context.Context, profileID string) ([]accounts.Account, error)
- func (s *Storer) Update(ctx context.Context, id string, change accounts.Change) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storer ¶
type Storer struct {
// contains filtered or unexported fields
}
Storer is an in-memory implementation of the Storer interface.
func NewStorer ¶
NewStorer returns an in-memory Storer instance that is ready to be used as a Storer.
func (*Storer) Create ¶
Create inserts the passed Account into the Storer, returning an ErrAccountAlreadyExists error if an Account with the same ID already exists in the Storer.
func (*Storer) Delete ¶
Delete removes the Account that matches the specified ID from the Storer, if any Account matches the specified ID in the Storer.
func (*Storer) Get ¶
Get retrieves the Account specified by the passed ID from the Storer, returning an ErrAccountNotFound error if no Account matches the passed ID.
func (*Storer) ListByProfile ¶
ListByProfile returns all the Accounts associated with the passed profile ID, sorted with the most recently used Accounts coming first.