Documentation
¶
Index ¶
- Variables
- func GetUserData(mapParams map[string]interface{}) (types.UserData, error)
- func RegisterUser(userData types.UserData) 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 (
UserCollection = "users"
)
Collections names used in MongoDB.
Functions ¶
func GetUserData ¶
GetUserData queries MongoDB and returns user's data based on its username.
func RegisterUser ¶
RegisterUser regisiter into MongoDB a new user and returns an error.
Types ¶
type DB ¶
DB is the struct that represents mongo session.
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.