spinusdb

package
v0.0.0-...-c76e3b1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateMainMeterParams

type CreateMainMeterParams struct {
	MeterID string
	Energy  Energy
	Address string
	FkUser  int32
}

type CreateMainMeterReadingParams

type CreateMainMeterReadingParams struct {
	FkMainMeter  int32
	ReadingValue float64
	ReadingDate  pgtype.Date
}

type CreateSubMeterParams

type CreateSubMeterParams struct {
	FkMainMeter int32
	MeterID     pgtype.Text
	FkUser      int32
}

type CreateSubMeterReadingParams

type CreateSubMeterReadingParams struct {
	FkSubMeter   int32
	ReadingValue float64
	ReadingDate  pgtype.Date
}

type CreateUserParams

type CreateUserParams struct {
	Username string
	Email    string
	Crypt    string
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type Energy

type Energy string
const (
	EnergyElectricity Energy = "electricity"
	EnergyGas         Energy = "gas"
	EnergyWater       Energy = "water"
)

func (*Energy) Scan

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

func (Energy) Valid

func (e Energy) Valid() bool

type GetMainMeterRow

type GetMainMeterRow struct {
	ID      int32
	MeterID string
	Energy  Energy
	Address string
	FkUser  int32
	Email   string
}

type GetSubMeterParams

type GetSubMeterParams struct {
	FkMainMeter int32
	Subid       int32
}

type GetSubMeterRow

type GetSubMeterRow struct {
	ID            int32
	MainMeterID   int32
	Subid         int32
	SubMeterID    pgtype.Text
	SubUserID     int32
	SubUserEmail  string
	Address       string
	MainUserID    int32
	MainUserEmail string
}

type GetUserParams

type GetUserParams struct {
	Username string
	Crypt    string
}

type ListSubMetersRow

type ListSubMetersRow struct {
	Subid   int32
	MeterID pgtype.Text
	Email   string
}

type MainMeter

type MainMeter struct {
	ID      int32
	MeterID string
	Energy  Energy
	Address string
	FkUser  int32
}

type MainMeterReading

type MainMeterReading struct {
	ID           int32
	FkMainMeter  int32
	Subid        int32
	ReadingValue float64
	ReadingDate  pgtype.Date
}

type NullEnergy

type NullEnergy struct {
	Energy Energy
	Valid  bool // Valid is true if Energy is not NULL
}

func (*NullEnergy) Scan

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

Scan implements the Scanner interface.

func (NullEnergy) Value

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

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) CreateMainMeter

func (q *Queries) CreateMainMeter(ctx context.Context, arg CreateMainMeterParams) (MainMeter, error)

func (*Queries) CreateMainMeterReading

func (q *Queries) CreateMainMeterReading(ctx context.Context, arg CreateMainMeterReadingParams) (MainMeterReading, error)

func (*Queries) CreateSubMeter

func (q *Queries) CreateSubMeter(ctx context.Context, arg CreateSubMeterParams) (SubMeter, error)

func (*Queries) CreateSubMeterReading

func (q *Queries) CreateSubMeterReading(ctx context.Context, arg CreateSubMeterReadingParams) (SubMeterReading, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (SpinusUser, error)

func (*Queries) DeleteMainMeter

func (q *Queries) DeleteMainMeter(ctx context.Context, id int32) error

func (*Queries) GetMainMeter

func (q *Queries) GetMainMeter(ctx context.Context, id int32) (GetMainMeterRow, error)

func (*Queries) GetSubMeter

func (q *Queries) GetSubMeter(ctx context.Context, arg GetSubMeterParams) (GetSubMeterRow, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, arg GetUserParams) (SpinusUser, error)

func (*Queries) GetUserByEmail

func (q *Queries) GetUserByEmail(ctx context.Context, email string) (int32, error)

func (*Queries) GetUserByUsername

func (q *Queries) GetUserByUsername(ctx context.Context, username string) (int32, error)

func (*Queries) ListMainMeterReadings

func (q *Queries) ListMainMeterReadings(ctx context.Context, fkMainMeter int32) ([]MainMeterReading, error)

func (*Queries) ListMainMeters

func (q *Queries) ListMainMeters(ctx context.Context, fkUser int32) ([]MainMeter, error)

func (*Queries) ListSubMeterReadings

func (q *Queries) ListSubMeterReadings(ctx context.Context, fkSubMeter int32) ([]SubMeterReading, error)

func (*Queries) ListSubMeters

func (q *Queries) ListSubMeters(ctx context.Context, fkMainMeter int32) ([]ListSubMetersRow, error)

func (*Queries) UpdateMainMeter

func (q *Queries) UpdateMainMeter(ctx context.Context, arg UpdateMainMeterParams) error

func (*Queries) WithTx

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

type SpinusUser

type SpinusUser struct {
	ID       int32
	Username string
	Email    string
	Password string
}

type SubMeter

type SubMeter struct {
	ID          int32
	FkMainMeter int32
	Subid       int32
	MeterID     pgtype.Text
	FkUser      int32
}

type SubMeterReading

type SubMeterReading struct {
	ID           int32
	FkSubMeter   int32
	Subid        int32
	ReadingValue float64
	ReadingDate  pgtype.Date
}

type UpdateMainMeterParams

type UpdateMainMeterParams struct {
	ID      int32
	MeterID string
	Energy  Energy
	Address string
	FkUser  int32
}

Jump to

Keyboard shortcuts

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