user

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatabaseName   = "db1"
	CollectionName = "user"
	FieldId        = "_id"
	FieldUserName  = "user_name"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array_Data

type Array_Data struct {
	Double           float64                `bson:"double"`
	String           string                 `bson:"string"`
	EmbeddedDocument *EmbeddedDocument_Data `bson:"embedded_document"`
	Array            []*Array_Data          `bson:"array"`
	Binary           primitive.Binary       `bson:"binary"`
	Boolean          bool                   `bson:"boolean"`
	DateTime         primitive.DateTime     `bson:"date_time"`
	Regex            primitive.Regex        `bson:"regex"`
	JavaScript       primitive.JavaScript   `bson:"java_script"`
	Int32            int32                  `bson:"int32"`
	Timestamp        primitive.Timestamp    `bson:"timestamp"`
	Int64            int64                  `bson:"int64"`
	Decimal128       primitive.Decimal128   `bson:"decimal128"`
}

type EmbeddedDocument_Data

type EmbeddedDocument_Data struct {
	Double           float64                `bson:"double"`
	String           string                 `bson:"string"`
	EmbeddedDocument *EmbeddedDocument_Data `bson:"embedded_document"`
	Array            []*Array_Data          `bson:"array"`
	Binary           primitive.Binary       `bson:"binary"`
	Boolean          bool                   `bson:"boolean"`
	DateTime         primitive.DateTime     `bson:"date_time"`
	Regex            primitive.Regex        `bson:"regex"`
	JavaScript       primitive.JavaScript   `bson:"java_script"`
	Int32            int32                  `bson:"int32"`
	Timestamp        primitive.Timestamp    `bson:"timestamp"`
	Int64            int64                  `bson:"int64"`
	Decimal128       primitive.Decimal128   `bson:"decimal128"`
}

type UserAggregate

type UserAggregate struct {
	// contains filtered or unexported fields
}

func NewUserAggregate

func NewUserAggregate(cc *mongo.Collection) *UserAggregate

func (*UserAggregate) Find

func (a *UserAggregate) Find(ctx context.Context, val []any) (err error)

Find get result as slice

func (*UserAggregate) FindOne

func (a *UserAggregate) FindOne(ctx context.Context, val interface{}) (err error)

FindOne get one data

func (*UserAggregate) Save

func (a *UserAggregate) Save(ctx context.Context) error

Save only save result,such as: $out,$merge

func (*UserAggregate) SetAllowDiskUse

func (a *UserAggregate) SetAllowDiskUse(b bool) *UserAggregate

SetAllowDiskUse sets the value for the AllowDiskUse field.

func (*UserAggregate) SetBatchSize

func (a *UserAggregate) SetBatchSize(i int32) *UserAggregate

SetBatchSize sets the value for the BatchSize field.

func (*UserAggregate) SetBypassDocumentValidation

func (a *UserAggregate) SetBypassDocumentValidation(b bool) *UserAggregate

SetBypassDocumentValidation sets the value for the BypassDocumentValidation field.

func (*UserAggregate) SetCollation

func (a *UserAggregate) SetCollation(c *options.Collation) *UserAggregate

SetCollation sets the value for the Collation field.

func (*UserAggregate) SetComment

func (a *UserAggregate) SetComment(s string) *UserAggregate

SetComment sets the value for the Comment field.

func (*UserAggregate) SetCustom

func (a *UserAggregate) SetCustom(c bson.M) *UserAggregate

SetCustom sets the value for the Custom field. Key-value pairs of the BSON map should correlate with desired option names and values. Values must be Marshalable. Custom options may conflict with non-custom options, and custom options bypass client-side validation. Prefer using non-custom options where possible.

func (*UserAggregate) SetHint

func (a *UserAggregate) SetHint(h interface{}) *UserAggregate

SetHint sets the value for the Hint field.

func (*UserAggregate) SetLet

func (a *UserAggregate) SetLet(let interface{}) *UserAggregate

SetLet sets the value for the Let field.

func (*UserAggregate) SetMaxAwaitTime

func (a *UserAggregate) SetMaxAwaitTime(d time.Duration) *UserAggregate

SetMaxAwaitTime sets the value for the MaxAwaitTime field.

func (*UserAggregate) SetMaxTime

func (a *UserAggregate) SetMaxTime(d time.Duration) *UserAggregate

SetMaxTime sets the value for the MaxTime field.

NOTE(benjirewis): MaxTime will be deprecated in a future release. The more general Timeout option may be used in its place to control the amount of time that a single operation can run before returning an error. MaxTime is ignored if Timeout is set on the client.

func (*UserAggregate) SetPipe

func (a *UserAggregate) SetPipe(pipe aggregates.Pipe) *UserAggregate

SetPipe set aggregate pipe

type UserClient

type UserClient struct {
	// contains filtered or unexported fields
}

