db

package
v0.0.0-...-65deff2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *sql.DB) error

func Open

func Open(username, password, host, port, name, sslMode string) (*sql.DB, error)

Types

type AuthorizationStatus

type AuthorizationStatus string
const (
	AuthorizationStatusAccepted     AuthorizationStatus = "Accepted"
	AuthorizationStatusBlocked      AuthorizationStatus = "Blocked"
	AuthorizationStatusExpired      AuthorizationStatus = "Expired"
	AuthorizationStatusInvalid      AuthorizationStatus = "Invalid"
	AuthorizationStatusConcurrentTx AuthorizationStatus = "ConcurrentTx"
)

func (*AuthorizationStatus) Scan

func (e *AuthorizationStatus) Scan(src interface{}) error

type ChargePoint

type ChargePoint struct {
	ID                int64             `db:"id" json:"id"`
	Identity          string            `db:"identity" json:"identity"`
	Model             string            `db:"model" json:"model"`
	Vendor            string            `db:"vendor" json:"vendor"`
	SerialNumber      sql.NullString    `db:"serial_number" json:"serialNumber"`
	FirmwareVerion    sql.NullString    `db:"firmware_verion" json:"firmwareVerion"`
	ModemIccid        sql.NullString    `db:"modem_iccid" json:"modemIccid"`
	ModemImsi         sql.NullString    `db:"modem_imsi" json:"modemImsi"`
	MeterSerialNumber sql.NullString    `db:"meter_serial_number" json:"meterSerialNumber"`
	MeterType         sql.NullString    `db:"meter_type" json:"meterType"`
	CreatedAt         time.Time         `db:"created_at" json:"createdAt"`
	UpdatedAt         time.Time         `db:"updated_at" json:"updatedAt"`
	Status            ChargePointStatus `db:"status" json:"status"`
	Password          []byte            `db:"password" json:"password"`
}

type ChargePointErrorCode

type ChargePointErrorCode string
const (
	ChargePointErrorCodeConnectorLockFailure ChargePointErrorCode = "ConnectorLockFailure"
	ChargePointErrorCodeEVCommunicationError ChargePointErrorCode = "EVCommunicationError"
	ChargePointErrorCodeGroundFailure        ChargePointErrorCode = "GroundFailure"
	ChargePointErrorCodeHighTemperature      ChargePointErrorCode = "HighTemperature"
	ChargePointErrorCodeInternalError        ChargePointErrorCode = "InternalError"
	ChargePointErrorCodeLocalListConflict    ChargePointErrorCode = "LocalListConflict"
	ChargePointErrorCodeNoError              ChargePointErrorCode = "NoError"
	ChargePointErrorCodeOtherError           ChargePointErrorCode = "OtherError"
	ChargePointErrorCodeOverCurrentFailure   ChargePointErrorCode = "OverCurrentFailure"
	ChargePointErrorCodeOverVoltage          ChargePointErrorCode = "OverVoltage"
	ChargePointErrorCodePowerMeterFailure    ChargePointErrorCode = "PowerMeterFailure"
	ChargePointErrorCodePowerSwitchFailure   ChargePointErrorCode = "PowerSwitchFailure"
	ChargePointErrorCodeReaderFailure        ChargePointErrorCode = "ReaderFailure"
	ChargePointErrorCodeResetFailure         ChargePointErrorCode = "ResetFailure"
	ChargePointErrorCodeUnderVoltage         ChargePointErrorCode = "UnderVoltage"
	ChargePointErrorCodeWeakSignal           ChargePointErrorCode = "WeakSignal"
)

func (*ChargePointErrorCode) Scan

func (e *ChargePointErrorCode) Scan(src interface{}) error

type ChargePointStatus

type ChargePointStatus string
const (
	ChargePointStatusOnline  ChargePointStatus = "Online"
	ChargePointStatusPending ChargePointStatus = "Pending"
	ChargePointStatusOffline ChargePointStatus = "Offline"
)

func (*ChargePointStatus) Scan

func (e *ChargePointStatus) Scan(src interface{}) error

type Configuration

type Configuration struct {
	ID            int64          `db:"id" json:"id"`
	ChargePointID int64          `db:"charge_point_id" json:"chargePointID"`
	Key           string         `db:"key" json:"key"`
	Readonly      bool           `db:"readonly" json:"readonly"`
	Value         sql.NullString `db:"value" json:"value"`
	CreatedAt     time.Time      `db:"created_at" json:"createdAt"`
	UpdatedAt     time.Time      `db:"updated_at" json:"updatedAt"`
}

