mongo

package
v0.0.0-...-b029338 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(dbname, collname string, spec bson.M) int

Bytes gets number records from MongoDB

func Count

func Count(dbname, collname string, spec bson.M) int

Count gets number records from MongoDB

func CreateIndexes

func CreateIndexes(dbname, collname string, keys []string)

CreateIndexes creates DAS cache indexes

func GetBytesFromDASRecord

func GetBytesFromDASRecord(data DASRecord) ([]byte, error)

GetBytesFromDASRecord converts DASRecord map into bytes

func GetInt64Value

func GetInt64Value(rec DASRecord, key string) (int64, error)

GetInt64Value function to get int value from DAS record for given key

func GetIntValue

func GetIntValue(rec DASRecord, key string) (int, error)

GetIntValue function to get int value from DAS record for given key

func GetSingleStringValue

func GetSingleStringValue(rec DASRecord, key string) (string, error)

GetSingleStringValue function to get string value from DAS record for given key

func GetStringValue

func GetStringValue(rec DASRecord, key string) (string, error)

GetStringValue function to get string value from DAS record for given key

func GetValue

func GetValue(rec DASRecord, key string) interface{}

GetValue function to get int value from DAS record for given key

func Insert

func Insert(dbname, collname string, records []DASRecord)

Insert records into MongoDB

func Remove

func Remove(dbname, collname string, spec bson.M)

Remove records from MongoDB

func Update

func Update(dbname, collname string, spec, newdata bson.M)

Update inplace for given spec

Types

type DASRecord

type DASRecord map[string]interface{}

DASRecord define DAS record

func Convert2DASRecord

func Convert2DASRecord(item interface{}) DASRecord

Convert2DASRecord converts given interface to DAS Record data type

func DASErrorRecord

func DASErrorRecord(msg, etype string, ecode int) DASRecord

DASErrorRecord provides DAS error record

func Get

func Get(dbname, collname string, spec bson.M, idx, limit int) []DASRecord

Get records from MongoDB

func GetFilteredSorted

func GetFilteredSorted(dbname, collname string, spec bson.M, fields, skeys []string, idx, limit int) []DASRecord

GetFilteredSorted get records from MongoDB filtered and sorted by given key

func GetSorted

func GetSorted(dbname, collname string, spec bson.M, skeys []string) []DASRecord

GetSorted records from MongoDB sorted by given key

func LoadJsonData

func LoadJsonData(data []byte) DASRecord

LoadJsonData stream from series of bytes

func (DASRecord) ToHtml

func (r DASRecord) ToHtml() string

ToHtml provides string representation of DAS record

func (DASRecord) ToString

func (r DASRecord) ToString() string

ToString provides string representation of DAS record

type MongoConnection

type MongoConnection struct {
	Session *mgo.Session
}

MongoConnection defines connection to MongoDB

func (*MongoConnection) Connect

func (m *MongoConnection) Connect() *mgo.Session

Connect provides connection to MongoDB

Jump to

Keyboard shortcuts

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