persistdb

package
v0.0.0-...-0da26dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageSyncer int = 0
	EventSyncer       = 1
	PatientSyncer     = 2
)

Variables

This section is empty.

Functions

Types

type DbItemSyncer

type DbItemSyncer struct {
	// contains filtered or unexported fields
}

ItemSyncer implements the persist.ItemSyncer interface using a map. It tracks the LoadByID requests made to the syncer in the form of an internal `reqs` map for testing purposes.

func NewItemSyncer

func NewItemSyncer(syncType int) *DbItemSyncer

NewItemSyncer initializes the ItemSyncer.

func NewItemSyncerWithDelete

func NewItemSyncerWithDelete(syncType int, delete bool) *DbItemSyncer

NewItemSyncerWithDelete initializes the ItemSyncer with a value for whether to delete items or not.

func (*DbItemSyncer) Count

func (s *DbItemSyncer) Count() int

Count returns number of elements in the syncer for testing.

func (*DbItemSyncer) CountDeletes

func (s *DbItemSyncer) CountDeletes() int

CountDeletes returns the number of deletions requested.

func (*DbItemSyncer) Delete

func (s *DbItemSyncer) Delete(item persist.MarshallableItem) error

Delete deletes an item from the map.

func (*DbItemSyncer) LoadAll

func (s *DbItemSyncer) LoadAll() ([]persist.MarshallableItem, error)

LoadAll returns a slice of all the items in the map, sorted by id.

func (*DbItemSyncer) LoadByID

func (s *DbItemSyncer) LoadByID(id string) (persist.MarshallableItem, error)

LoadByID returns an item in the map with the provided id, if it exists.

func (*DbItemSyncer) Write

func (s *DbItemSyncer) Write(item persist.MarshallableItem) error

Write writes an item to the map.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL