mgo

package
v0.0.0-...-4cd9d19 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountDocuments

func CountDocuments(sqltable core.SqlTable, filter interface{}, opts ...*options.CountOptions) (int64, error)

func DeleteMany

func DeleteMany(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)

func DeleteOne

func DeleteOne(sqltable core.SqlTable, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)

func Find

func Find(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)

func FindOne

func FindOne(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult

func FindOneAndDelete

func FindOneAndDelete(sqltable core.SqlTable, filter interface{}, opts ...*options.FindOneAndDeleteOptions) *mongo.SingleResult

func FindOneAndUpdate

func FindOneAndUpdate(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions) *mongo.SingleResult

func GetService

func GetService() core.IService

func InsertMany

func InsertMany(sqltable core.SqlTable, data []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)

func InsertOne

func InsertOne(sqltable core.SqlTable, data interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)

func OnInit

func OnInit(s core.IService, opt ...Option) (err error)

func UpdateMany

func UpdateMany(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)

func UpdateOne

func UpdateOne(sqltable core.SqlTable, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)

Types

type Mongodb

type Mongodb struct {
	Client   *mongo.Client
	Database *mongo.Database
	// contains filtered or unexported fields
}

func (*Mongodb) Collection

func (this *Mongodb) Collection(sqltable core.SqlTable) *mongo.Collection

type Option

type Option func(*Options)

func MaxPoolSize

func MaxPoolSize(v uint64) Option

func MongodbDatabase

func MongodbDatabase(v string) Option

func MongodbUrl

func MongodbUrl(v string) Option

func TimeOut

func TimeOut(v time.Duration) Option

type Options

type Options struct {
	MongodbUrl      string
	MongodbDatabase string
	MaxPoolSize     uint64
	TimeOut         time.Duration
}

Jump to

Keyboard shortcuts

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