mongoredis

package
v0.0.0-...-037b08c Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MongoOpTimeout = 600 * time.Second

Functions

func NewMongoRedis

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

func NewMongoRedisFull

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

Types

type Mongo

type Mongo[T scache.Table[I], I scache.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, error)

func (*Mongo[T, I]) GetBy

func (s *Mongo[T, I]) GetBy(index scache.Index) (T, 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 scache.Index, orderBys scache.OrderBys) ([]T, error)

func (*Mongo[T, I]) ListByUniqueInts

func (s *Mongo[T, I]) ListByUniqueInts(field string, values []int64) ([]T, error)

func (*Mongo[T, I]) ListByUniqueStrs

func (s *Mongo[T, I]) ListByUniqueStrs(field string, values []string) ([]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 scache.Table[I], I string] struct {
	*scache.CacheBase[T, I]
	// contains filtered or unexported fields
}

func NewRedisMongo

func NewRedisMongo[T scache.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 scache.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 scache.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 scache.Index, initOrders scache.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