db

package
v0.0.0-...-9a80b0c Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDevice

func CreateDevice(db *sql.DB, device *Device) error

func CreateDeviceType

func CreateDeviceType(db *sql.DB, deviceType *DeviceType) error

func CreateFloorplanDevices

func CreateFloorplanDevices(db *sql.DB, floorplanDevice *FloorplanDevices) error

func CreateMotorhomeFloorplan

func CreateMotorhomeFloorplan(db *sql.DB, floorplan *MotorhomeFloorplan) error

func CreateMotorhomeModel

func CreateMotorhomeModel(db *sql.DB, model *MotorhomeModel) error

func CreateMotorhomeModelYear

func CreateMotorhomeModelYear(db *sql.DB, modelYear *MotorhomeModelYear) error

func CreateNewUser

func CreateNewUser(db *sql.DB, user *User) error

func CreateUserPreset

func CreateUserPreset(db *sql.DB, preset *UserPreset) error

func DeleteDevice

func DeleteDevice(db *sql.DB, id int) error

func DeleteDeviceType

func DeleteDeviceType(db *sql.DB, id int) error

func DeleteFloorplanDevices

func DeleteFloorplanDevices(db *sql.DB, id int) error

func DeleteMotorhomeFloorplan

func DeleteMotorhomeFloorplan(db *sql.DB, id int) error

func DeleteMotorhomeModel

func DeleteMotorhomeModel(db *sql.DB, id int) error

func DeleteMotorhomeModelYear

func DeleteMotorhomeModelYear(db *sql.DB, id int) error

func DeleteUser

func DeleteUser(db *sql.DB, id int) error

func GetSystemConfig

func GetSystemConfig(db *sql.DB, key string) (string, error)

func SaveRVCMessage

func SaveRVCMessage(db *sql.DB, message *rvc.Message) error

func SetCurrentMotorhomeConfig

func SetCurrentMotorhomeConfig(db *sql.DB, config *MotorhomeConfig) error

func SetSystemConfig

func SetSystemConfig(db *sql.DB, key, value string) error

func UpdateCurrentMotorhomeConfig

func UpdateCurrentMotorhomeConfig(db *sql.DB, config *MotorhomeConfig) error

func UpdateDevice

func UpdateDevice(db *sql.DB, device *Device) error

func UpdateDeviceType

func UpdateDeviceType(db *sql.DB, deviceType *DeviceType) error

func UpdateFloorplanDevices

func UpdateFloorplanDevices(db *sql.DB, floorplanDevice *FloorplanDevices) error

func UpdateMotorhomeFloorplan

func UpdateMotorhomeFloorplan(db *sql.DB, floorplan *MotorhomeFloorplan) error

func UpdateMotorhomeModel

func UpdateMotorhomeModel(db *sql.DB, model *MotorhomeModel) error

func UpdateMotorhomeModelYear

func UpdateMotorhomeModelYear(db *sql.DB, modelYear *MotorhomeModelYear) error

func UpdateUser

func UpdateUser(db *sql.DB, user *User) error

func UpdateUserPreset

func UpdateUserPreset(db *sql.DB, preset *UserPreset) error

Types

type DB

type DB struct {
	Conn *sql.DB
}

func Initialize

func Initialize() (*DB, error)

type Database

type Database struct {
	Conn *sql.DB
}

Rename the struct to avoid redeclaration

func (*Database) Close

func (db *Database) Close() error

Close closes the database connection

func (*Database) Exec

func (db *Database) Exec(query string, args ...interface{}) (sql.Result, error)

Exec executes a query without returning any rows

func (*Database) Query

func (db *Database) Query(query string, args ...interface{}) (*sql.Rows, error)

Query executes a query that returns rows

func (*Database) QueryRow

func (db *Database) QueryRow(query string, args ...interface{}) *sql.Row

QueryRow executes a query that is expected to return at most one row

type Device

type Device struct {
	ID          int
	Name        string
	Description string
	TypeID      int
}

func ReadDevices

func ReadDevices(db *sql.DB) ([]Device, error)

type DeviceType

type DeviceType struct {
	ID          int
	Name        string
	Description string
}

func ReadDeviceTypes

func ReadDeviceTypes(db *sql.DB) ([]DeviceType, error)

type FloorplanDevices

type FloorplanDevices struct {
	ID          int
	FloorplanID int
	DeviceID    int
}

func ReadFloorplanDevices

func ReadFloorplanDevices(db *sql.DB) ([]FloorplanDevices, error)

type Message

type Message struct {
	ID        int
	PGN       int
	Data      string
	Timestamp time.Time
}

type MotorhomeConfig

type MotorhomeConfig struct {
	ID          int
	ModelID     int
	ModelYearID int
	FloorplanID int
}

func ReadCurrentMotorhomeConfig

func ReadCurrentMotorhomeConfig(db *sql.DB) (*MotorhomeConfig, error)

type MotorhomeFloorplan

type MotorhomeFloorplan struct {
	ID          int
	ModelID     int
	Name        string
	Description string
	ImageURL    string
}

func ReadMotorhomeFloorplans

func ReadMotorhomeFloorplans(db *sql.DB) ([]MotorhomeFloorplan, error)

type MotorhomeModel

type MotorhomeModel struct {
	ID          int
	Name        string
	Description string
	ImageURL    string
}

func ReadMotorhomeModels

func ReadMotorhomeModels(db *sql.DB) ([]MotorhomeModel, error)

type MotorhomeModelYear

type MotorhomeModelYear struct {
	ID      int
	ModelID int
	Year    int
}

func ReadMotorhomeModelYears

func ReadMotorhomeModelYears(db *sql.DB) ([]MotorhomeModelYear, error)

type NotificationsConfig

type NotificationsConfig struct {
	ID        int
	PGN       int
	Data      string
	Timestamp time.Time
}

type RVCMessage

type RVCMessage struct {
	ID        int
	Message   string
	Timestamp time.Time
}

type SystemConfig

type SystemConfig struct {
	Key   string
	Value string
}

type User

type User struct {
	Username  string
	Email     string
	RoleID    int
	Phone     string
	PresetID  int
	Password  string
	ID        int
	CreatedAt time.Time
	UpdatedAt time.Time
	LastLogin time.Time
	Status    int
}

func ReadUser

func ReadUser(db *sql.DB, id int) (*User, error)

type UserPreset

type UserPreset struct {
	ID        int
	Name      string
	Data      string
	UserID    int
	CreatedAt time.Time
	UpdatedAt time.Time
}

func ReadUserPresets

func ReadUserPresets(db *sql.DB) ([]UserPreset, error)

Jump to

Keyboard shortcuts

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