database

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

func NewDatabaseConnection

func NewDatabaseConnection(mongoURI string) (*Database, error)

func (*Database) CustomAggregate

func (database *Database) CustomAggregate(databaseName string, collectionName string, filter []bson.M) (*mongo.Cursor, error)

func (*Database) DeleteMany

func (database *Database) DeleteMany(databaseName string, collectionName string, filter interface{}) (interface{}, error)

func (*Database) DeleteOne

func (database *Database) DeleteOne(databaseName string, collectionName string, filter interface{}) (interface{}, error)

func (*Database) Distinct

func (database *Database) Distinct(databaseName string, collectionName string, fieldName string, filter interface{}) ([]interface{}, error)

func (*Database) DocumentsCount

func (database *Database) DocumentsCount(databaseName string, collectionName string, filter interface{}) (int64, error)

func (*Database) Find

func (database *Database) Find(databaseName string, collectionName string, filter interface{}, fields interface{}) (*mongo.Cursor, error)

func (*Database) FindFirst

func (database *Database) FindFirst(databaseName string, collectionName string, filter interface{}) (*mongo.Cursor, error)

func (*Database) FindLast

func (database *Database) FindLast(databaseName string, collectionName string, filter interface{}) (*mongo.Cursor, error)

func (*Database) FindOne

func (database *Database) FindOne(databaseName string, collectionName string, filter interface{}, fields interface{}) (*mongo.SingleResult, error)

func (*Database) FindPaginated

func (database *Database) FindPaginated(databaseName string, collectionName string, filter interface{}, fields interface{}, skip int64, sort interface{}, limit int64) (*mongo.Cursor, error)

func (*Database) FindSorted

func (database *Database) FindSorted(databaseName string, collectionName string, filter interface{}, fields interface{}, sortBy string, order int64) (*mongo.Cursor, error)

func (*Database) GetContext

func (database *Database) GetContext() context.Context

func (*Database) GetNextSequenceValue

func (database *Database) GetNextSequenceValue(databaseName string, collectionName string, sequenceName string) (*mongo.UpdateResult, error)

func (*Database) InsertMany

func (database *Database) InsertMany(databaseName string, collectionName string, data []interface{}) (*mongo.InsertManyResult, error)

func (*Database) InsertOne

func (database *Database) InsertOne(databaseName string, collectioName string, data interface{}) (*mongo.InsertOneResult, error)

func (*Database) IsConnected

func (database *Database) IsConnected() bool

func (*Database) UpdateMany

func (database *Database) UpdateMany(databaseName string, collectioName string, filter interface{}, data interface{}) (interface{}, error)

func (*Database) UpdateOne

func (database *Database) UpdateOne(databaseName string, collectioName string, filter interface{}, data interface{}) (*mongo.UpdateResult, error)

func (*Database) UpdateOneWithUpsert

func (database *Database) UpdateOneWithUpsert(databaseName string, collectionName string, filter interface{}, data interface{}, opts *options.UpdateOptions) (interface{}, error)

Jump to

Keyboard shortcuts

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