Documentation ¶
Overview ¶
Package mongoapi provides a auto-generated package which contains a mongo base pkg for db operations.
Index ¶
- Variables
- func AddIndex(db MongoDB, m metrics.Metrics, col string, indexes ...mgo.Index) error
- func Count(ctx context.Context, db MongoDB, m metrics.Metrics, col string) (int, error)
- func Exec(ctx context.Context, db MongoDB, m metrics.Metrics, col string, isread bool, ...) error
- type Config
- type MongoDB
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("record not found") ErrExpiredContext = errors.New("context has expired") )
errors ...
Functions ¶
func AddIndex ¶
AddIndex adds provided index if any to giving collection within database exposed by the provided MongoDB instance.
Types ¶
type Config ¶
type Config struct { DB string `toml:"db" json:"db"` AuthDB string `toml:"authdb" json:"authdb"` User string `toml:"user" json:"user"` Password string `toml:"password" json:"password"` Host string `toml:"host" json:"host"` }
Config embodies the data used to connect to user's mongo connection.
type MongoDB ¶
MongoDB defines a interface which exposes a method for retrieving a mongo.Database and mongo.Session.
func NewMongoDB ¶
NewMongoDB returns a new instance of a MongoDB.
Click to show internal directories.
Click to hide internal directories.