Documentation ¶
Index ¶
- func ObjectId() primitive.ObjectID
- func StringId() string
- type Aggregate
- func (a *Aggregate) AddFields(addFields bson.M) *Aggregate
- func (a *Aggregate) Bucket(bucket bson.M) *Aggregate
- func (a *Aggregate) BucketAuto(bucketAuto bson.M) *Aggregate
- func (a *Aggregate) CollStats(collStats bson.M) *Aggregate
- func (a *Aggregate) Count(count bson.M) *Aggregate
- func (a *Aggregate) Densify(densify bson.M) *Aggregate
- func (a *Aggregate) Facet(facet bson.M) *Aggregate
- func (a *Aggregate) Fill(fill bson.M) *Aggregate
- func (a *Aggregate) GeoNear(geoNear bson.M) *Aggregate
- func (a *Aggregate) GraphLookup(graphLookup bson.M) *Aggregate
- func (a *Aggregate) Group(group bson.M) *Aggregate
- func (a *Aggregate) IndexStats(indexStats bson.M) *Aggregate
- func (a *Aggregate) Limit(limit bson.M) *Aggregate
- func (a *Aggregate) List(data any) error
- func (a *Aggregate) Lookup(lookup bson.M) *Aggregate
- func (a *Aggregate) Match(match bson.M) *Aggregate
- func (a *Aggregate) Merge(merge bson.M) *Aggregate
- func (a *Aggregate) One(data any) error
- func (a *Aggregate) Out(out bson.M) *Aggregate
- func (a *Aggregate) Project(project bson.M) *Aggregate
- func (a *Aggregate) Redact(redact bson.M) *Aggregate
- func (a *Aggregate) ReplaceRoot(replaceRoot bson.M) *Aggregate
- func (a *Aggregate) ReplaceWith(replaceWith bson.M) *Aggregate
- func (a *Aggregate) Sample(sample bson.M) *Aggregate
- func (a *Aggregate) Scopes(scopes ...ScopeAggregate) *Aggregate
- func (a *Aggregate) Search(search bson.M) *Aggregate
- func (a *Aggregate) SearchMeta(searchMeta bson.M) *Aggregate
- func (a *Aggregate) Set(set bson.M) *Aggregate
- func (a *Aggregate) SetWindowFields(setWindowFields bson.M) *Aggregate
- func (a *Aggregate) Skip(skip bson.M) *Aggregate
- func (a *Aggregate) Sort(sort bson.M) *Aggregate
- func (a *Aggregate) SortByCount(sortByCount bson.M) *Aggregate
- func (a *Aggregate) UnionWith(unionWith bson.M) *Aggregate
- func (a *Aggregate) Unset(unset bson.M) *Aggregate
- func (a *Aggregate) Unwind(unwind bson.M) *Aggregate
- type Client
- type Database
- type Filter
- func (f *Filter) Count() (int64, error)
- func (f *Filter) DeleteMany() error
- func (f *Filter) DeleteOne() error
- func (f *Filter) Filter(key string, value any) *Filter
- func (f *Filter) Filters(filters bson.M) *Filter
- func (f *Filter) Limit(limit int64) *Filter
- func (f *Filter) List(data any) error
- func (f *Filter) One(data any) error
- func (f *Filter) Scopes(scopes ...ScopeFilter) *Filter
- func (f *Filter) Skip(skip int64) *Filter
- func (f *Filter) Sort(sort any) *Filter
- func (f *Filter) UpdateMany(update any) error
- func (f *Filter) UpdateOne(update any) error
- type Model
- type ObjectID
- type Options
- type ScopeAggregate
- type ScopeFilter
- type Table
- func (t *Table) Aggregate(ctx context.Context) *Aggregate
- func (t *Table) Drop(ctx context.Context) (err error)
- func (t *Table) Filter(ctx context.Context) *Filter
- func (t *Table) InsertMany(ctx context.Context, data []any) (ids []any, err error)
- func (t *Table) InsertOne(ctx context.Context, data any) (id any, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Aggregate ¶
type Aggregate struct {
// contains filtered or unexported fields
}
func (*Aggregate) Scopes ¶
func (a *Aggregate) Scopes(scopes ...ScopeAggregate) *Aggregate
func (*Aggregate) SetWindowFields ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Transaction ¶
func (c *Client) Transaction(fn func(sessionContext mongo.SessionContext) error) error
Transaction 提供了一个在 MongoDB 中执行事务的方法。 它接受一个函数作为参数,该函数接受一个 mongo.SessionContext 类型的参数并返回一个 error 类型的值。 如果函数返回一个非空的 error,事务将被回滚,否则事务将被提交。 如果在启动事务时出现错误,将返回该错误。 如果在提交或回滚事务时出现错误,将返回该错误。
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func NewDatabase ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
func (*Filter) DeleteMany ¶
func (*Filter) Scopes ¶
func (f *Filter) Scopes(scopes ...ScopeFilter) *Filter
func (*Filter) UpdateMany ¶
type ScopeAggregate ¶
type ScopeFilter ¶
type ScopeFilter func(f *Filter)
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func (*Table) InsertMany ¶
Click to show internal directories.
Click to hide internal directories.