mongo

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleBadgerRequest

func HandleBadgerRequest(request map[string]interface{}) (bson.M, error)

Types

type DbRepo

type DbRepo struct {
	*mongo.Client
	// contains filtered or unexported fields
}

func New

func New(table, database string) (*DbRepo, error)

func (*DbRepo) AddOrUpdate

func (c *DbRepo) AddOrUpdate(key interface{}, data interface{}) error

func (*DbRepo) AddOrUpdateMany

func (c *DbRepo) AddOrUpdateMany(list []MongoKeyValue, upsert bool) ([]byte, error)

func (*DbRepo) AddWithTTL

func (c *DbRepo) AddWithTTL(key, value interface{}, ttl time.Duration) error

func (*DbRepo) Close

func (c *DbRepo) Close() error

func (*DbRepo) Delete

func (c *DbRepo) Delete(key interface{}, dataType interface{}) error

func (*DbRepo) DeleteOne

func (c *DbRepo) DeleteOne(document interface{}) (int64, error)

func (*DbRepo) Find

func (c *DbRepo) Find(result interface{}, filter bson.M) error

func (*DbRepo) FindJson

func (c *DbRepo) FindJson(result interface{}, filter []byte) error

func (*DbRepo) FindWhereAnd2Eq

func (c *DbRepo) FindWhereAnd2Eq(result interface{}, filed1 string, value1 interface{}, filed2 string, value2 interface{}) error

func (*DbRepo) FindWhereAnd4Eq

func (c *DbRepo) FindWhereAnd4Eq(result interface{}, filed1 string, value1 interface{}, filed2 string, value2 interface{}, filed3 string, value3 interface{}, filed4 string, value4 interface{}) error

func (*DbRepo) FindWhereEq

func (c *DbRepo) FindWhereEq(result interface{}, filed string, value interface{}) error

func (*DbRepo) FindWhereGe

func (c *DbRepo) FindWhereGe(result interface{}, filed string, value interface{}) error

func (*DbRepo) FindWhereGt

func (c *DbRepo) FindWhereGt(result interface{}, filed string, value interface{}) error

func (*DbRepo) FindWhereLe

func (c *DbRepo) FindWhereLe(result interface{}, filed string, value interface{}) error

func (*DbRepo) FindWhereLt

func (c *DbRepo) FindWhereLt(result interface{}, filed string, value interface{}) error

func (*DbRepo) FindWhereNe

func (c *DbRepo) FindWhereNe(result interface{}, filed string, value interface{}) error

func (*DbRepo) Get

func (c *DbRepo) Get(key interface{}, result interface{}) error

type MongoKeyValue

type MongoKeyValue struct {
	Key   interface{}
	Value interface{}
}

type Timeout

type Timeout struct {
	IsTimeout bool          `json:"id" bson:"_id"`
	CreatedAt time.Time     `json:"created_at" bson:"created_at"`
	Ttl       time.Duration `json:"ttl" bson:"ttl"`
}

Jump to

Keyboard shortcuts

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