mongodb

package
v0.0.0-...-40138e8 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func Connect

func Connect(config *Config) (c *Client, err error)

func (*Client) Table

func (c *Client) Table(tableName interface{}) *CollectionHandel

实例化操作对象

type CollectionHandel

type CollectionHandel struct {
	*mongo.Collection
	// contains filtered or unexported fields
}

func (*CollectionHandel) CountDocuments

func (c *CollectionHandel) CountDocuments(filter interface{}, opts ...*options.CountOptions) (int64, error)

func (*CollectionHandel) DeleteMany

func (c *CollectionHandel) DeleteMany(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)

func (*CollectionHandel) DeleteOne

func (c *CollectionHandel) DeleteOne(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)

func (*CollectionHandel) Find

func (c *CollectionHandel) Find(filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)

func (*CollectionHandel) FindOne

func (c *CollectionHandel) FindOne(filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult

func (*CollectionHandel) InsertMany

func (c *CollectionHandel) InsertMany(documents []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)

func (*CollectionHandel) InsertOne

func (c *CollectionHandel) InsertOne(document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)

func (*CollectionHandel) UpdateMany

func (c *CollectionHandel) UpdateMany(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)

func (*CollectionHandel) UpdateOne

func (c *CollectionHandel) UpdateOne(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)

func (*CollectionHandel) Upsert

func (c *CollectionHandel) Upsert(data interface{}) (*mongo.UpdateResult, error)

func (*CollectionHandel) UpsertMany

func (c *CollectionHandel) UpsertMany(data []interface{}) (*mongo.BulkWriteResult, error)

type Config

type Config struct {
	TimeOut      time.Duration
	DatabaseName string
	DSN          string
}

Jump to

Keyboard shortcuts

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