func NewUserClient

func NewUserClient(db *mongo.Client) *UserClient

func (*UserClient) Aggregate

func (c *UserClient) Aggregate() *UserAggregate

func (*UserClient) BulkWrite

func (*UserClient) Clone

func (c *UserClient) Clone(opts ...*options.CollectionOptions) (*mongo.Collection, error)

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

func (*UserClient) DBName

func (c *UserClient) DBName(database string) *UserClient

func (*UserClient) Database

func (c *UserClient) Database() *mongo.Database

func (*UserClient) DeleteMany

func (c *UserClient) DeleteMany() *UserDeleteMany

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne() *UserDeleteOne

func (*UserClient) Drop

func (c *UserClient) Drop(ctx context.Context) error

func (*UserClient) Indexes

func (c *UserClient) Indexes() mongo.IndexView

func (*UserClient) Name

func (c *UserClient) Name() string

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

func (*UserClient) ReplaceOne

func (c *UserClient) ReplaceOne() *UserReplaceOne

func (*UserClient) UpdateMany

func (c *UserClient) UpdateMany() *UserUpdateMany

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne() *UserUpdateOne

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id primitive.ObjectID) *UserUpdateOneID

func (*UserClient) Watch

type UserCreate

type UserCreate struct {
	// contains filtered or unexported fields
}

func NewUserCreate

func NewUserCreate(cc *mongo.Collection) *UserCreate

func (*UserCreate) InsertMany

func (q *UserCreate) InsertMany(ctx context.Context, docs []UserData, opts ...*options.InsertManyOptions) ([]UserData, error)

func (*UserCreate) InsertOne

func (q *UserCreate) InsertOne(ctx context.Context, doc UserData, opts ...*options.InsertOneOptions) (*UserData, error)

type UserData

type UserData struct {
	ID               primitive.ObjectID     `bson:"_id"`
	Double           float64                `bson:"double"`
	String           string                 `bson:"string"`
	EmbeddedDocument *EmbeddedDocument_Data `bson:"embedded_document"`
	Array            []*Array_Data          `bson:"array"`
	Binary           primitive.Binary       `bson:"binary"`
	Boolean          bool                   `bson:"boolean"`
	DateTime         primitive.DateTime     `bson:"date_time"`
	Regex            primitive.Regex        `bson:"regex"`
	JavaScript       primitive.JavaScript   `bson:"java_script"`
	Int32            int32                  `bson:"int32"`
	Timestamp        primitive.Timestamp    `bson:"timestamp"`
	Int64            int64                  `bson:"int64"`
	Decimal128       primitive.Decimal128   `bson:"decimal128"`
}

UserData .

func (UserData) Document

func (d UserData) Document() any

func (UserData) Update

func (d UserData) Update()

type UserDeleteMany

type UserDeleteMany struct {
	// contains filtered or unexported fields
}

func NewUserDeleteMany

func NewUserDeleteMany(cc *mongo.Collection) *UserDeleteMany

func (*UserDeleteMany) Save

func (*UserDeleteMany) SetCollation

func (u *UserDeleteMany) SetCollation(c *options.Collation) *UserDeleteMany

SetCollation sets the value for the Collation field.

func (*UserDeleteMany) SetComment

func (u *UserDeleteMany) SetComment(comment interface{}) *UserDeleteMany

SetComment sets the value for the Comment field.

func (*UserDeleteMany) SetFilter

func (u *UserDeleteMany) SetFilter(f filters.Filter) *UserDeleteMany

SetFilter set filter

func (*UserDeleteMany) SetHint

func (u *UserDeleteMany) SetHint(h interface{}) *UserDeleteMany

SetHint sets the value for the Hint field.

func (*UserDeleteMany) SetLet

func (u *UserDeleteMany) SetLet(l interface{}) *UserDeleteMany

SetLet sets the value for the Let field.

type UserDeleteOne

type UserDeleteOne struct {
	// contains filtered or unexported fields
}

func NewUserDeleteOne

func NewUserDeleteOne(cc *mongo.Collection) *UserDeleteOne

func (*UserDeleteOne) Save

func (*UserDeleteOne) SetCollation

func (u *UserDeleteOne) SetCollation(c *options.Collation) *UserDeleteOne

SetCollation sets the value for the Collation field.

func (*UserDeleteOne) SetComment

func (u *UserDeleteOne) SetComment(comment interface{}) *UserDeleteOne

SetComment sets the value for the Comment field.

func (*UserDeleteOne) SetFilter

func (u *UserDeleteOne) SetFilter(f filters.Filter) *UserDeleteOne

SetFilter set filter

func (*UserDeleteOne) SetHint

func (u *UserDeleteOne) SetHint(h interface{}) *UserDeleteOne

SetHint sets the value for the Hint field.

