# memory/mem

> Package mem is an in-memory memory.Store, for tests.

<!-- Generated from the Go source of github.com/barevoidco/zelk/core/memory/mem (cmd/zelk/internal/reference TestReferenceGoAPI). Don't edit: change the code, then run make reference. -->

```go
import "github.com/barevoidco/zelk/core/memory/mem"
```

Package mem is an in-memory [memory.Store](/reference/go/memory/#store), for tests. Notes are kept in their stored form, so revisions and parsing behave as in memory/file.


## Option

```go
type Option func(*Store)
```

Option configures a Store.


### WithClock

```go
func WithClock(now func() time.Time) Option
```

WithClock sets the clock that stamps notes; the default is time.Now.


## Store

```go
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.


### New

```go
func New(opts ...Option) *Store
```

New returns an empty Store.


### Store.Delete

```go
func (s *Store) Delete(ctx context.Context, scope memory.Scope, name string, expect memory.Revision) error
```

Delete removes scope's note name, as memory.Store.Delete says.


### Store.List

```go
func (s *Store) List(ctx context.Context, scope memory.Scope) ([]memory.Note, error)
```

List returns scope's notes, ordered by name.


### Store.Put

```go
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

```go
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.
