models

package
v0.0.0-...-6388ab4 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVOptions

type CSVOptions struct {
	SkipRows           uint            `json:"skip_rows"`
	Delimiter          string          `json:"delimiter"`
	CreateTableOptions string          `json:"create_table_opts"`
	Columns            []ColumnOptions `json:"columns"`
}

CSVOptions holds the csv options info

type ColumnOptions

type ColumnOptions struct {
	ColumnIndex  int    `json:"column_index"`
	Name         string `json:"name"`
	SQLType      string `json:"sql_type"`
	SQLFormatter string `json:"sql_formatter"`
}

ColumnOptions holds the options for retrieving and storing desired column info

type Config

type Config struct {
	DbInfo  DBInfo    `json:"db_info"`
	Devices []*Device `json:"devices"`
}

Config holds the config.json info

func (*Config) RunChecks

func (c *Config) RunChecks() error

RunChecks runs basic checks on Config to make sure data provided in the json config is correct

type DBInfo

type DBInfo struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Address  string `json:"address"`
	Name     string `json:"dbname"`
}

DBInfo holds the database config info for the mysql connection

type Device

type Device struct {
	Name       string     `json:"name"`
	FilePath   string     `json:"filepath"`
	Address    string     `json:"address"`
	CsvOptions CSVOptions `json:"csv_options"`
}

Device holds the device data info

func (*Device) GetFilteredRecords

func (d *Device) GetFilteredRecords() ([]any, error)

GetFilteredRecords gets the records with the deisred column data from the appropriate data source, all according to the device config info, The records returned are in the appropriate format for direct usage in the mysql insert query

Jump to

Keyboard shortcuts

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