mongo

package
v0.0.0-...-2e7332a Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port     int
	Host     string
	Database string
	Username string
	Password string
}

Config of Mongo

func GetMongo

func GetMongo(source interface{}, environment string) (mongo Config, err error)

GetMongo returns a Mongo configurations

type Controller

type Controller struct {
	Mongo Mongo
}

Controller allows a controller to access at Mongo

type Environment

type Environment struct {
	Env map[string]Config
}

Environment configurations

func (*Environment) GetEnvironment

func (m *Environment) GetEnvironment(environment string) interface{}

GetEnvironment returns a Mongo configuration for the specified environment in parameter

func (*Environment) UnmarshalYAML

func (m *Environment) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements Unmarshaler. Avoid use of env in the YAML file.

type Mongo

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

Mongo is a datasource.

func NewMongo

func NewMongo(filename string, environment string) (*Mongo, error)

NewMongo creates a newinstance of Mongo

func (*Mongo) Disconnect

func (m *Mongo) Disconnect() error

Disconnect a Mongo client

type Service

type Service struct {
	Mongo Mongo
}

Service is base for mongo services.

Jump to

Keyboard shortcuts

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