type Connector

type Connector struct {
	ID              int64                `db:"id" json:"id"`
	ConnectorID     int32                `db:"connector_id" json:"connectorID"`
	ChargePointID   int64                `db:"charge_point_id" json:"chargePointID"`
	ErrorCode       ChargePointErrorCode `db:"error_code" json:"errorCode"`
	Status          ConnectorStatus      `db:"status" json:"status"`
	Info            sql.NullString       `db:"info" json:"info"`
	VendorID        sql.NullString       `db:"vendor_id" json:"vendorID"`
	VendorErrorCode sql.NullString       `db:"vendor_error_code" json:"vendorErrorCode"`
	CreatedAt       time.Time            `db:"created_at" json:"createdAt"`
	UpdatedAt       time.Time            `db:"updated_at" json:"updatedAt"`
}

type ConnectorStatus

type ConnectorStatus string
const (
	ConnectorStatusAvailable     ConnectorStatus = "Available"
	ConnectorStatusPreparing     ConnectorStatus = "Preparing"
	ConnectorStatusCharging      ConnectorStatus = "Charging"
	ConnectorStatusSuspendedEVSE ConnectorStatus = "SuspendedEVSE"
	ConnectorStatusSuspendedEV   ConnectorStatus = "SuspendedEV"
	ConnectorStatusFinishing     ConnectorStatus = "Finishing"
	ConnectorStatusReserved      ConnectorStatus = "Reserved"
	ConnectorStatusUnavailable   ConnectorStatus = "Unavailable"
	ConnectorStatusFaulted       ConnectorStatus = "Faulted"
)

func (*ConnectorStatus) Scan

func (e *ConnectorStatus) Scan(src interface{}) error

type CreateChargePointParams

type CreateChargePointParams struct {
	Identity          string            `db:"identity" json:"identity"`
	Model             string            `db:"model" json:"model"`
	Vendor            string            `db:"vendor" json:"vendor"`
	SerialNumber      sql.NullString    `db:"serial_number" json:"serialNumber"`
	FirmwareVerion    sql.NullString    `db:"firmware_verion" json:"firmwareVerion"`
	ModemIccid        sql.NullString    `db:"modem_iccid" json:"modemIccid"`
	ModemImsi         sql.NullString    `db:"modem_imsi" json:"modemImsi"`
	MeterSerialNumber sql.NullString    `db:"meter_serial_number" json:"meterSerialNumber"`
	MeterType         sql.NullString    `db:"meter_type" json:"meterType"`
	Status            ChargePointStatus `db:"status" json:"status"`
	Password          []byte            `db:"password" json:"password"`
	CreatedAt         time.Time         `db:"created_at" json:"createdAt"`
	UpdatedAt         time.Time         `db:"updated_at" json:"updatedAt"`
}

type CreateConfigurationParams

type CreateConfigurationParams struct {
	ChargePointID int64          `db:"charge_point_id" json:"chargePointID"`
	Key           string         `db:"key" json:"key"`
	Readonly      bool           `db:"readonly" json:"readonly"`
	Value         sql.NullString `db:"value" json:"value"`
	CreatedAt     time.Time      `db:"created_at" json:"createdAt"`
	UpdatedAt     time.Time      `db:"updated_at" json:"updatedAt"`
}

type CreateConnectorParams

type CreateConnectorParams struct {
	ConnectorID     int32                `db:"connector_id" json:"connectorID"`
	ChargePointID   int64                `db:"charge_point_id" json:"chargePointID"`
	ErrorCode       ChargePointErrorCode `db:"error_code" json:"errorCode"`
	Status          ConnectorStatus      `db:"status" json:"status"`
	Info            sql.NullString       `db:"info" json:"info"`
	VendorID        sql.NullString       `db:"vendor_id" json:"vendorID"`
	VendorErrorCode sql.NullString       `db:"vendor_error_code" json:"vendorErrorCode"`
	CreatedAt       time.Time            `db:"created_at" json:"createdAt"`
	UpdatedAt       time.Time            `db:"updated_at" json:"updatedAt"`
}

type CreateIDTagParams

type CreateIDTagParams struct {
	ParentIDTagID sql.NullInt64       `db:"parent_id_tag_id" json:"parentIDTagID"`
	Token         string              `db:"token" json:"token"`
	Status        AuthorizationStatus `db:"status" json:"status"`
	CreatedAt     time.Time           `db:"created_at" json:"createdAt"`
	UpdatedAt     time.Time           `db:"updated_at" json:"updatedAt"`
}

