store

package
v0.0.0-...-cf576ff Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapStore

type MapStore struct {
	sync.Mutex
	// contains filtered or unexported fields
}

MapStore stores Puppy details with Puppy Id as Key and Puppy as value

func NewMapStore

func NewMapStore() *MapStore

func (*MapStore) CreatePuppy

func (m *MapStore) CreatePuppy(p puppy.Puppy) error

CreatePuppy creates a Puppy in mapstore

func (*MapStore) DeletePuppy

func (m *MapStore) DeletePuppy(id uint32) error

DeletePuppy deletes a Puppy from mapstore

func (*MapStore) ReadPuppy

func (m *MapStore) ReadPuppy(id uint32) (puppy.Puppy, error)

ReadPuppy reads a Puppy from mapstore

func (*MapStore) UpdatePuppy

func (m *MapStore) UpdatePuppy(p puppy.Puppy) error

UpdatePuppy updates a Puppy in mapstore

type Puppy

type Puppy = puppy.Puppy

type Storer

type Storer interface {
	CreatePuppy(Puppy) error
	ReadPuppy(ID uint32) (Puppy, error)
	UpdatePuppy(Puppy Puppy) error
	DeletePuppy(ID uint32) error
}

Storer defines the interface on Puppy

type SyncStore

type SyncStore struct {
	sync.Map
	// contains filtered or unexported fields
}

SyncStore stores Puppy details with Puppy Id as Key and Puppy as value

func NewSyncStore

func NewSyncStore() *SyncStore

func (*SyncStore) CreatePuppy

func (s *SyncStore) CreatePuppy(p puppy.Puppy) error

CreatePuppy creates a Puppy in syncstore

func (*SyncStore) DeletePuppy

func (s *SyncStore) DeletePuppy(id uint32) error

DeletePuppy deletes a Puppy from syncstore

func (*SyncStore) ReadPuppy

func (s *SyncStore) ReadPuppy(id uint32) (puppy.Puppy, error)

ReadPuppy reads a Puppy from syncstore

func (*SyncStore) UpdatePuppy

func (s *SyncStore) UpdatePuppy(p puppy.Puppy) error

UpdatePuppy updates a Puppy in syncstore

Jump to

Keyboard shortcuts

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