Documentation ¶
Overview ¶
Package database provides our database.
Index ¶
- func SetLogger(l *zap.SugaredLogger)
- type Sqlite
- func (sl *Sqlite) AddAction(a models.Action) (int, error)
- func (sl *Sqlite) AddDevice(d models.Device) (insertID int)
- func (sl *Sqlite) AddGroup(g models.Group) (int, error)
- func (sl *Sqlite) AddScene(s models.Scene) (int, error)
- func (sl *Sqlite) AddShow(s models.Show) (int, error)
- func (sl *Sqlite) AddShowCycle(c models.Cycle) (int, error)
- func (sl *Sqlite) DeleteAction(actionID int) error
- func (sl *Sqlite) DeleteDevice(deviceID int)
- func (sl *Sqlite) DeleteGroup(groupID int) error
- func (sl *Sqlite) DeleteScene(sceneID int) error
- func (sl *Sqlite) DeleteShow(showID int) error
- func (sl *Sqlite) DeleteShowCycle(cycleID int) error
- func (sl *Sqlite) Disconnect()
- func (sl *Sqlite) GetAction(actionID int) (models.Action, error)
- func (sl *Sqlite) GetActionOrderNext(groupID int) (int, error)
- func (sl *Sqlite) GetActions(groupID int) ([]models.Action, error)
- func (sl *Sqlite) GetDevice(deviceID int) models.Device
- func (sl *Sqlite) GetDeviceType(deviceID int) models.DeviceType
- func (sl *Sqlite) GetDeviceTypes() []models.DeviceType
- func (sl *Sqlite) GetDevices() []models.Device
- func (sl *Sqlite) GetDevicesWithActionSelected(actionID int) []models.Device
- func (sl *Sqlite) GetDevicesWithSceneSelected(sceneID int) ([]models.Device, error)
- func (sl *Sqlite) GetGroup(groupID int) (models.Group, error)
- func (sl *Sqlite) GetGroupOrderNext(sceneID int) (int, error)
- func (sl *Sqlite) GetGroups(sceneID int) ([]models.Group, error)
- func (sl *Sqlite) GetScene(sceneID int) (models.Scene, error)
- func (sl *Sqlite) GetScenes() ([]models.Scene, error)
- func (sl *Sqlite) GetShow(showID int) (models.Show, error)
- func (sl *Sqlite) GetShowByTopic(topic string) (models.Show, error)
- func (sl *Sqlite) GetShowCycle(cycleID int) (models.Cycle, error)
- func (sl *Sqlite) GetShowCycles(showID int) ([]models.Cycle, error)
- func (sl *Sqlite) GetShows() ([]models.Show, error)
- func (sl *Sqlite) InitializeClient()
- func (sl *Sqlite) ReturnDevicesWithActionSelected(action models.Action, devices []models.Device) []models.Device
- func (sl *Sqlite) SetAction(a models.Action) error
- func (sl *Sqlite) SetDevice(d models.Device)
- func (sl *Sqlite) SetDeviceTypes(t []models.DeviceType)
- func (sl *Sqlite) SetGroup(g models.Group) error
- func (sl *Sqlite) SetScene(s models.Scene) error
- func (sl *Sqlite) SetShow(s models.Show) error
- func (sl *Sqlite) SetShowCycle(c models.Cycle) error
- func (sl *Sqlite) SortAction(groupID int, actionID int, sortID int) error
- func (sl *Sqlite) SortGroup(sceneID int, groupID int, sortID int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Sqlite ¶
type Sqlite struct {
// contains filtered or unexported fields
}
Sqlite struct to represent a class.
func NewSqlite ¶
func NewSqlite(dt devicetypes.DeviceTypes) *Sqlite
NewSqlite method to instantiate class/struct.
func (*Sqlite) AddShowCycle ¶
AddShowCycle to db.
func (*Sqlite) DeleteAction ¶
DeleteAction function.
func (*Sqlite) DeleteScene ¶
DeleteScene to delete a Scene.
func (*Sqlite) DeleteShowCycle ¶
DeleteShowCycle function.
func (*Sqlite) GetActionOrderNext ¶
GetActionOrderNext to get the next order value.
func (*Sqlite) GetActions ¶
GetActions to return a slice of Action structs.
func (*Sqlite) GetDeviceType ¶
func (sl *Sqlite) GetDeviceType(deviceID int) models.DeviceType
GetDeviceType to return a single DeviceType struct.
func (*Sqlite) GetDeviceTypes ¶
func (sl *Sqlite) GetDeviceTypes() []models.DeviceType
GetDeviceTypes to return a slice of DeviceType structs.
func (*Sqlite) GetDevices ¶
GetDevices to return a slice of Device structs.
func (*Sqlite) GetDevicesWithActionSelected ¶
GetDevicesWithActionSelected to return a slice of Device structs with select flags set.
func (*Sqlite) GetDevicesWithSceneSelected ¶
GetDevicesWithSceneSelected to return a slice of Device structs with select flags set.
func (*Sqlite) GetGroupOrderNext ¶
GetGroupOrderNext to get the next order value.
func (*Sqlite) GetShowByTopic ¶
GetShowByTopic to return a single Show struct.
func (*Sqlite) GetShowCycle ¶
GetShowCycle to return a single Show struct.
func (*Sqlite) GetShowCycles ¶
GetShowCycles to return a slice of Cycle structs.
func (*Sqlite) InitializeClient ¶
func (sl *Sqlite) InitializeClient()
InitializeClient is a replacement for init() because we need to set log variable first.
func (*Sqlite) ReturnDevicesWithActionSelected ¶
func (sl *Sqlite) ReturnDevicesWithActionSelected(action models.Action, devices []models.Device) []models.Device
ReturnDevicesWithActionSelected to return a slice of Device structs with select flags set.
func (*Sqlite) SetDeviceTypes ¶
func (sl *Sqlite) SetDeviceTypes(t []models.DeviceType)
SetDeviceTypes to set deviceTypes in db instance.
func (*Sqlite) SetShowCycle ¶
SetShowCycle to update a Cycle.
func (*Sqlite) SortAction ¶
SortAction function.