Documentation ¶
Index ¶
- Variables
- func RawCollection(collectionName string, opts ...CollectionOption) *mongo.Collection
- func RegisterConnection(configs *MongoClient)
- func SelectDB(dbName string) *mongo.Database
- type CollectionOption
- type Find
- func (f *Find) Between(key string, start, end any) *Find
- func (f *Find) Contain(field string, key string) *Find
- func (f *Find) CountDocuments(ctx context.Context, fieldValues ...any) (int64, error)
- func (f *Find) Find(ctx context.Context, page, size int64, fieldValues ...any) result
- func (f *Find) FindOne(ctx context.Context, fieldValues ...any) result
- func (f *Find) Gt(key string, value any) *Find
- func (f *Find) Gte(key string, value any) *Find
- func (f *Find) Id(id any) *Find
- func (f *Find) In(key string, values ...any) *Find
- func (f *Find) Lt(key string, value any) *Find
- func (f *Find) Lte(key string, value any) *Find
- func (f *Find) Ne(field string, value any) *Find
- func (f *Find) NotIn(key string, values ...any) *Find
- func (f *Find) Or(conditions ...bson.D) *Find
- func (f *Find) Ors(fieldValues ...any) *Find
- func (f *Find) Regex(field string, pattern string) *Find
- func (f *Find) WithCountOptions(opts ...*mongoOptions.CountOptions) *Find
- func (f *Find) WithField(fields ...string) *Find
- func (f *Find) WithOneOptions(opts ...*mongoOptions.FindOneOptions) *Find
- func (f *Find) WithOptions(opts ...*mongoOptions.FindOptions) *Find
- func (f *Find) WithReplaceOptions(opts ...*mongoOptions.FindOneAndReplaceOptions) *Find
- func (f *Find) WithSort(sortPairs ...interface{}) *Find
- func (f *Find) WithUpdateOptions(opts ...*mongoOptions.FindOneAndUpdateOptions) *Find
- type Insert
- type MongoClient
- type Update
- func (u *Update) ReplaceOne(ctx context.Context, data any) updateResultInterface
- func (u *Update) UpdateOne(ctx context.Context, fieldValues ...any) updateResultInterface
- func (u *Update) WithEqFilter(pairs ...any) *Update
- func (u *Update) WithReplaceOptions(opts ...*mongoOptions.ReplaceOptions) *Update
- func (u *Update) WithUpdateOptions(opts ...*mongoOptions.UpdateOptions) *Update
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrParamMustPairs = errors.New("fieldValues must be even")
Functions ¶
func RawCollection ¶
func RawCollection(collectionName string, opts ...CollectionOption) *mongo.Collection
func RegisterConnection ¶
func RegisterConnection(configs *MongoClient)
Types ¶
type CollectionOption ¶
type CollectionOption func(opt *options)
func WithCollectionOptions ¶
func WithCollectionOptions(mongoCollectionOptions []*mongoOption.CollectionOptions) CollectionOption
func WithDBName ¶
func WithDBName(dbName string) CollectionOption
type Find ¶
type Find struct {
// contains filtered or unexported fields
}
func Finder ¶
func Finder(collection string, opts ...CollectionOption) *Find
func (*Find) CountDocuments ¶
func (*Find) WithCountOptions ¶
func (f *Find) WithCountOptions(opts ...*mongoOptions.CountOptions) *Find
func (*Find) WithOneOptions ¶
func (f *Find) WithOneOptions(opts ...*mongoOptions.FindOneOptions) *Find
func (*Find) WithOptions ¶
func (f *Find) WithOptions(opts ...*mongoOptions.FindOptions) *Find
func (*Find) WithReplaceOptions ¶
func (f *Find) WithReplaceOptions(opts ...*mongoOptions.FindOneAndReplaceOptions) *Find
func (*Find) WithUpdateOptions ¶
func (f *Find) WithUpdateOptions(opts ...*mongoOptions.FindOneAndUpdateOptions) *Find
type Insert ¶
type Insert struct {
// contains filtered or unexported fields
}
func Inserter ¶
func Inserter(collection string, opts ...CollectionOption) *Insert
func (*Insert) WithInsertManyOptions ¶
func (i *Insert) WithInsertManyOptions(opts ...*mongoOptions.InsertManyOptions)
func (*Insert) WithInsertOneOptions ¶
func (i *Insert) WithInsertOneOptions(opts ...*mongoOptions.InsertOneOptions)
type MongoClient ¶
type Update ¶
type Update struct {
// contains filtered or unexported fields
}
func Updater ¶
func Updater(collection string, opts ...CollectionOption) *Update
func (*Update) ReplaceOne ¶
func (*Update) WithEqFilter ¶
func (*Update) WithReplaceOptions ¶
func (u *Update) WithReplaceOptions(opts ...*mongoOptions.ReplaceOptions) *Update
func (*Update) WithUpdateOptions ¶
func (u *Update) WithUpdateOptions(opts ...*mongoOptions.UpdateOptions) *Update
Click to show internal directories.
Click to hide internal directories.