Documentation ¶
Index ¶
- type DBConfig
- type DbHandler
- func (dbh *DbHandler) AddColumnToTable(tableName string, columnName string) error
- func (dbh *DbHandler) CloseDatabase() error
- func (dbh *DbHandler) CreateTimeseriesTable() error
- func (dbh *DbHandler) InsertIntoDatabase(tableName string, is ImportStruct) error
- func (dbh *DbHandler) InsertRowToTable(tableName string, is ImportRowStruct) error
- func (dbh *DbHandler) InsertRowsToTable(tableName string, importStructs []ImportRowStruct) ([]ImportRowStruct, error)
- func (dbh *DbHandler) InsertTimeseries(is TimeseriesImportStruct, onClonflictDoNothing bool) error
- func (dbh *DbHandler) OpenDatabase() error
- func (dbh *DbHandler) ReadAllTPH() ImportStruct
- func (dbh *DbHandler) ReadTPH() ImportStruct
- func (dbh *DbHandler) SetFetched(firstTimestamp string, lastTimestamp string)
- type ImportRowStruct
- type ImportStruct
- type TimeseriesImportStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBConfig ¶
type DBConfig struct { Name string `json:"Name"` IPOrPath string `json:"IPOrPath"` UsePostgres bool `json:"UsePostgres"` User string `json:"User"` Password string `json:"Password"` Port int `json:"Port"` TableName string `json:"TableName"` }
func GetDefaultDBConfig ¶
func GetDefaultDBConfig() DBConfig
type DbHandler ¶
func NewDefault ¶
func NewDefault() DbHandler
NewDefault creates DbHandler with default a configuration
func (*DbHandler) AddColumnToTable ¶
AddColumnToTable adds a column with type number into table (real default null))
func (*DbHandler) CloseDatabase ¶
CloseDatabase closes database connection
func (*DbHandler) CreateTimeseriesTable ¶
CreateTimeseriesTable creates a table for timeseries values. Consider adding timescaledb features for postgres.
func (*DbHandler) InsertIntoDatabase ¶
func (dbh *DbHandler) InsertIntoDatabase(tableName string, is ImportStruct) error
InsertIntoDatabase stores values into database
func (*DbHandler) InsertRowToTable ¶
func (dbh *DbHandler) InsertRowToTable(tableName string, is ImportRowStruct) error
InsertRowToTable inserts one row into database
func (*DbHandler) InsertRowsToTable ¶
func (dbh *DbHandler) InsertRowsToTable(tableName string, importStructs []ImportRowStruct) ([]ImportRowStruct, error)
InsertRowsToTable imports importStructs into table and returns failed rows
func (*DbHandler) InsertTimeseries ¶
func (dbh *DbHandler) InsertTimeseries(is TimeseriesImportStruct, onClonflictDoNothing bool) error
InsertTimeseries stores values into timeseries table
func (*DbHandler) OpenDatabase ¶ added in v1.0.3
OpenDatabase creates a sqlite or postgres db
func (*DbHandler) ReadAllTPH ¶
func (dbh *DbHandler) ReadAllTPH() ImportStruct
func (*DbHandler) ReadTPH ¶
func (dbh *DbHandler) ReadTPH() ImportStruct
func (*DbHandler) SetFetched ¶
type ImportRowStruct ¶
ImportRowStruct contains data for one row
type ImportStruct ¶
ImportStruct contains all data which are needed to add to a database. One Timestamp can have multiple values
func CreateImportTable ¶
func CreateImportTable(importRows []ImportRowStruct) ImportStruct