Documentation
¶
Index ¶
- func Transfer(ctx context.Context, src, dst *Client, opts TransferOptions) error
- func ValidateIdentifier(name string) error
- type Client
- func (c *Client) Close() error
- func (c *Client) CopyTablesTo(ctx context.Context, dst *Client, tables []string) error
- func (c *Client) CountLoadpointSessions(ctx context.Context, loadpoint string) (int, error)
- func (c *Client) CountVehicleSessions(ctx context.Context, vehicle string) (int, error)
- func (c *Client) DeleteLoadpointSessions(ctx context.Context, loadpoint string) (int, error)
- func (c *Client) DeleteVehicleSessions(ctx context.Context, vehicle string) (int, error)
- func (c *Client) ExportJSON(w io.Writer, opts TransferOptions) error
- func (c *Client) GetAllTables() []string
- func (c *Client) GetConfigTables() []string
- func (c *Client) GetMetricsTables() []string
- func (c *Client) GetRowCount(table string) (int, error)
- func (c *Client) GetTableColumns(table string) ([]ColumnInfo, error)
- func (c *Client) GetTables() ([]string, error)
- func (c *Client) ImportJSON(r io.Reader, opts TransferOptions) error
- func (c *Client) RenameLoadpoint(ctx context.Context, oldName, newName string) (RenameResult, error)
- func (c *Client) RenameLoadpointDryRun(ctx context.Context, oldName, newName string) (RenameResult, error)
- func (c *Client) RenameVehicle(ctx context.Context, oldName, newName string) (RenameResult, error)
- func (c *Client) RenameVehicleDryRun(ctx context.Context, oldName, newName string) (RenameResult, error)
- func (c *Client) ResolveTables(opts TransferOptions) ([]string, error)
- func (c *Client) TableExists(name string) (bool, error)
- type ColumnInfo
- type Config
- type ExportFormat
- type Exporter
- type GridSession
- type Importer
- type Meter
- type RenameMapping
- type RenameResult
- type Session
- type Setting
- type TransferMode
- type TransferOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Transfer ¶
func Transfer(ctx context.Context, src, dst *Client, opts TransferOptions) error
Transfer transfers data from source to destination database based on options
func ValidateIdentifier ¶
ValidateIdentifier checks if a string is safe to use as a SQL identifier
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a connection to an evcc SQLite database
func (*Client) CopyTablesTo ¶
CopyTablesTo copies specific tables from source to destination
func (*Client) CountLoadpointSessions ¶
CountLoadpointSessions counts sessions for a specific loadpoint
func (*Client) CountVehicleSessions ¶
CountVehicleSessions counts sessions for a specific vehicle
func (*Client) DeleteLoadpointSessions ¶
DeleteLoadpointSessions deletes all sessions for a specific loadpoint
func (*Client) DeleteVehicleSessions ¶
DeleteVehicleSessions deletes all sessions for a specific vehicle
func (*Client) ExportJSON ¶
func (c *Client) ExportJSON(w io.Writer, opts TransferOptions) error
ExportJSON exports selected tables to JSON
func (*Client) GetAllTables ¶
GetAllTables returns all known tables
func (*Client) GetConfigTables ¶
GetConfigTables returns the list of configuration tables
func (*Client) GetMetricsTables ¶
GetMetricsTables returns the list of metrics tables
func (*Client) GetRowCount ¶
GetRowCount returns the number of rows in a table
func (*Client) GetTableColumns ¶
func (c *Client) GetTableColumns(table string) ([]ColumnInfo, error)
GetTableColumns returns the columns for a table
func (*Client) ImportJSON ¶
func (c *Client) ImportJSON(r io.Reader, opts TransferOptions) error
ImportJSON imports data from a JSON export file
func (*Client) RenameLoadpoint ¶
func (c *Client) RenameLoadpoint(ctx context.Context, oldName, newName string) (RenameResult, error)
RenameLoadpoint updates a loadpoint name across all tables
func (*Client) RenameLoadpointDryRun ¶
func (c *Client) RenameLoadpointDryRun(ctx context.Context, oldName, newName string) (RenameResult, error)
RenameLoadpointDryRun returns the counts of what would be renamed without making changes
func (*Client) RenameVehicle ¶
RenameVehicle updates a vehicle name across all tables
func (*Client) RenameVehicleDryRun ¶
func (c *Client) RenameVehicleDryRun(ctx context.Context, oldName, newName string) (RenameResult, error)
RenameVehicleDryRun returns the counts of what would be renamed without making changes
func (*Client) ResolveTables ¶
func (c *Client) ResolveTables(opts TransferOptions) ([]string, error)
ResolveTables returns the list of tables based on the transfer mode
type ColumnInfo ¶
ColumnInfo represents information about a column
type Config ¶
type Config struct {
ID int
Class int
Type string
Value string
Title string
Icon string
Product string
}
Config represents a device or service configuration
type ExportFormat ¶
type ExportFormat struct {
Version string `json:"version"`
ExportedAt string `json:"exported_at"`
Tables map[string]any `json:"tables"`
}
ExportFormat is the JSON structure for export/import
type Exporter ¶
type Exporter interface {
ExportJSON(w io.Writer, opts TransferOptions) error
}
Exporter defines the export interface
type GridSession ¶
type GridSession struct {
ID int
Created string
Finished *string
Type string
GridPower *float64
LimitPower *float64
}
GridSession represents a grid power session
type Importer ¶
type Importer interface {
ImportJSON(r io.Reader, opts TransferOptions) error
}
Importer defines the import interface
type RenameMapping ¶
RenameMapping defines a name transformation
type RenameResult ¶
RenameResult contains the counts of renamed rows per table
type Session ¶
type Session struct {
ID int
Created string
Finished *string
Loadpoint string
Identifier *string
Vehicle *string
OdometerStart *float64
MeterStartKwh *float64
MeterEndKwh *float64
ChargedKwh *float64
SolarPercentage *float64
Price *float64
PricePerKwh *float64
Co2PerKwh *float64
ChargeDuration *int
}
Session represents a charging session
type TransferMode ¶
type TransferMode int
TransferMode specifies which tables to transfer
const ( TransferConfig TransferMode = iota TransferMetrics TransferAll )
type TransferOptions ¶
type TransferOptions struct {
Mode TransferMode
Tables []string
DryRun bool
OnProgress func(table string, count int)
LoadpointRenames []RenameMapping
VehicleRenames []RenameMapping
}
TransferOptions configures transfer behavior