memory/mem
import "github.com/barevoidco/zelk/core/memory/mem"Package mem is an in-memory memory.Store, for tests. Notes are kept in their stored form, so revisions and parsing behave as in memory/file.
Option
Section titled “Option”type Option func(*Store)Option configures a Store.
WithClock
Section titled “WithClock”func WithClock(now func() time.Time) OptionWithClock sets the clock that stamps notes; the default is time.Now.
type Store struct { // contains filtered or unexported fields}Store is an in-memory memory.Store. The zero value is ready to use, and a Store is safe for concurrent use.
func New(opts ...Option) *StoreNew returns an empty Store.
Store.Delete
Section titled “Store.Delete”func (s *Store) Delete(ctx context.Context, scope memory.Scope, name string, expect memory.Revision) errorDelete removes scope’s note name, as memory.Store.Delete says.
Store.List
Section titled “Store.List”func (s *Store) List(ctx context.Context, scope memory.Scope) ([]memory.Note, error)List returns scope’s notes, ordered by name.
Store.Put
Section titled “Store.Put”func (s *Store) Put(ctx context.Context, n memory.Note, expect memory.Revision) (memory.Note, error)Put saves n, as memory.Store.Put says.
Store.Set
Section titled “Store.Set”func (s *Store) Set(scope memory.Scope, name string, data []byte)Set stores data as scope’s note name, bypassing every check, as a person editing a file would. It is for tests of how notes edited by hand are read.