storage

package
v0.0.0-...-c5558d5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	MyDB
	// contains filtered or unexported fields
}

DB -

func NewClient

func NewClient() *DB

NewClient -

func (*DB) Delete

func (db *DB) Delete(ctx context.Context, key interface{}) error

Delete -

func (*DB) Get

func (db *DB) Get(ctx context.Context, key interface{}) (interface{}, error)

Get -

func (*DB) Set

func (db *DB) Set(ctx context.Context, key, value interface{}) error

Set -

type Iface

type Iface interface {
	Get(ctx context.Context, ID string) (*pb.Employee, error)
	Create(ctx context.Context, employee pb.Employee) (string, error)
	Update(ctx context.Context, ID string, employee pb.Employee) error
	Delete(ctx context.Context, ID string) error
}

Iface - storage interface

type MyDB

type MyDB interface {
	Set(ctx context.Context, key, value interface{}) error
	Get(key interface{}) (interface{}, error)
	Delete(key interface{}) error
}

MyDB - my in memory database

type Storage

type Storage struct {
	Iface
	// contains filtered or unexported fields
}

Storage - this is sti implementor

func GetClient

func GetClient() *Storage

GetClient -

func (*Storage) Create

func (s *Storage) Create(ctx context.Context, employee pb.Employee) (string, error)

Create ...

func (*Storage) Delete

func (s *Storage) Delete(ctx context.Context, ID string) error

Delete ...

func (*Storage) Get

func (s *Storage) Get(ctx context.Context, ID string) (*pb.Employee, error)

Get ...

func (*Storage) Update

func (s *Storage) Update(ctx context.Context, ID string, employee pb.Employee) error

Update ...

Jump to

Keyboard shortcuts

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