mgo

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 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 Mongo

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

Mongo holds the mongo session

func Init

func Init(connection string) (*Mongo, error)

Init initialises a new mongo instance

func (*Mongo) Aggregate

func (m *Mongo) Aggregate(ctx context.Context, project, col string, req *model.AggregateRequest) (interface{}, error)

Aggregate performs a mongo db pipeline aggregation

func (*Mongo) Batch

func (m *Mongo) Batch(ctx context.Context, project string, txRequest *model.BatchRequest) error

Batch performs the provided operations in a single Batch

func (*Mongo) Close

func (m *Mongo) Close() error

Close gracefully the Mongo client

func (*Mongo) Create

func (m *Mongo) Create(ctx context.Context, project, col string, req *model.CreateRequest) error

Create inserts a document (or multiple when op is "all") into the database

func (*Mongo) Delete

func (m *Mongo) Delete(ctx context.Context, project, col string, req *model.DeleteRequest) error

Delete removes the document(s) from the database which match the condition

func (*Mongo) GetDBType

func (m *Mongo) GetDBType() utils.DBType

GetDBType returns the dbType of the crud block

func (*Mongo) Read

func (m *Mongo) Read(ctx context.Context, project, col string, req *model.ReadRequest) (interface{}, error)

Read querys document(s) from the database

func (*Mongo) Update

func (m *Mongo) Update(ctx context.Context, project, col string, req *model.UpdateRequest) error

Update updates the document(s) which match the condition provided.

Jump to

Keyboard shortcuts

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