repository

package
v0.0.0-...-caa72ac Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMongoClient

func NewMongoClient() (*mongo.Client, error)

func NewRedis

func NewRedis(host string, enableTls bool, passwd string, db int) *redis.Client

NewRedis returns a client to the Redis Server

Types

type DeviceRepository

type DeviceRepository interface {
	Save(ctx context.Context, d *entity.Device) (string, error)
	FindById(ctx context.Context, id string) (*entity.Device, error)
	FindAll(ctx context.Context) ([]entity.Device, error)
}

type MongoRepo

type MongoRepo struct{}

func NewMongoRepository

func NewMongoRepository() *MongoRepo

func (MongoRepo) FindAll

func (MongoRepo) FindAll(ctx context.Context) ([]entity.Device, error)

func (MongoRepo) FindById

func (MongoRepo) FindById(ctx context.Context, id string) (*entity.Device, error)

func (MongoRepo) Save

func (MongoRepo) Save(ctx context.Context, d *entity.Device) (string, error)

type RedisRepo

type RedisRepo struct{}

func NewRedisRepository

func NewRedisRepository() *RedisRepo

func (RedisRepo) FindAll

func (RedisRepo) FindAll(ctx context.Context) ([]entity.Device, error)

func (RedisRepo) FindById

func (RedisRepo) FindById(ctx context.Context, id string) (*entity.Device, error)

func (RedisRepo) Save

func (RedisRepo) Save(ctx context.Context, d *entity.Device) (string, error)

Jump to

Keyboard shortcuts

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