Documentation ¶
Index ¶
- Variables
- func Connect(uri string) (*mongo.Client, error)
- func Disconnect(client *mongo.Client) error
- func GetCollection(client *mongo.Client, database string, collection string) (*mongo.Collection, error)
- func GetCollectionNames(client *mongo.Client, databaseName string) ([]string, error)
- func GetIdentifiers(collection *mongo.Collection) ([]string, error)
- func InsertDataPointLine(collection *mongo.Collection, line []DataPoint) error
- func InsertSingleDataPoint(collection *mongo.Collection, dp DataPoint) error
- func InsertSingleLine(collection *mongo.Collection, l Line) error
- func InsertTable(collection *mongo.Collection, table [][]DataPoint)
- func IsConnected(client *mongo.Client) error
- func RemoveCollection(client *mongo.Client, database string, collection string) error
- type DataPoint
- type Line
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrClientIsNotInitialised = errors.New("client is not initialised") ErrDatabaseDoesntExist = errors.New("database doesnt exist") ErrCantConnect = errors.New("cant connect to db") ErrCantDisconnect = errors.New("cant terminate db connection") ErrCollectioniIsNil = errors.New("collection is nil") )
Functions ¶
func GetCollection ¶
func GetCollection(client *mongo.Client, database string, collection string) (*mongo.Collection, error)
GetCollection new database and collection unless exits
func GetCollectionNames ¶
GetCollectionNames returns collection names in given database
func GetIdentifiers ¶
func GetIdentifiers(collection *mongo.Collection) ([]string, error)
GetIdentifiers returns all line identifiers in the collection
func InsertDataPointLine ¶
func InsertDataPointLine(collection *mongo.Collection, line []DataPoint) error
InsertLine insert slice of data points
func InsertSingleDataPoint ¶
func InsertSingleDataPoint(collection *mongo.Collection, dp DataPoint) error
InsertSingleDataPoint
func InsertSingleLine ¶
func InsertSingleLine(collection *mongo.Collection, l Line) error
InsertSingleDataPoint
func InsertTable ¶
func InsertTable(collection *mongo.Collection, table [][]DataPoint)
InsertTable insert double dimensional slice of datapoints
func IsConnected ¶
IsConnected returns nil if can ping db
Types ¶
type DataPoint ¶
DataPoint a single entry of data with row/col headers
func GetSingleDataPoint ¶
GetSingleDataPoint search collection for single match with row/col parameters and decode into a datapoint
Click to show internal directories.
Click to hide internal directories.