mongo

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: MIT Imports: 11 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 {
	Session *mgo.Session

	Database   string
	Collection string
	// contains filtered or unexported fields
}

Mongo represents a simplistic MongoDB configuration, with session and health client

func (*Mongo) Checker

func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker is called by the healthcheck library to check the health state of this mongoDB instance

func (*Mongo) Close

func (m *Mongo) Close(ctx context.Context) error

Close closes the mongo session and returns any error

func (*Mongo) GetRole added in v0.3.0

func (m *Mongo) GetRole(ctx context.Context, id string) (*models.Role, error)

GetRole retrieves a role document by its ID

func (*Mongo) GetRoles added in v0.4.0

func (m *Mongo) GetRoles(ctx context.Context, offset, limit int) (*models.Roles, error)

GetRoles retrieves all role documents from Mongo, according to the provided limit and offset. Offset and limit need to be positive or zero. Zero limit is equivalent to no limit and all items starting at the offset will be returned.

func (*Mongo) Init

func (m *Mongo) Init(mongoConf config.MongoConfiguration) (err error)

Init creates a new mgo.Session with a strong consistency and a write mode of "majority"

Jump to

Keyboard shortcuts

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