func (*UserDeleteOne) SetLet

func (u *UserDeleteOne) SetLet(l interface{}) *UserDeleteOne

SetLet sets the value for the Let field.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

func NewUserQuery

func NewUserQuery(cc *mongo.Collection) *UserQuery

func (*UserQuery) CountDocuments

func (q *UserQuery) CountDocuments(ctx context.Context, opts ...*options.CountOptions) (int64, error)

func (*UserQuery) Distinct

func (q *UserQuery) Distinct(ctx context.Context, opts ...*options.DistinctOptions) ([]interface{}, error)

func (*UserQuery) EstimatedDocumentCount

func (q *UserQuery) EstimatedDocumentCount(ctx context.Context, opts ...*options.EstimatedDocumentCountOptions) (int64, error)

func (*UserQuery) Find

func (q *UserQuery) Find(ctx context.Context, opts ...*options.FindOptions) (result []*UserData, err error)

func (*UserQuery) FindOne

func (q *UserQuery) FindOne(ctx context.Context, opts ...*options.FindOneOptions) (result *UserData, err error)

func (*UserQuery) FindOneAndDelete

func (q *UserQuery) FindOneAndDelete(ctx context.Context, opts ...*options.FindOneAndDeleteOptions) (result *UserData, err error)

func (*UserQuery) FindOneAndReplace

func (q *UserQuery) FindOneAndReplace(ctx context.Context, opts ...*options.FindOneAndReplaceOptions) (result *UserData, err error)

func (*UserQuery) FindOneAndUpdate

func (q *UserQuery) FindOneAndUpdate(ctx context.Context, opts ...*options.FindOneAndUpdateOptions) (result *UserData, err error)

func (*UserQuery) SetFieldName

func (q *UserQuery) SetFieldName(replace *UserData) *UserQuery

SetFieldName set distinct fieldName, use when Distinct

func (*UserQuery) SetFilter

func (q *UserQuery) SetFilter(f filters.Filter) *UserQuery

SetFilter set filter

func (*UserQuery) SetReplace

func (q *UserQuery) SetReplace(replace *UserData) *UserQuery

SetReplace set replace doc, use when FindOneAndReplace

func (*UserQuery) SetUpdate

func (q *UserQuery) SetUpdate(up updates.Update) *UserQuery

SetUpdate set update doc, use when FindOneAndUpdate

type UserReplaceOne

type UserReplaceOne struct {
	// contains filtered or unexported fields
}

func NewUserReplaceOne

func NewUserReplaceOne(cc *mongo.Collection) *UserReplaceOne

func (*UserReplaceOne) Save

func (*UserReplaceOne) SetBypassDocumentValidation

func (u *UserReplaceOne) SetBypassDocumentValidation(b bool) *UserReplaceOne

SetBypassDocumentValidation sets the value for the BypassDocumentValidation field.

func (*UserReplaceOne) SetCollation

func (u *UserReplaceOne) SetCollation(c *options.Collation) *UserReplaceOne

SetCollation sets the value for the Collation field.

func (*UserReplaceOne) SetComment

func (u *UserReplaceOne) SetComment(comment interface{}) *UserReplaceOne

SetComment sets the value for the Comment field.

func (*UserReplaceOne) SetFilter

func (u *UserReplaceOne) SetFilter(f filters.Filter) *UserReplaceOne

SetFilter set filter

func (*UserReplaceOne) SetHint

func (u *UserReplaceOne) SetHint(h interface{}) *UserReplaceOne

SetHint sets the value for the Hint field.

func (*UserReplaceOne) SetLet

func (u *UserReplaceOne) SetLet(l interface{}) *UserReplaceOne

SetLet sets the value for the Let field.

func (*UserReplaceOne) SetReplace

func (u *UserReplaceOne) SetReplace(replace *UserData) *UserReplaceOne

SetReplace set replace doc

func (*UserReplaceOne) SetUpsert

func (u *UserReplaceOne) SetUpsert(b bool) *UserReplaceOne

SetUpsert sets the value for the Upsert field.

type UserUpdateMany

type UserUpdateMany struct {
	// contains filtered or unexported fields
}

func NewUserUpdateMany

func NewUserUpdateMany(cc *mongo.Collection) *UserUpdateMany

func (*UserUpdateMany) Save

func (*UserUpdateMany) SetArrayFilters

func (u *UserUpdateMany) SetArrayFilters(af options.ArrayFilters) *UserUpdateMany

SetArrayFilters sets the value for the ArrayFilters field.

func (*UserUpdateMany) SetBypassDocumentValidation

func (u *UserUpdateMany) SetBypassDocumentValidation(b bool) *UserUpdateMany

SetBypassDocumentValidation sets the value for the BypassDocumentValidation field.

func (*UserUpdateMany) SetCollation

func (u *UserUpdateMany) SetCollation(c *options.Collation) *UserUpdateMany

