cachedservice

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

cachedservice

Provides entitty manager for firestore redis

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(db Db, url DbUrl) *redis.Client

func NewConfig

func NewConfig(path ConfigPath) *viper.Viper

func NewContext

func NewContext() context.Context

Types

type Cache

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

func NewCache

func NewCache(cl *redis.Client, ctx context.Context) *Cache

func (Cache) Del

func (srv Cache) Del(id string) (int64, error)

func (Cache) GetById

func (srv Cache) GetById(id string) ([]byte, error)

func (Cache) GetByIds

func (srv Cache) GetByIds(ids []string) ([]interface{}, error)

func (Cache) Set

func (srv Cache) Set(id string, obj interface{}) (string, error)

type CachedService

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

func NewCachedService

func NewCachedService(dao *GenericDao, cache *GenericCache, cnv *GenericConverter, idProvider func(interface{}) string) CachedService

func (CachedService) Create

func (srv CachedService) Create(entity interface{}) (interface{}, error)

func (CachedService) Delete

func (srv CachedService) Delete(id string) (interface{}, error)

func (CachedService) Get

func (srv CachedService) Get(id string) (interface{}, error)

func (CachedService) GetByIds

func (srv CachedService) GetByIds(ids []string) (interface{}, error)

func (CachedService) GetByString

func (srv CachedService) GetByString(path, query string) (interface{}, error)

func (CachedService) Update

func (srv CachedService) Update(id string, entity interface{}) (interface{}, error)

type ConfigHolder

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

type ConfigPath

type ConfigPath string

type Converter

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

func NewConverter

func NewConverter(entityProvider func() interface{}) *Converter

func (Converter) FromBinaryJson

func (cnv Converter) FromBinaryJson(str []byte) (interface{}, error)

func (Converter) FromBinaryJsonSlice

func (cnv Converter) FromBinaryJsonSlice(theSlice []interface{}) ([]interface{}, error)

func (Converter) FromMap

func (cnv Converter) FromMap(theMap map[string]interface{}) (interface{}, error)

func (Converter) FromMapSlice

func (cnv Converter) FromMapSlice(theSlice []map[string]interface{}) ([]interface{}, error)

type Dao

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

func NewDao

func NewDao(firestore Firestore, collection string, idConsumer func(string, interface{}), idProvider func(interface{}) string) *Dao

func (Dao) Create

func (dao Dao) Create(entity interface{}) (interface{}, error)

func (Dao) Delete

func (dao Dao) Delete(id string) (interface{}, error)

func (Dao) Get

func (dao Dao) Get(id string) (map[string]interface{}, error)

func (Dao) GetByIds

func (dao Dao) GetByIds(ids []string) ([]map[string]interface{}, error)

func (Dao) GetByString

func (dao Dao) GetByString(path, query string) *firestore.DocumentIterator

func (Dao) Update

func (dao Dao) Update(id string, entity interface{}) (interface{}, error)

type Db

type Db int

type DbUrl

type DbUrl string

type FStore

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

func NewFStore

func NewFStore(ctx context.Context, projectId string) *FStore

func (FStore) Connect

func (ds FStore) Connect() (*firestore.Client, context.Context)

func (FStore) DS

func (ds FStore) DS() (*firestore.Client, context.Context)

type Firestore

type Firestore interface {
	Connect() (*firestore.Client, context.Context)
}

type GenericCache

type GenericCache interface {
	GetById(id string) ([]byte, error)
	GetByIds(ids []string) ([]interface{}, error)
	Set(id string, obj interface{}) (string, error)
	Del(id string) (int64, error)
}

type GenericConverter

type GenericConverter interface {
	FromMap(map[string]interface{}) (interface{}, error)
	FromBinaryJson([]byte) (interface{}, error)
	FromMapSlice([]map[string]interface{}) ([]interface{}, error)
	FromBinaryJsonSlice([]interface{}) ([]interface{}, error)
}

type GenericDao

type GenericDao interface {
	Get(id string) (map[string]interface{}, error)
	Update(id string, entity interface{}) (interface{}, error)
	Create(entity interface{}) (interface{}, error)
	Delete(id string) (interface{}, error)
	GetByIds(ids []string) ([]map[string]interface{}, error)
	GetByString(path, query string) *firestore.DocumentIterator
}

type GenericService

type GenericService interface {
	Get(id string) (interface{}, error)
	Update(id string, entity interface{}) (interface{}, error)
	Create(entity interface{}) (interface{}, error)
	Delete(id string) (interface{}, error)
	GetByIds(ids []string) (interface{}, error)
	GetByString(path, query string) (interface{}, error)
}

type Service

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

func NewService

func NewService(dao *GenericDao, cnv *GenericConverter, idProvider func(interface{}) string) *Service

func (Service) Create

func (srv Service) Create(entity interface{}) (interface{}, error)

func (Service) Delete

func (srv Service) Delete(id string) (interface{}, error)

func (Service) Get

func (srv Service) Get(id string) (interface{}, error)

func (Service) GetByIds

func (srv Service) GetByIds(ids []string) (interface{}, error)

func (Service) GetByString

func (srv Service) GetByString(path, query string) (interface{}, error)

func (Service) Update

func (srv Service) Update(id string, entity interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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