Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertOne ¶
func InsertOne(collection Collection, record interface{}) error
InsertOne inserts a single record into the database.
func QueryOne ¶
func QueryOne(collection Collection, query interface{}, v interface{}) error
QueryOne queries for a single record. The found record is marshalled into v.
func UpsertOne ¶
func UpsertOne(collection Collection, query interface{}, update interface{}) error
UpsertOne upserts a record. Upsert in MongoDB is creating a new record if it does not exist - determined by the query - by merging the query fields and the update fields; otherwise performing an update.
Types ¶
type Collection ¶
type Collection string
Collection is the type for database collection name constants.
const ( CollectionModLogs Collection = "mod_logs" CollectionModSettings Collection = "mod_settings" )
Click to show internal directories.
Click to hide internal directories.