Documentation ¶
Index ¶
- Constants
- type AggQuery
- func (a *AggQuery) AddToSet(field string, alias ...interface{}) mongodb.IAggQuery
- func (a *AggQuery) Avg(field string, alias ...interface{}) mongodb.IAggQuery
- func (a *AggQuery) Find(ctx context.Context, records interface{}) error
- func (a *AggQuery) FindOne(ctx context.Context, record interface{}) error
- func (a *AggQuery) First(field interface{}, alias ...interface{}) mongodb.IAggQuery
- func (a *AggQuery) GroupBy(field interface{}, alias ...interface{}) mongodb.IAggQuery
- func (a *AggQuery) Having(condition interface{}) mongodb.IAggQuery
- func (a *AggQuery) Last(field interface{}, alias ...interface{}) mongodb.IAggQuery
- func (a *AggQuery) Num(field string) mongodb.IAggQuery
- func (a *AggQuery) Push(field interface{}, alias ...interface{}) mongodb.IAggQuery
- func (a *AggQuery) StdDevPop(field string, alias ...interface{}) mongodb.IAggQuery
- func (a *AggQuery) StdDevSamp(field string, alias ...interface{}) mongodb.IAggQuery
- func (a *AggQuery) Sum(field string, alias ...interface{}) mongodb.IAggQuery
- type Mongodb
- type MongodbArgs
- type MongodbParam
- func (p *MongodbParam) AddSort(field string, direct int64)
- func (a *MongodbParam) GetOp() string
- func (p *MongodbParam) SetAggregate(agg bool)
- func (a *MongodbParam) SetDocs(docs interface{})
- func (p *MongodbParam) SetKey(key string)
- func (p *MongodbParam) SetLimit(limit int64)
- func (p *MongodbParam) SetOffset(offset int64)
- func (p *MongodbParam) SetOne(one bool)
- func (p *MongodbParam) SetOp(op OpType)
- func (p *MongodbParam) SetProjection(projection interface{})
- func (p *MongodbParam) SetQuery(condition interface{})
- func (p *MongodbParam) SetTableName(tableName string)
- func (p *MongodbParam) SetUpdate(field2value interface{})
- func (p *MongodbParam) SetUpsert(upsert bool)
- type OpType
- type Query
- func (q *Query) BatchDelete(ctx context.Context) error
- func (q *Query) BatchUpdate(ctx context.Context, record interface{}) error
- func (q *Query) Count(ctx context.Context) (int64, error)
- func (q *Query) Delete(ctx context.Context) error
- func (q *Query) Find(ctx context.Context, records interface{}) error
- func (q *Query) FindOne(ctx context.Context, record interface{}) error
- func (q *Query) Limit(limit int64) mongodb.IQuery
- func (q *Query) Offset(offset int64) mongodb.IQuery
- func (q *Query) OrderBy(fields ...string) mongodb.IQuery
- func (q *Query) OrderByDesc(fields ...string) mongodb.IQuery
- func (q *Query) Project(projection interface{}) mongodb.IQuery
- func (q *Query) Update(ctx context.Context, record interface{}) error
- func (q *Query) Upsert(ctx context.Context, record interface{}) error
- func (q *Query) Where(condition interface{}, args ...interface{}) mongodb.IQuery
- type Table
- func (t *Table) BatchCreate(ctx context.Context, records interface{}) ([]primitive.ObjectID, error)
- func (t *Table) Create(ctx context.Context, record interface{}) (*structs.RecordOnlyId, error)
- func (q *Table) GroupBy(field interface{}, alias ...interface{}) mongodb.IAggQuery
- func (t *Table) Where(condition interface{}, args ...interface{}) mongodb.IQuery
Constants ¶
View Source
const ( Asc = 1 Desc = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggQuery ¶
type AggQuery struct { *MongodbParam // contains filtered or unexported fields }
func NewAggQuery ¶
func (*AggQuery) StdDevSamp ¶
type MongodbArgs ¶
type MongodbArgs struct { Op string `bson:"op" json:"op"` Docs interface{} `bson:"docs,omitempty" json:"docs,omitempty"` Query interface{} `bson:"query,omitempty" json:"query,omitempty"` Collection string `bson:"collection,omitempty" json:"collection,omitempty"` Sort map[string]int64 `bson:"sort,omitempty" json:"sort,omitempty"` Projection interface{} `bson:"projection,omitempty" json:"projection,omitempty"` Hint interface{} `bson:"hint,omitempty" json:"hint,omitempty"` Skip int64 `bson:"skip,omitempty" json:"skip,omitempty"` Limit int64 `bson:"limit,omitempty" json:"limit,omitempty"` ArrayFilters interface{} `bson:"arrayFilters,omitempty" json:"arrayFilters,omitempty"` Upsert *bool `bson:"upsert,omitempty" json:"upsert,omitempty"` Pipeline []map[string]interface{} `bson:"pipeline,omitempty" json:"pipeline,omitempty"` Update interface{} `bson:"update,omitempty" json:"update,omitempty"` One *bool `bson:"one,omitempty" json:"one,omitempty"` // Distinct Key string `bson:"key,omitempty" json:"key,omitempty"` // aggregate Aggregate bool `bson:"aggregate,omitempty" json:"aggregate,omitempty"` }
func NewMongodbArgs ¶
func NewMongodbArgs() *MongodbArgs
type MongodbParam ¶
type MongodbParam struct { TableName string `bson:"tableName" json:"tableName"` Args *MongodbArgs `bson:"args" json:"args"` Err error `bson:"-" json:"-"` }
func NewMongodbParam ¶
func NewMongodbParam(tableName string) *MongodbParam
func (*MongodbParam) AddSort ¶
func (p *MongodbParam) AddSort(field string, direct int64)
func (*MongodbParam) GetOp ¶
func (a *MongodbParam) GetOp() string
func (*MongodbParam) SetAggregate ¶
func (p *MongodbParam) SetAggregate(agg bool)
func (*MongodbParam) SetDocs ¶
func (a *MongodbParam) SetDocs(docs interface{})
func (*MongodbParam) SetKey ¶
func (p *MongodbParam) SetKey(key string)
func (*MongodbParam) SetLimit ¶
func (p *MongodbParam) SetLimit(limit int64)
func (*MongodbParam) SetOffset ¶
func (p *MongodbParam) SetOffset(offset int64)
func (*MongodbParam) SetOne ¶
func (p *MongodbParam) SetOne(one bool)
func (*MongodbParam) SetOp ¶
func (p *MongodbParam) SetOp(op OpType)
func (*MongodbParam) SetProjection ¶
func (p *MongodbParam) SetProjection(projection interface{})
func (*MongodbParam) SetQuery ¶
func (p *MongodbParam) SetQuery(condition interface{})
func (*MongodbParam) SetTableName ¶
func (p *MongodbParam) SetTableName(tableName string)
func (*MongodbParam) SetUpdate ¶
func (p *MongodbParam) SetUpdate(field2value interface{})
func (*MongodbParam) SetUpsert ¶
func (p *MongodbParam) SetUpsert(upsert bool)
type Query ¶
type Query struct { *MongodbParam // contains filtered or unexported fields }
func (*Query) BatchUpdate ¶
type Table ¶
type Table struct {
*MongodbParam
}
func (*Table) BatchCreate ¶
Click to show internal directories.
Click to hide internal directories.