mongoredis

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMongoRedis

func NewMongoRedis[T cachelayer.Table[I], I cachelayer.IDType](prefix, database, collection, idField string, db *mongo.Client, red *redis.Client, ttl time.Duration) *cachelayer.RedisCache[T, I]

func NewMongoRedisFull

func NewMongoRedisFull[T cachelayer.Table[I], I cachelayer.IDType](prefix, database, collection, idField string, db *mongo.Client, red *redis.Client, ttl time.Duration) *cachelayer.FullRedisCache[T, I]

Types

type Mongo

type Mongo[T cachelayer.Table[I], I cachelayer.IDType] struct {
	// contains filtered or unexported fields
}

func (*Mongo[T, I]) Close

func (s *Mongo[T, I]) Close() error

func (*Mongo[T, I]) Create

func (s *Mongo[T, I]) Create(t *T) error

func (*Mongo[T, I]) DB

func (s *Mongo[T, I]) DB() *mongo.Client

func (*Mongo[T, I]) Delete

func (s *Mongo[T, I]) Delete(ids ...I) (int64, error)

func (*Mongo[T, I]) Get

func (s *Mongo[T, I]) Get(id I) (T, bool, error)

func (*Mongo[T, I]) GetBy

func (s *Mongo[T, I]) GetBy(index cachelayer.Index) (T, bool, error)

func (*Mongo[T, I]) List

func (s *Mongo[T, I]) List(ids ...I) ([]T, error)

func (*Mongo[T, I]) ListAll

func (s *Mongo[T, I]) ListAll() ([]T, error)

func (*Mongo[T, I]) ListBy

func (s *Mongo[T, I]) ListBy(index cachelayer.Index, orderBys cachelayer.OrderBys) ([]T, error)

func (*Mongo[T, I]) Save

func (s *Mongo[T, I]) Save(t *T) error

func (*Mongo[T, I]) Update

func (s *Mongo[T, I]) Update(id I, values interface{}) (int64, error)

type RedisMongo

type RedisMongo[T cachelayer.Table[I], I string] struct {
	*cachelayer.CacheBase[T, I]
	// contains filtered or unexported fields
}

func NewRedisMongo

func NewRedisMongo[T cachelayer.Table[I], I string](prefix, database, table, idField string, db *mongo.Client, red *redis.Client, ttl time.Duration) *RedisMongo[T, I]

func (*RedisMongo[T, I]) ClearCache

func (s *RedisMongo[T, I]) ClearCache(id I, indexes cachelayer.Indexes) error

func (*RedisMongo[T, I]) Close

func (s *RedisMongo[T, I]) Close() error

func (*RedisMongo[T, I]) Create

func (s *RedisMongo[T, I]) Create(t *T) error

func (*RedisMongo[T, I]) Delete

func (s *RedisMongo[T, I]) Delete(ids ...I) (int64, error)

func (*RedisMongo[T, I]) Get

func (s *RedisMongo[T, I]) Get(id I) (T, bool, error)

func (*RedisMongo[T, I]) GetBy

func (s *RedisMongo[T, I]) GetBy(index cachelayer.Index) (T, bool, error)

func (*RedisMongo[T, I]) List

func (s *RedisMongo[T, I]) List(ids ...I) ([]T, error)

func (*RedisMongo[T, I]) ListBy

func (s *RedisMongo[T, I]) ListBy(index cachelayer.Index, orderBys cachelayer.OrderBys) ([]T, error)

func (*RedisMongo[T, I]) Save

func (s *RedisMongo[T, I]) Save(t *T) error

func (*RedisMongo[T, I]) Update

func (s *RedisMongo[T, I]) Update(id I, values interface{}) (int64, error)

Update values type: map[string]interface{} , eg:map[string]interface{}{"addr.country": "uae", "tags.0.name": "gg"}

Jump to

Keyboard shortcuts

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