type CreateMeterValueParams

type CreateMeterValueParams struct {
	ConnectorID     int32                  `db:"connector_id" json:"connectorID"`
	ChargePointID   int64                  `db:"charge_point_id" json:"chargePointID"`
	TransactionID   sql.NullInt64          `db:"transaction_id" json:"transactionID"`
	Format          MeterValueFormat       `db:"format" json:"format"`
	Context         MeterReadingContext    `db:"context" json:"context"`
	Measurand       MeterMeasurand         `db:"measurand" json:"measurand"`
	Phase           NullMeterPhase         `db:"phase" json:"phase"`
	Location        MeterLocation          `db:"location" json:"location"`
	Unit            NullMeterUnitOfMeasure `db:"unit" json:"unit"`
	RawValue        sql.NullFloat64        `db:"raw_value" json:"rawValue"`
	SignedDataValue sql.NullString         `db:"signed_data_value" json:"signedDataValue"`
	Timestamp       time.Time              `db:"timestamp" json:"timestamp"`
	CreatedAt       time.Time              `db:"created_at" json:"createdAt"`
}

type CreateReservationParams

type CreateReservationParams struct {
	ConnectorID   int32             `db:"connector_id" json:"connectorID"`
	ChargePointID int64             `db:"charge_point_id" json:"chargePointID"`
	ExpiryDate    time.Time         `db:"expiry_date" json:"expiryDate"`
	Status        ReservationStatus `db:"status" json:"status"`
	IDTag         string            `db:"id_tag" json:"idTag"`
	ParentIDTag   sql.NullString    `db:"parent_id_tag" json:"parentIDTag"`
	CreatedAt     time.Time         `db:"created_at" json:"createdAt"`
	UpdatedAt     time.Time         `db:"updated_at" json:"updatedAt"`
}

type CreateTransactionParams

