Documentation ¶
Overview ¶
Package mem is an example REST backend storage that stores everything in memory.
Index ¶
- type MemoryHandler
- func (m *MemoryHandler) Clear(ctx context.Context, q *query.Query) (total int, err error)
- func (m *MemoryHandler) Delete(ctx context.Context, item *resource.Item) (err error)
- func (m *MemoryHandler) Find(ctx context.Context, q *query.Query) (list *resource.ItemList, err error)
- func (m *MemoryHandler) Insert(ctx context.Context, items []*resource.Item) (err error)
- func (m *MemoryHandler) Update(ctx context.Context, item *resource.Item, original *resource.Item) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryHandler ¶
type MemoryHandler struct { sync.RWMutex // If Latency is set, the handler will introduce an artificial latency on // all operations. Latency time.Duration // contains filtered or unexported fields }
MemoryHandler is an example handler storing data in memory.
func NewSlowHandler ¶
func NewSlowHandler(latency time.Duration) *MemoryHandler
NewSlowHandler creates an empty memory handler with specified latency.
func (*MemoryHandler) Find ¶
func (m *MemoryHandler) Find(ctx context.Context, q *query.Query) (list *resource.ItemList, err error)
Find items from memory matching the q.
Click to show internal directories.
Click to hide internal directories.