Documentation
¶
Index ¶
Constants ¶
View Source
const ( MySQLDriver = "mysql" PostgresDriver = "postgres" SQLiteDriver = "sqlite3" MSSQLDriver = "mssql" )
View Source
const ( Append DatasetType = "append" Replace DatasetType = "replace" NumberType FieldType = "number" DateType FieldType = "date" DatetimeType FieldType = "datetime" MoneyType FieldType = "money" PercentageType FieldType = "percentage" StringType FieldType = "string" )
Variables ¶
View Source
var (
SupportedDrivers = []string{MSSQLDriver, MySQLDriver, PostgresDriver, SQLiteDriver}
)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
GeckoboardAPIKey string `yaml:"geckoboard_api_key"`
DatabaseConfig *DatabaseConfig `yaml:"database"`
RefreshTimeSec uint16 `yaml:"refresh_time_sec"`
Datasets []Dataset `yaml:"datasets"`
}
func LoadConfig ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
Driver string `yaml:"driver"`
URL string `yaml:"-"`
Host string `yaml:"host"`
Port string `yaml:"port"`
Protocol string `yaml:"protocol"`
Database string `yaml:"name"`
Username string `yaml:"username"`
Password string `yaml:"password"`
TLSConfig *TLSConfig `yaml:"tls_config"`
Params map[string]string `yaml:"params"`
}
DatabaseConfig holds the db type, url and other custom options such as tls config
func (DatabaseConfig) Validate ¶
func (dc DatabaseConfig) Validate() (errors []string)
type Dataset ¶
type Dataset struct {
Name string `json:"id" yaml:"name"`
UpdateType DatasetType `json:"-" yaml:"update_type"`
UniqueBy []string `json:"unique_by,omitempty" yaml:"unique_by,omitempty"`
SQL string `json:"-" yaml:"sql"`
Fields []Field `json:"-" yaml:"fields"`
SchemaFields map[string]Field `json:"fields" yaml:"-"`
}
func (Dataset) BuildDataset ¶
func (ds Dataset) BuildDataset(dc *DatabaseConfig, db *sql.DB) (DatasetRows, error)
BuildDataset calls queryDatasource to query the datasource for a dataset entry and builds up a slice of rows ready for processing by the client
func (*Dataset) BuildSchemaFields ¶
func (ds *Dataset) BuildSchemaFields()
BuildSchemaFields creates a map[string]Field of the dataset fields for sending over to Geckoboard
type DatasetRows ¶
type DatasetRows []map[string]interface{}
DatasetRows holds a slice of map[string]interface{} which is used to send to a geckoboard dataset
type DatasetType ¶
type DatasetType string
type Field ¶
type Field struct {
Type FieldType `json:"type" yaml:"type"`
Key string `json:"-" yaml:"key"`
Name string `json:"name" yaml:"name"`
CurrencyCode string `json:"currency_code,omitempty" yaml:"currency_code"`
Optional bool `json:"optional,omitempty" yaml:"optional,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.