Documentation ¶
Index ¶
- func GetID(id interface{}) primitive.ObjectID
- func GetIDs(objs []mgm.DefaultModel) []primitive.ObjectID
- func GetIdsFilter(ids []string) bson.D
- func GetTsFilter(tsFrom, tsTo int64) bson.D
- type Client
- type ClientsMap
- type CollManager
- func (c *CollManager) Agregates(docs interface{}) error
- func (c *CollManager) Count() (int64, error)
- func (c *CollManager) Drop() error
- func (c *CollManager) Filters(f Filters) *CollManager
- func (c *CollManager) Find(objs interface{}) error
- func (c *CollManager) FindOne(obj mgm.Model) error
- func (c *CollManager) Limit(l int64) *CollManager
- func (c *CollManager) Pipeline(p mongo.Pipeline) *CollManager
- func (c *CollManager) Sorts(s Sorts) *CollManager
- type Collection
- func (c *Collection) Agregates(pipeline mongo.Pipeline, docs interface{}) error
- func (c *Collection) AgregatesCount(pipeline mongo.Pipeline) ([]bson.M, error)
- func (c *Collection) AgregatesCountWithCtx(ctx context.Context, pipeline mongo.Pipeline) ([]bson.M, error)
- func (c *Collection) AgregatesWithCtx(ctx context.Context, pipeline mongo.Pipeline, docs interface{}) error
- func (c *Collection) Clone(name string) *Collection
- func (c *Collection) Count(filter interface{}, opts *options.CountOptions) (int64, error)
- func (c *Collection) Create(obj mgm.Model) bool
- func (c *Collection) CreateIndex(fields interface{}, unique bool)
- func (c *Collection) CreateIndexes(indexes Indexes)
- func (c *Collection) CreateMany(docs []mgm.Model) bool
- func (c *Collection) Drop() error
- func (c *Collection) Find(filters interface{}, opts *options.FindOptions, objs interface{}) error
- func (c *Collection) FindById(id interface{}, obj mgm.Model) error
- func (c *Collection) FindOne(filters interface{}, opts options.FindOneOptions, obj mgm.Model) error
- func (c *Collection) First(tsFrom, tsTo int64, obj mgm.Model) error
- func (c *Collection) FirstTs(tsFrom, tsTo int64) int64
- func (c *Collection) Last(tsFrom, tsTo int64, obj mgm.Model) error
- func (c *Collection) LastTs(tsFrom, tsTo int64) int64
- func (c *Collection) Update(obj mgm.Model) bool
- func (c *Collection) Upsert(obj mgm.Model, field string) bool
- type CollectionsMap
- type Colls
- type ConnectionParams
- type Database
- type DatabasesMap
- type Filters
- func (f *Filters) Append(key string, value interface{}) *Filters
- func (f *Filters) Float64(field string, value float64) *Filters
- func (f *Filters) Float64_gt(field string, value float64) *Filters
- func (f *Filters) Float64_gte(field string, value float64) *Filters
- func (f *Filters) Float64_gte_lte(field string, value_1, value_2 float64) *Filters
- func (f *Filters) Float64_in(field string, values ...float64) *Filters
- func (f *Filters) Float64_lt(field string, value float64) *Filters
- func (f *Filters) Float64_lte(field string, value float64) *Filters
- func (f *Filters) Float64_nin(field string, values ...float64) *Filters
- func (f *Filters) Int(field string, value int) *Filters
- func (f *Filters) Int64(field string, value int64) *Filters
- func (f *Filters) Int64_gt(field string, value int64) *Filters
- func (f *Filters) Int64_gte(field string, value int64) *Filters
- func (f *Filters) Int64_gte_lt(field string, value_1, value_2 int64) *Filters
- func (f *Filters) Int64_gte_lte(field string, value_1, value_2 int64) *Filters
- func (f *Filters) Int64_in(field string, values ...int64) *Filters
- func (f *Filters) Int64_lt(field string, value int64) *Filters
- func (f *Filters) Int64_lte(field string, value int64) *Filters
- func (f *Filters) Int64_nin(field string, values ...int64) *Filters
- func (f *Filters) Int_gt(field string, value int) *Filters
- func (f *Filters) Int_gte(field string, value int) *Filters
- func (f *Filters) Int_gte_lte(field string, value_1, value_2 int) *Filters
- func (f *Filters) Int_in(field string, values ...int) *Filters
- func (f *Filters) Int_lt(field string, value int) *Filters
- func (f *Filters) Int_lte(field string, value int) *Filters
- func (f *Filters) Int_nin(field string, values ...int) *Filters
- func (f *Filters) Log(msg string)
- func (f *Filters) NotStates(states ...string) *Filters
- func (f *Filters) ObjectId(field string, value primitive.ObjectID) *Filters
- func (f *Filters) ObjectId_in(field string, values []primitive.ObjectID) *Filters
- func (f *Filters) States(states ...string) *Filters
- func (f *Filters) String_in(field string, values ...string) *Filters
- func (f *Filters) String_like(field string, value string) *Filters
- func (f *Filters) String_nin(field string, values ...string) *Filters
- func (f *Filters) Ts(ts_from, ts_to int64) *Filters
- func (f *Filters) TsField(ts_from, ts_to int64, field string) *Filters
- func (f *Filters) TsIn(tss ...int64) *Filters
- type Index
- type Indexes
- type Manager
- type Sorts
- type TsModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientsMap ¶ added in v0.5.8
type CollManager ¶ added in v0.3.6
type CollManager struct { Collection // contains filtered or unexported fields }
func Coll ¶ added in v0.3.6
func Coll(env, connection, database, collection, interval string) CollManager
func (*CollManager) Agregates ¶ added in v0.3.6
func (c *CollManager) Agregates(docs interface{}) error
func (*CollManager) Count ¶ added in v0.3.6
func (c *CollManager) Count() (int64, error)
func (*CollManager) Drop ¶ added in v0.5.7
func (c *CollManager) Drop() error
func (*CollManager) Filters ¶ added in v0.3.6
func (c *CollManager) Filters(f Filters) *CollManager
func (*CollManager) Find ¶ added in v0.3.6
func (c *CollManager) Find(objs interface{}) error
func (*CollManager) FindOne ¶ added in v0.3.6
func (c *CollManager) FindOne(obj mgm.Model) error
func (*CollManager) Limit ¶ added in v0.3.6
func (c *CollManager) Limit(l int64) *CollManager
func (*CollManager) Pipeline ¶ added in v0.3.6
func (c *CollManager) Pipeline(p mongo.Pipeline) *CollManager
func (*CollManager) Sorts ¶ added in v0.3.6
func (c *CollManager) Sorts(s Sorts) *CollManager
type Collection ¶
type Collection struct { Connection *ConnectionParams Database *mongo.Database Collection *mgm.Collection }
func (*Collection) Agregates ¶
func (c *Collection) Agregates(pipeline mongo.Pipeline, docs interface{}) error
func (*Collection) AgregatesCount ¶
func (*Collection) AgregatesCountWithCtx ¶
func (*Collection) AgregatesWithCtx ¶
func (*Collection) Clone ¶
func (c *Collection) Clone(name string) *Collection
Clone, create Connection to a new collection in the same DB
func (*Collection) Count ¶
func (c *Collection) Count(filter interface{}, opts *options.CountOptions) (int64, error)
Count
func (*Collection) CreateIndex ¶
func (c *Collection) CreateIndex(fields interface{}, unique bool)
CreateIndex, create an index for a specific field in a collectionName
func (*Collection) CreateIndexes ¶ added in v0.3.1
func (c *Collection) CreateIndexes(indexes Indexes)
func (*Collection) Drop ¶ added in v0.5.7
func (c *Collection) Drop() error
func (*Collection) Find ¶
func (c *Collection) Find(filters interface{}, opts *options.FindOptions, objs interface{}) error
Find
func (*Collection) FindById ¶
func (c *Collection) FindById(id interface{}, obj mgm.Model) error
FindById
func (*Collection) FindOne ¶
func (c *Collection) FindOne(filters interface{}, opts options.FindOneOptions, obj mgm.Model) error
FindOne
func (*Collection) First ¶
func (c *Collection) First(tsFrom, tsTo int64, obj mgm.Model) error
First, $gte: tsFrom $lt: tsTo, tsFrom = tsTo = 0 for "ts" first object,
func (*Collection) FirstTs ¶
func (c *Collection) FirstTs(tsFrom, tsTo int64) int64
Last, $gte: tsFrom $lt: tsTo, tsFrom = tsTo = 0 for first
func (*Collection) Last ¶
func (c *Collection) Last(tsFrom, tsTo int64, obj mgm.Model) error
Last, $gte: tsFrom $lt: tsTo, tsFrom = tsTo = 0 for "ts" Last object,
func (*Collection) LastTs ¶
func (c *Collection) LastTs(tsFrom, tsTo int64) int64
Last, $gte: tsFrom $lt: tsTo, tsFrom = tsTo = 0 for last
func (*Collection) Upsert ¶ added in v0.4.1
func (c *Collection) Upsert(obj mgm.Model, field string) bool
Upsert
type CollectionsMap ¶ added in v0.5.8
type CollectionsMap map[string]*CollManager
type Colls ¶ added in v0.5.4
type Colls map[string]CollManager
type ConnectionParams ¶
type ConnectionParams struct { Environment string `yaml: "environment"` Username string `yaml: "username"` Password string `yaml: "password"` Host string `yaml: "host"` Port string `yaml: "port"` AuthDatabase string `yaml: "authdatabase"` Tls bool `yaml: "tls"` Protocol string `yaml: "protocol"` AuthMechanism string `yaml: "authmechanism"` ReadPreference string `yaml: "readpreference"` DirectConnection bool `yaml: "directconnection"` }
ConnectionParams, Databases access data
type DatabasesMap ¶ added in v0.5.8
type Filters ¶ added in v0.3.5
func (*Filters) Float64_gt ¶ added in v0.3.5
func (*Filters) Float64_gte ¶ added in v0.3.5
func (*Filters) Float64_gte_lte ¶ added in v0.4.1
func (*Filters) Float64_in ¶ added in v0.3.5
func (*Filters) Float64_lt ¶ added in v0.3.5
func (*Filters) Float64_lte ¶ added in v0.3.5
func (*Filters) Float64_nin ¶ added in v0.3.5
func (*Filters) Int64_gte_lt ¶ added in v0.4.1
func (*Filters) Int64_gte_lte ¶ added in v0.4.1
func (*Filters) Int_gte_lte ¶ added in v0.4.1
func (*Filters) ObjectId_in ¶ added in v0.3.5
func (*Filters) String_like ¶ added in v0.5.2
string
func (*Filters) String_nin ¶ added in v0.4.6
type Manager ¶ added in v0.5.8
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶ added in v0.5.8
func NewManager() Manager
type Sorts ¶ added in v0.3.5
Click to show internal directories.
Click to hide internal directories.