Documentation ¶
Index ¶
- Constants
- func Collection(db *mongo.Database) *mongo.Collection
- type DeleteBuilder
- type FinderBuilder
- func (f *FinderBuilder) All(ctx context.Context) ([]*User, error)
- func (f *FinderBuilder) Filter(filter ...primitive.E) *FinderBuilder
- func (f *FinderBuilder) Limit(l int64) *FinderBuilder
- func (f *FinderBuilder) One(ctx context.Context) (*User, error)
- func (f *FinderBuilder) Skip(s int64) *FinderBuilder
- func (f *FinderBuilder) Sort(field string, desc bool) *FinderBuilder
- type InsertBuilder
- type UpdateBuilder
- func (u *UpdateBuilder) ByID(ctx context.Context, a primitive.ObjectID) (int64, error)
- func (u *UpdateBuilder) SetAge(a int) *UpdateBuilder
- func (u *UpdateBuilder) SetID(a primitive.ObjectID) *UpdateBuilder
- func (u *UpdateBuilder) SetMtime(a time.Time) *UpdateBuilder
- func (u *UpdateBuilder) SetName(a string) *UpdateBuilder
- func (u *UpdateBuilder) SetSex(a bool) *UpdateBuilder
- type User
Constants ¶
View Source
const ( ID = "_id" Name = "name" Age = "age" Sex = "sex" Mtime = "mtime" )
Variables ¶
This section is empty.
Functions ¶
func Collection ¶
func Collection(db *mongo.Database) *mongo.Collection
Types ¶
type DeleteBuilder ¶
type DeleteBuilder struct {
// contains filtered or unexported fields
}
func Delete ¶
func Delete(col *mongo.Collection) *DeleteBuilder
type FinderBuilder ¶
type FinderBuilder struct {
// contains filtered or unexported fields
}
func Find ¶
func Find(col *mongo.Collection) *FinderBuilder
func (*FinderBuilder) Filter ¶
func (f *FinderBuilder) Filter(filter ...primitive.E) *FinderBuilder
func (*FinderBuilder) Limit ¶
func (f *FinderBuilder) Limit(l int64) *FinderBuilder
func (*FinderBuilder) Skip ¶
func (f *FinderBuilder) Skip(s int64) *FinderBuilder
func (*FinderBuilder) Sort ¶
func (f *FinderBuilder) Sort(field string, desc bool) *FinderBuilder
type InsertBuilder ¶
type InsertBuilder struct {
// contains filtered or unexported fields
}
func Create ¶
func Create(col *mongo.Collection) *InsertBuilder
func (*InsertBuilder) SetUsers ¶
func (i *InsertBuilder) SetUsers(u ...*User) *InsertBuilder
type UpdateBuilder ¶
type UpdateBuilder struct {
// contains filtered or unexported fields
}
func Update ¶
func Update(col *mongo.Collection) *UpdateBuilder
func (*UpdateBuilder) SetAge ¶
func (u *UpdateBuilder) SetAge(a int) *UpdateBuilder
func (*UpdateBuilder) SetID ¶
func (u *UpdateBuilder) SetID(a primitive.ObjectID) *UpdateBuilder
func (*UpdateBuilder) SetMtime ¶
func (u *UpdateBuilder) SetMtime(a time.Time) *UpdateBuilder
func (*UpdateBuilder) SetName ¶
func (u *UpdateBuilder) SetName(a string) *UpdateBuilder
func (*UpdateBuilder) SetSex ¶
func (u *UpdateBuilder) SetSex(a bool) *UpdateBuilder
Click to show internal directories.
Click to hide internal directories.