Documentation ¶
Index ¶
- type Storage
- func (s *Storage) Create(p storage.Payment) (uuid.UUID, error)
- func (s *Storage) CreateSpecificID(id uuid.UUID, p storage.Payment) error
- func (s *Storage) Delete(id uuid.UUID) error
- func (s *Storage) Initialise() error
- func (s *Storage) Read(id uuid.UUID) (storage.Payment, error)
- func (s *Storage) ReadAll(rao storage.ReadAllOptions) (map[uuid.UUID]storage.Payment, error)
- func (s *Storage) Terminate(...bool) error
- func (s *Storage) Update(id uuid.UUID, p storage.Payment) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is an in-memory storage system that uses a map to store Payment structs indexed by UUID.
func (*Storage) CreateSpecificID ¶
CreateSpecificID will create the given Payment with that specific UUID, rather than generating its own. Intended for use with testing, and not in production.
func (*Storage) Initialise ¶
Initialise will initialise the internal map.
func (*Storage) ReadAll ¶
ReadAll will read all available Payments, up to the limit which is either 1) explicit in the given ReadAllOptions struct, or 2) the default limit which is also exported by this package. The Payments will be returned in order based on their respective UUIDs. The entire collection of Payments can be paginated through via the Offset property of the ReadAllOptions struct, and by default when such an Offset is not explicitly specified, the returned collection will start from the beginning of the store.
func (*Storage) Terminate ¶
Terminate will terminate the internal map by setting the internal store to nil, so that the garbage collector will pick up the map's contents. It does not bother checking the true/false argument for whether or not to destroy the stored data, due to the very nature of its implementation.