type CreateTransactionParams struct {
	ConnectorID    int32         `db:"connector_id" json:"connectorID"`
	ChargePointID  int64         `db:"charge_point_id" json:"chargePointID"`
	ReservationID  sql.NullInt64 `db:"reservation_id" json:"reservationID"`
	IDTag          string        `db:"id_tag" json:"idTag"`
	MeterStart     int32         `db:"meter_start" json:"meterStart"`
	StartTimestamp time.Time     `db:"start_timestamp" json:"startTimestamp"`
	CreatedAt      time.Time     `db:"created_at" json:"createdAt"`
	UpdatedAt      time.Time     `db:"updated_at" json:"updatedAt"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetConfigurationByKeyParams

type GetConfigurationByKeyParams struct {
	ChargePointID int64  `db:"charge_point_id" json:"chargePointID"`
	Key           string `db:"key" json:"key"`
}

type GetConnectorByConnectorIDParams

type GetConnectorByConnectorIDParams struct {
	ChargePointID int64 `db:"charge_point_id" json:"chargePointID"`
	ConnectorID   int32 `db:"connector_id" json:"connectorID"`
}

type IDTag

type IDTag struct {
	ID            int64               `db:"id" json:"id"`
	ParentIDTagID sql.NullInt64       `db:"parent_id_tag_id" json:"parentIDTagID"`
	Token         string              `db:"token" json:"token"`
	Status        AuthorizationStatus `db:"status" json:"status"`
	CreatedAt     time.Time           `db:"created_at" json:"createdAt"`
	UpdatedAt     time.Time           `db:"updated_at" json:"updatedAt"`
}

type MeterLocation

type MeterLocation string
const (
	MeterLocationBody   MeterLocation = "Body"
	MeterLocationCable  MeterLocation = "Cable"
	MeterLocationEV     MeterLocation = "EV"
	MeterLocationInlet  MeterLocation = "Inlet"
	MeterLocationOutlet MeterLocation = "Outlet"
)

func (*MeterLocation) Scan

func (e *MeterLocation) Scan(src interface{}) error

type MeterMeasurand

type MeterMeasurand string
const (
	MeterMeasurandCurrentExport                MeterMeasurand = "Current.Export"
	MeterMeasurandCurrentImport                MeterMeasurand = "Current.Import"
	MeterMeasurandCurrentOffered               MeterMeasurand = "Current.Offered"
	MeterMeasurandEnergyActiveExportRegister   MeterMeasurand = "Energy.Active.Export.Register"
	MeterMeasurandEnergyActiveImportRegister   MeterMeasurand = "Energy.Active.Import.Register"
	MeterMeasurandEnergyReactiveExportRegister MeterMeasurand = "Energy.Reactive.Export.Register"
	MeterMeasurandEnergyReactiveImportRegister MeterMeasurand = "Energy.Reactive.Import.Register"
	MeterMeasurandEnergyActiveExportInterval   MeterMeasurand = "Energy.Active.Export.Interval"
	MeterMeasurandEnergyActiveImportInterval   MeterMeasurand = "Energy.Active.Import.Interval"
	MeterMeasurandEnergyReactiveExportInterval MeterMeasurand = "Energy.Reactive.Export.Interval"
	MeterMeasurandEnergyReactiveImportInterval MeterMeasurand = "Energy.Reactive.Import.Interval"
	MeterMeasurandFrequency                    MeterMeasurand = "Frequency"
	MeterMeasurandPowerActiveExport            MeterMeasurand = "Power.Active.Export"
	MeterMeasurandPowerActiveImport            MeterMeasurand = "Power.Active.Import"
	MeterMeasurandPowerFactor                  MeterMeasurand = "Power.Factor"
	MeterMeasurandPowerOffered                 MeterMeasurand = "Power.Offered"
	MeterMeasurandPowerReactiveExport          MeterMeasurand = "Power.Reactive.Export"
	MeterMeasurandPowerReactiveImport          MeterMeasurand = "Power.Reactive.Import"
	MeterMeasurandRPM                          MeterMeasurand = "RPM"
	MeterMeasurandSoC                          MeterMeasurand = "SoC"
	MeterMeasurandTemperature                  MeterMeasurand = "Temperature"
	MeterMeasurandVoltage                      MeterMeasurand = "Voltage"
)

func (*MeterMeasurand) Scan

func (e *MeterMeasurand) Scan(src interface{}) error

type MeterPhase

type MeterPhase string
const (
	MeterPhaseL1   MeterPhase = "L1"
	MeterPhaseL2   MeterPhase = "L2"
	MeterPhaseL3   MeterPhase = "L3"
	MeterPhaseN    MeterPhase = "N"
	MeterPhaseL1N  MeterPhase = "L1-N"
	MeterPhaseL2N  MeterPhase = "L2-N"
	MeterPhaseL3N  MeterPhase = "L3-N"
	MeterPhaseL1L2 MeterPhase = "L1-L2"
	MeterPhaseL2L3 MeterPhase = "L2-L3"
	MeterPhaseL3L1 MeterPhase = "L3-L1"
)

func (*MeterPhase) Scan

func (e *MeterPhase) Scan(src interface{}) error

type MeterReadingContext

type MeterReadingContext string
const (
	MeterReadingContextInterruptionBegin MeterReadingContext = "Interruption.Begin"
	MeterReadingContextInterruptionEnd   MeterReadingContext = "Interruption.End"
	MeterReadingContextOther             MeterReadingContext = "Other"
	MeterReadingContextSampleClock       MeterReadingContext = "Sample.Clock"
	MeterReadingContextSamplePeriodic    MeterReadingContext = "Sample.Periodic"
	MeterReadingContextTransactionBegin  MeterReadingContext = "Transaction.Begin"
	MeterReadingContextTransactionEnd    MeterReadingContext = "Transaction.End"
	MeterReadingContextTrigger           MeterReadingContext = "Trigger"
)

func (*MeterReadingContext) Scan

func (e *MeterReadingContext) Scan(src interface{}) error

type MeterUnitOfMeasure

type MeterUnitOfMeasure string
const (
	MeterUnitOfMeasureWh         MeterUnitOfMeasure = "Wh"
	MeterUnitOfMeasureKWh        MeterUnitOfMeasure = "kWh"
	MeterUnitOfMeasureVarh       MeterUnitOfMeasure = "varh"
	MeterUnitOfMeasureKvarh      MeterUnitOfMeasure = "kvarh"
	MeterUnitOfMeasureW          MeterUnitOfMeasure = "W"
	MeterUnitOfMeasureKW         MeterUnitOfMeasure = "kW"
	MeterUnitOfMeasureVA         MeterUnitOfMeasure = "VA"
	MeterUnitOfMeasureKVA        MeterUnitOfMeasure = "kVA"
	MeterUnitOfMeasureVar        MeterUnitOfMeasure = "var"
	MeterUnitOfMeasureKvar       MeterUnitOfMeasure = "kvar"
	MeterUnitOfMeasureA          MeterUnitOfMeasure = "A"
	MeterUnitOfMeasureV          MeterUnitOfMeasure = "V"
	MeterUnitOfMeasureCelsius    MeterUnitOfMeasure = "Celsius"
	MeterUnitOfMeasureFahrenheit MeterUnitOfMeasure = "Fahrenheit"
	MeterUnitOfMeasureK          MeterUnitOfMeasure = "K"
	MeterUnitOfMeasurePercent    MeterUnitOfMeasure = "Percent"
)

func (*MeterUnitOfMeasure) Scan

func (e *MeterUnitOfMeasure) Scan(src interface{}) error

type MeterValue

type MeterValue struct {
	ID              int64                  `db:"id" json:"id"`
	ConnectorID     int32                  `db:"connector_id" json:"connectorID"`
	ChargePointID   int64                  `db:"charge_point_id" json:"chargePointID"`
	TransactionID   sql.NullInt64          `db:"transaction_id" json:"transactionID"`
	Format          MeterValueFormat       `db:"format" json:"format"`
	Context         MeterReadingContext    `db:"context" json:"context"`
	Measurand       MeterMeasurand         `db:"measurand" json:"measurand"`
	Phase           NullMeterPhase         `db:"phase" json:"phase"`
	Location        MeterLocation          `db:"location" json:"location"`
	Unit            NullMeterUnitOfMeasure `db:"unit" json:"unit"`
	RawValue        sql.NullFloat64        `db:"raw_value" json:"rawValue"`
	SignedDataValue sql.NullString         `db:"signed_data_value" json:"signedDataValue"`
	Timestamp       time.Time              `db:"timestamp" json:"timestamp"`
	CreatedAt       time.Time              `db:"created_at" json:"createdAt"`
}

type MeterValueFormat

type MeterValueFormat string
const (
	MeterValueFormatRaw        MeterValueFormat = "Raw"
	MeterValueFormatSignedData MeterValueFormat = "SignedData"
)

func (*MeterValueFormat) Scan

func (e *MeterValueFormat) Scan(src interface{}) error

type NullAuthorizationStatus

type NullAuthorizationStatus struct {
	AuthorizationStatus AuthorizationStatus
	Valid               bool // Valid is true if AuthorizationStatus is not NULL
}

func (*NullAuthorizationStatus) Scan

func (ns *NullAuthorizationStatus) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullAuthorizationStatus) Value

func (ns NullAuthorizationStatus) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullChargePointErrorCode

type NullChargePointErrorCode struct {
	ChargePointErrorCode ChargePointErrorCode
	Valid                bool // Valid is true if ChargePointErrorCode is not NULL
}

func (*NullChargePointErrorCode) Scan

func (ns *NullChargePointErrorCode) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullChargePointErrorCode) Value

Value implements the driver Valuer interface.

type NullChargePointStatus

type NullChargePointStatus struct {
	ChargePointStatus ChargePointStatus
	Valid             bool // Valid is true if ChargePointStatus is not NULL
}

func (*NullChargePointStatus) Scan

func (ns *NullChargePointStatus) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullChargePointStatus) Value

func (ns NullChargePointStatus) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullConnectorStatus

type NullConnectorStatus struct {
	ConnectorStatus ConnectorStatus
	Valid           bool // Valid is true if ConnectorStatus is not NULL
}

func (*NullConnectorStatus) Scan

func (ns *NullConnectorStatus) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullConnectorStatus) Value

func (ns NullConnectorStatus) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullMeterLocation

type NullMeterLocation struct {
	MeterLocation MeterLocation
	Valid         bool // Valid is true if MeterLocation is not NULL
}

func (*NullMeterLocation) Scan

func (ns *NullMeterLocation) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullMeterLocation) Value

func (ns NullMeterLocation) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullMeterMeasurand

type NullMeterMeasurand struct {
	MeterMeasurand MeterMeasurand
	Valid          bool // Valid is true if MeterMeasurand is not NULL
}

func (*NullMeterMeasurand) Scan

func (ns *NullMeterMeasurand) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullMeterMeasurand) Value

func (ns NullMeterMeasurand) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullMeterPhase

type NullMeterPhase struct {
	MeterPhase MeterPhase
	Valid      bool // Valid is true if MeterPhase is not NULL
}

func (*NullMeterPhase) Scan

func (ns *NullMeterPhase) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullMeterPhase) Value

func (ns NullMeterPhase) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullMeterReadingContext

type NullMeterReadingContext struct {
	MeterReadingContext MeterReadingContext
	Valid               bool // Valid is true if MeterReadingContext is not NULL
}

func (*NullMeterReadingContext) Scan

func (ns *NullMeterReadingContext) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullMeterReadingContext) Value

func (ns NullMeterReadingContext) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullMeterUnitOfMeasure

type NullMeterUnitOfMeasure struct {
	MeterUnitOfMeasure MeterUnitOfMeasure
	Valid              bool // Valid is true if MeterUnitOfMeasure is not NULL
}

func (*NullMeterUnitOfMeasure) Scan

func (ns *NullMeterUnitOfMeasure) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullMeterUnitOfMeasure) Value

func (ns NullMeterUnitOfMeasure) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullMeterValueFormat

type NullMeterValueFormat struct {
	MeterValueFormat MeterValueFormat
	Valid            bool // Valid is true if MeterValueFormat is not NULL
}

func (*NullMeterValueFormat) Scan

func (ns *NullMeterValueFormat) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullMeterValueFormat) Value

func (ns NullMeterValueFormat) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullReservationStatus

type NullReservationStatus struct {
	ReservationStatus ReservationStatus
	Valid             bool // Valid is true if ReservationStatus is not NULL
}

func (*NullReservationStatus) Scan

func (ns *NullReservationStatus) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullReservationStatus) Value

func (ns NullReservationStatus) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullTransactionStatus

type NullTransactionStatus struct {
	TransactionStatus TransactionStatus
	Valid             bool // Valid is true if TransactionStatus is not NULL
}

func (*NullTransactionStatus) Scan

func (ns *NullTransactionStatus) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTransactionStatus) Value

func (ns NullTransactionStatus) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullTransactionStopReason

type NullTransactionStopReason struct {
	TransactionStopReason TransactionStopReason
	Valid                 bool // Valid is true if TransactionStopReason is not NULL
}

func (*NullTransactionStopReason) Scan

func (ns *NullTransactionStopReason) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTransactionStopReason) Value

Value implements the driver Valuer interface.

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) CreateChargePoint

func (q *Queries) CreateChargePoint(ctx context.Context, arg CreateChargePointParams) (ChargePoint, error)

func (*Queries) CreateConfiguration

func (q *Queries) CreateConfiguration(ctx context.Context, arg CreateConfigurationParams) (Configuration, error)

func (*Queries) CreateConnector

func (q *Queries) CreateConnector(ctx context.Context, arg CreateConnectorParams) (Connector, error)

func (*Queries) CreateIDTag

func (q *Queries) CreateIDTag(ctx context.Context, arg CreateIDTagParams) (IDTag, error)

func (*Queries) CreateMeterValue

func (q *Queries) CreateMeterValue(ctx context.Context, arg CreateMeterValueParams) (MeterValue, error)

func (*Queries) CreateReservation

func (q *Queries) CreateReservation(ctx context.Context, arg CreateReservationParams) (Reservation, error)

func (*Queries) CreateTransaction

func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error)

func (*Queries) GetChargePoint

func (q *Queries) GetChargePoint(ctx context.Context, id int64) (ChargePoint, error)

func (*Queries) GetChargePointByIdentity

func (q *Queries) GetChargePointByIdentity(ctx context.Context, identity string) (ChargePoint, error)

func (*Queries) GetConfiguration

func (q *Queries) GetConfiguration(ctx context.Context, id int64) (Configuration, error)

func (*Queries) GetConfigurationByKey

func (q *Queries) GetConfigurationByKey(ctx context.Context, arg GetConfigurationByKeyParams) (Configuration, error)

func (*Queries) GetConnector

func (q *Queries) GetConnector(ctx context.Context, id int64) (Connector, error)

func (*Queries) GetConnectorByConnectorID

func (q *Queries) GetConnectorByConnectorID(ctx context.Context, arg GetConnectorByConnectorIDParams) (Connector, error)

func (*Queries) GetIDTag

func (q *Queries) GetIDTag(ctx context.Context, id int64) (IDTag, error)

func (*Queries) GetIDTagByToken

func (q *Queries) GetIDTagByToken(ctx context.Context, token string) (IDTag, error)

func (*Queries) GetMeterValue

func (q *Queries) GetMeterValue(ctx context.Context, id int64) (MeterValue, error)

func (*Queries) GetReservation

func (q *Queries) GetReservation(ctx context.Context, id int64) (Reservation, error)

func (*Queries) GetTransaction

func (q *Queries) GetTransaction(ctx context.Context, id int64) (Transaction, error)

func (*Queries) ListChargePoints

func (q *Queries) ListChargePoints(ctx context.Context) ([]ChargePoint, error)

func (*Queries) ListConfigurations

func (q *Queries) ListConfigurations(ctx context.Context, chargePointID int64) ([]Configuration, error)

func (*Queries) ListConnectors

func (q *Queries) ListConnectors(ctx context.Context, chargePointID int64) ([]Connector, error)

func (*Queries) ListIDTags

func (q *Queries) ListIDTags(ctx context.Context) ([]IDTag, error)

func (*Queries) ListMeterValues

func (q *Queries) ListMeterValues(ctx context.Context) ([]MeterValue, error)

func (*Queries) ListReservations

func (q *Queries) ListReservations(ctx context.Context) ([]Reservation, error)

func (*Queries) ListTransactions

func (q *Queries) ListTransactions(ctx context.Context) ([]Transaction, error)

func (*Queries) UpdateChargePoint

func (q *Queries) UpdateChargePoint(ctx context.Context, arg UpdateChargePointParams) (ChargePoint, error)

func (*Queries) UpdateConfiguration

func (q *Queries) UpdateConfiguration(ctx context.Context, arg UpdateConfigurationParams) (Configuration, error)

func (*Queries) UpdateConnector

func (q *Queries) UpdateConnector(ctx context.Context, arg UpdateConnectorParams) (Connector, error)

func (*Queries) UpdateIDTag

func (q *Queries) UpdateIDTag(ctx context.Context, arg UpdateIDTagParams) (IDTag, error)

func (*Queries) UpdateReservation

func (q *Queries) UpdateReservation(ctx context.Context, arg UpdateReservationParams) (Reservation, error)

func (*Queries) UpdateTransaction

func (q *Queries) UpdateTransaction(ctx context.Context, arg UpdateTransactionParams) (Transaction, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Repository

type Repository struct {
	*Queries
	*sql.DB
}

func NewRepository

func NewRepository(d *sql.DB) *Repository

type Reservation

type Reservation struct {
	ID            int64             `db:"id" json:"id"`
	ConnectorID   int32             `db:"connector_id" json:"connectorID"`
	ChargePointID int64             `db:"charge_point_id" json:"chargePointID"`
	ExpiryDate    time.Time         `db:"expiry_date" json:"expiryDate"`
	Status        ReservationStatus `db:"status" json:"status"`
	IDTag         string            `db:"id_tag" json:"idTag"`
	ParentIDTag   sql.NullString    `db:"parent_id_tag" json:"parentIDTag"`
	CreatedAt     time.Time         `db:"created_at" json:"createdAt"`
	UpdatedAt     time.Time         `db:"updated_at" json:"updatedAt"`
}

type ReservationStatus

type ReservationStatus string
const (
	ReservationStatusAccepted    ReservationStatus = "Accepted"
	ReservationStatusCancelled   ReservationStatus = "Cancelled"
	ReservationStatusCompleted   ReservationStatus = "Completed"
	ReservationStatusFaulted     ReservationStatus = "Faulted"
	ReservationStatusOccupied    ReservationStatus = "Occupied"
	ReservationStatusRejected    ReservationStatus = "Rejected"
	ReservationStatusUnavailable ReservationStatus = "Unavailable"
)

func (*ReservationStatus) Scan

func (e *ReservationStatus) Scan(src interface{}) error

type Transaction

type Transaction struct {
	ID             int64                     `db:"id" json:"id"`
	ConnectorID    int32                     `db:"connector_id" json:"connectorID"`
	ChargePointID  int64                     `db:"charge_point_id" json:"chargePointID"`
	ReservationID  sql.NullInt64             `db:"reservation_id" json:"reservationID"`
	Status         TransactionStatus         `db:"status" json:"status"`
	IDTag          string                    `db:"id_tag" json:"idTag"`
	Reason         NullTransactionStopReason `db:"reason" json:"reason"`
	MeterStart     int32                     `db:"meter_start" json:"meterStart"`
	MeterStop      sql.NullInt32             `db:"meter_stop" json:"meterStop"`
	StartTimestamp time.Time                 `db:"start_timestamp" json:"startTimestamp"`
	StopTimestamp  sql.NullTime              `db:"stop_timestamp" json:"stopTimestamp"`
	CreatedAt      time.Time                 `db:"created_at" json:"createdAt"`
	UpdatedAt      time.Time                 `db:"updated_at" json:"updatedAt"`
}

type TransactionStatus

type TransactionStatus string
const (
	TransactionStatusStarted TransactionStatus = "Started"
	TransactionStatusStopped TransactionStatus = "Stopped"
)

func (*TransactionStatus) Scan

func (e *TransactionStatus) Scan(src interface{}) error

type TransactionStopReason

type TransactionStopReason string
const (
	TransactionStopReasonEmergencyStop  TransactionStopReason = "EmergencyStop"
	TransactionStopReasonEVDisconnected TransactionStopReason = "EVDisconnected"
	TransactionStopReasonHardReset      TransactionStopReason = "HardReset"
	TransactionStopReasonLocal          TransactionStopReason = "Local"
	TransactionStopReasonOther          TransactionStopReason = "Other"
	TransactionStopReasonOutlet         TransactionStopReason = "Outlet"
	TransactionStopReasonPowerLoss      TransactionStopReason = "PowerLoss"
	TransactionStopReasonReboot         TransactionStopReason = "Reboot"
	TransactionStopReasonRemote         TransactionStopReason = "Remote"
	TransactionStopReasonSoftReset      TransactionStopReason = "SoftReset"
	TransactionStopReasonUnlockCommand  TransactionStopReason = "UnlockCommand"
	TransactionStopReasonDeAuthorized   TransactionStopReason = "DeAuthorized"
)

func (*TransactionStopReason) Scan

func (e *TransactionStopReason) Scan(src interface{}) error

type UpdateChargePointParams

type UpdateChargePointParams struct {
	ID                int64             `db:"id" json:"id"`
	Model             string            `db:"model" json:"model"`
	Vendor            string            `db:"vendor" json:"vendor"`
	SerialNumber      sql.NullString    `db:"serial_number" json:"serialNumber"`
	FirmwareVerion    sql.NullString    `db:"firmware_verion" json:"firmwareVerion"`
	ModemIccid        sql.NullString    `db:"modem_iccid" json:"modemIccid"`
	ModemImsi         sql.NullString    `db:"modem_imsi" json:"modemImsi"`
	MeterSerialNumber sql.NullString    `db:"meter_serial_number" json:"meterSerialNumber"`
	MeterType         sql.NullString    `db:"meter_type" json:"meterType"`
	Status            ChargePointStatus `db:"status" json:"status"`
	Password          []byte            `db:"password" json:"password"`
	UpdatedAt         time.Time         `db:"updated_at" json:"updatedAt"`
}

type UpdateConfigurationParams

type UpdateConfigurationParams struct {
	ID        int64          `db:"id" json:"id"`
	Value     sql.NullString `db:"value" json:"value"`
	UpdatedAt time.Time      `db:"updated_at" json:"updatedAt"`
}

type UpdateConnectorParams

type UpdateConnectorParams struct {
	ID              int64                `db:"id" json:"id"`
	ErrorCode       ChargePointErrorCode `db:"error_code" json:"errorCode"`
	Status          ConnectorStatus      `db:"status" json:"status"`
	Info            sql.NullString       `db:"info" json:"info"`
	VendorID        sql.NullString       `db:"vendor_id" json:"vendorID"`
	VendorErrorCode sql.NullString       `db:"vendor_error_code" json:"vendorErrorCode"`
	UpdatedAt       time.Time            `db:"updated_at" json:"updatedAt"`
}

type UpdateIDTagParams

type UpdateIDTagParams struct {
	ID            int64               `db:"id" json:"id"`
	ParentIDTagID sql.NullInt64       `db:"parent_id_tag_id" json:"parentIDTagID"`
	Status        AuthorizationStatus `db:"status" json:"status"`
	UpdatedAt     time.Time           `db:"updated_at" json:"updatedAt"`
}

type UpdateReservationParams

type UpdateReservationParams struct {
	ID        int64             `db:"id" json:"id"`
	Status    ReservationStatus `db:"status" json:"status"`
	UpdatedAt time.Time         `db:"updated_at" json:"updatedAt"`
}

type UpdateTransactionParams

type UpdateTransactionParams struct {
	ID            int64                     `db:"id" json:"id"`
	Status        TransactionStatus         `db:"status" json:"status"`
	Reason        NullTransactionStopReason `db:"reason" json:"reason"`
	MeterStop     sql.NullInt32             `db:"meter_stop" json:"meterStop"`
	StopTimestamp sql.NullTime              `db:"stop_timestamp" json:"stopTimestamp"`
	UpdatedAt     time.Time                 `db:"updated_at" json:"updatedAt"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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