Documentation ¶
Index ¶
- Variables
- func Connect() error
- type DB
- func (db *DB) Insert(obj interface{}, collection string) error
- func (db *DB) Search(query bson.M, selectors []string, collection string, obj interface{}) error
- func (db *DB) SearchOne(query bson.M, selectors []string, collection string, obj interface{}) error
- func (db *DB) Update(query, updateQuery interface{}, collection string) error
- func (db *DB) UpdateAll(query, updateQuery interface{}, collection string) error
- func (db *DB) Upsert(query bson.M, obj interface{}, collection string) (*mgo.ChangeInfo, error)
- type Database
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RepositoryCollection = "repository" SecurityTestCollection = "securityTest" AnalysisCollection = "analysis" )
Collections names used in MongoDB.
Functions ¶
Types ¶
type DB ¶
DB is the struct that represents mongo session.
var Conn *DB
Conn is the MongoDB connection variable.
func (*DB) Search ¶
Search searchs all documents that match the query. If selectors are present, the return will be only the chosen fields.
type Database ¶
type Database interface { Insert(obj interface{}, collection string) error Search(query bson.M, selectors []string, collection string, obj interface{}) error Update(query bson.M, updateQuery interface{}, collection string) error UpdateAll(query, updateQuery bson.M, collection string) error Upsert(query bson.M, obj interface{}, collection string) (*mgo.ChangeInfo, error) SearchOne(query bson.M, selectors []string, collection string, obj interface{}) error }
Database is the interface's database.
Click to show internal directories.
Click to hide internal directories.