Documentation ¶
Index ¶
- Constants
- func Count(dbname, collname string, spec bson.M) int
- func GetInt64Value(rec Record, key string) (int64, error)
- func GetIntValue(rec Record, key string) (int, error)
- func GetSingleStringValue(rec Record, key string) (string, error)
- func GetStringValue(rec Record, key string) (string, error)
- func GetValue(rec Record, key string) interface{}
- func InitMongoDB(uri string)
- func Insert(dbname, collname string, records []Record)
- func MapKeys(rec Record) []string
- func Remove(dbname, collname string, spec bson.M)
- func Update(dbname, collname string, spec, newdata bson.M)
- func Upsert(dbname, collname, attr string, records []Record) error
- type Connection
- type Record
Constants ¶
View Source
const ( ServerError DBError QueryError ParserError ValidationError )
View Source
const ( ServerErrorName = "Server error" DBErrorName = "MongoDB error" QueryErrorName = "Server query error" ParserErrorName = "Server parser error" ValidationErrorName = "Server validation error" )
ServerErrorName and others provides human based definition of the error
Variables ¶
This section is empty.
Functions ¶
func GetInt64Value ¶
GetInt64Value function to get int value from record for given key
func GetIntValue ¶
GetIntValue function to get int value from record for given key
func GetSingleStringValue ¶
GetSingleStringValue function to get string value from record for given key
func GetStringValue ¶
GetStringValue function to get string value from record for given key
Types ¶
type Connection ¶
Connection defines connection to MongoDB
var Mongo Connection
Mongo holds MongoDB connection
func (*Connection) Connect ¶
func (m *Connection) Connect() *mongo.Client
Connect provides connection to MongoDB
type Record ¶
type Record map[string]interface{}
Record define Mongo record
func ErrorRecord ¶
ErrorRecord provides error record
Click to show internal directories.
Click to hide internal directories.