SetCollation sets the value for the Collation field.

func (*UserUpdateMany) SetComment

func (u *UserUpdateMany) SetComment(comment interface{}) *UserUpdateMany

SetComment sets the value for the Comment field.

func (*UserUpdateMany) SetFilter

func (u *UserUpdateMany) SetFilter(f filters.Filter) *UserUpdateMany

SetFilter set filter

func (*UserUpdateMany) SetHint

func (u *UserUpdateMany) SetHint(h interface{}) *UserUpdateMany

SetHint sets the value for the Hint field.

func (*UserUpdateMany) SetLet

func (u *UserUpdateMany) SetLet(l interface{}) *UserUpdateMany

SetLet sets the value for the Let field.

func (*UserUpdateMany) SetUpdate

func (u *UserUpdateMany) SetUpdate(up updates.Update) *UserUpdateMany

SetUpdate set update doc

func (*UserUpdateMany) SetUpsert

func (u *UserUpdateMany) SetUpsert(b bool) *UserUpdateMany

SetUpsert sets the value for the Upsert field.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

func NewUserUpdateOne

func NewUserUpdateOne(cc *mongo.Collection) *UserUpdateOne

func (*UserUpdateOne) Save

func (*UserUpdateOne) SetArrayFilters

func (u *UserUpdateOne) SetArrayFilters(af options.ArrayFilters) *UserUpdateOne

SetArrayFilters sets the value for the ArrayFilters field.

func (*UserUpdateOne) SetBypassDocumentValidation

func (u *UserUpdateOne) SetBypassDocumentValidation(b bool) *UserUpdateOne

SetBypassDocumentValidation sets the value for the BypassDocumentValidation field.

func (*UserUpdateOne) SetCollation

func (u *UserUpdateOne) SetCollation(c *options.Collation) *UserUpdateOne

SetCollation sets the value for the Collation field.

func (*UserUpdateOne) SetComment

func (u *UserUpdateOne) SetComment(comment interface{}) *UserUpdateOne

SetComment sets the value for the Comment field.

func (*UserUpdateOne) SetFilter

func (u *UserUpdateOne) SetFilter(f filters.Filter) *UserUpdateOne

SetFilter set filter

func (*UserUpdateOne) SetHint

func (u *UserUpdateOne) SetHint(h interface{}) *UserUpdateOne

SetHint sets the value for the Hint field.

func (*UserUpdateOne) SetLet

func (u *UserUpdateOne) SetLet(l interface{}) *UserUpdateOne

SetLet sets the value for the Let field.

func (*UserUpdateOne) SetUpdate

func (u *UserUpdateOne) SetUpdate(up updates.Update) *UserUpdateOne

SetUpdate set update doc

func (*UserUpdateOne) SetUpsert

func (u *UserUpdateOne) SetUpsert(b bool) *UserUpdateOne

SetUpsert sets the value for the Upsert field.

type UserUpdateOneID

type UserUpdateOneID struct {
	// contains filtered or unexported fields
}

func NewUserUpdateOneID

func NewUserUpdateOneID(id primitive.ObjectID, cc *mongo.Collection) *UserUpdateOneID

func (*UserUpdateOneID) Save

func (*UserUpdateOneID) SetArrayFilters

func (u *UserUpdateOneID) SetArrayFilters(af options.ArrayFilters) *UserUpdateOneID

SetArrayFilters sets the value for the ArrayFilters field.

func (*UserUpdateOneID) SetBypassDocumentValidation

func (u *UserUpdateOneID) SetBypassDocumentValidation(b bool) *UserUpdateOneID

SetBypassDocumentValidation sets the value for the BypassDocumentValidation field.

func (*UserUpdateOneID) SetCollation

func (u *UserUpdateOneID) SetCollation(c *options.Collation) *UserUpdateOneID

SetCollation sets the value for the Collation field.

func (*UserUpdateOneID) SetComment

func (u *UserUpdateOneID) SetComment(comment interface{}) *UserUpdateOneID

SetComment sets the value for the Comment field.

func (*UserUpdateOneID) SetHint

func (u *UserUpdateOneID) SetHint(h interface{}) *UserUpdateOneID

SetHint sets the value for the Hint field.

func (*UserUpdateOneID) SetLet

func (u *UserUpdateOneID) SetLet(l interface{}) *UserUpdateOneID

SetLet sets the value for the Let field.

func (*UserUpdateOneID) SetUpdate

func (u *UserUpdateOneID) SetUpdate(up updates.Update) *UserUpdateOneID

SetUpdate set update doc

func (*UserUpdateOneID) SetUpsert

func (u *UserUpdateOneID) SetUpsert(b bool) *UserUpdateOneID

SetUpsert sets the value for the Upsert field.

Jump to

Keyboard shortcuts

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