db

package
v0.0.0-...-e28099a Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect() error

Connect attempts to connect to the database.

func Disconnect

func Disconnect()

Disconnect disconnects from the database.

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"
)

Jump to

Keyboard shortcuts

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