mongo

package
v0.0.0-...-61e4c6b Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxConnection     = 10
	InitialConnection = 1
)

Variables

This section is empty.

Functions

func ErrorIsNoDocuments

func ErrorIsNoDocuments(err error) bool

func GetClient

func GetClient() (*mongoData, error)

func ReleaseClient

func ReleaseClient(c *mongoData)

Types

type ClientPool

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

type ConfigItem

type ConfigItem struct {
	Host     string `json:"host"`
	Port     string `json:"port"`
	User     string `json:"user"`
	Password string `json:"password"`
}

func GetMongoConfig

func GetMongoConfig() *ConfigItem

type Mongo

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

func (*Mongo) Aggregate

func (m *Mongo) Aggregate(ctx context.Context, db *mongoData, data interface{}) []bson.M

func (*Mongo) Count

func (m *Mongo) Count(ctx context.Context, db *mongoData, data interface{})

func (*Mongo) Find

func (m *Mongo) Find(ctx context.Context, db *mongoData, data interface{})

func (*Mongo) FindOne

func (m *Mongo) FindOne(ctx context.Context, db *mongoData, data interface{}, options ...*options.FindOneOptions)

func (*Mongo) Group

func (m *Mongo) Group(group ...string) *Mongo

func (*Mongo) InsertMany

func (m *Mongo) InsertMany(ctx context.Context, db *mongoData, data []interface{}) (*mongo.InsertManyResult, error)

func (*Mongo) InsertOne

func (m *Mongo) InsertOne(ctx context.Context, db *mongoData, data interface{}) (*mongo.InsertOneResult, error)

func (*Mongo) Limit

func (m *Mongo) Limit(limit int) *Mongo

func (*Mongo) Select

func (m *Mongo) Select(fields ...string) *Mongo

func (*Mongo) SetCollectionName

func (m *Mongo) SetCollectionName(name string) *Mongo

func (*Mongo) SetDatabase

func (m *Mongo) SetDatabase(name string) *Mongo

func (*Mongo) Skip

func (m *Mongo) Skip(skip int) *Mongo

func (*Mongo) Where

func (m *Mongo) Where(where bson.D) *Mongo

Jump to

Keyboard shortcuts

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