Documentation
¶
Index ¶
Constants ¶
const ( Table_ColorProfile = "color_profile" Table_LedStrip = "ledstrip" )
Variables ¶
This section is empty.
Functions ¶
func EventTypeStrings ¶
func EventTypeStrings() []string
EventTypeStrings returns a slice of all String values of the enum
Types ¶
type BaseModel ¶
type BaseModel struct {
ID int64 `json:"id,omitempty" gorm:"primary_key" csv:"id"`
}
func (*BaseModel) GenerateID ¶
func (b *BaseModel) GenerateID()
GenerateID generates an ID between 0 and 500
func (*BaseModel) GetStringID ¶
type ColorProfile ¶
type ColorProfile struct { BaseModel Blue null.Int `json:"blue,omitempty" csv:"blue"` Brightness null.Int `json:"brightness,omitempty" csv:"brightness"` Green null.Int `json:"green,omitempty" csv:"green"` Red null.Int `json:"red,omitempty" csv:"red"` }
ColorProfile The ColorProfile which reflects color and brightness
func (ColorProfile) TableName ¶
func (ColorProfile) TableName() string
TableName sets the table name for the color profile
type EventType ¶
type EventType int
func EventTypeString ¶
EventTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func EventTypeValues ¶
func EventTypeValues() []EventType
EventTypeValues returns all values of the enum
func (EventType) IsAEventType ¶
IsAEventType returns "true" if the value is listed in the enum definition. "false" otherwise
func (EventType) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for EventType
func (EventType) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for EventType
func (*EventType) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for EventType
func (*EventType) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for EventType
type LedStrip ¶
type LedStrip struct { BaseModel Name string `json:"name,omitempty" csv:"name"` Description string `json:"description,omitempty" csv:"description"` Enabled bool `json:"enabled,omitempty" csv:"enabled"` MisoPin null.Int `json:"misoPin,omitempty" gorm:"column:miso_pin" csv:"miso_pin"` NumLeds null.Int `json:"numLeds,omitempty" gorm:"column:num_leds" csv:"num_leds"` SclkPin null.Int `json:"sclkPin,omitempty" gorm:"column:sclk_pin" csv:"sclk_pin"` SpeedHz null.Int `json:"speedHz,omitempty" gorm:"column:speed_hz" csv:"speed_hz"` ProfileID null.Int `json:"profileId,omitempty" gorm:"column:profile_id" csv:"profile_id"` }
LedStrip definition of a LED strip and its configuration
type OptProfile ¶
type OptProfile struct { Profile ColorProfile Valid bool }
OptProfile Optional Profile
func (OptProfile) MarshalJSON ¶
func (profile OptProfile) MarshalJSON() (data []byte, err error)
MarshalJSON marshals json for OptProfile
type OptStrip ¶
type OptStrip struct { Valid bool Strip struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` Enabled bool `json:"enabled,omitempty"` MisoPin int64 `json:"misoPin,omitempty"` SclkPin int64 `json:"sclkPin,omitempty"` NumLeds int64 `json:"numLeds,omitempty"` SpeedHz int64 `json:"speedHz,omitempty"` Profile OptProfile `json:"profile,omitempty"` } }
OptStrip Optional Strip
func (OptStrip) MarshalJSON ¶
MarshalJSON marshals json for OptProfile
func (*OptStrip) With ¶
func (pe *OptStrip) With(profile ColorProfile) *OptStrip
type ProfileEvent ¶
type ProfileEvent struct { Type EventType `json:"type,omitempty"` ID null.Int `json:"id,omitempty"` State OptProfile `json:"state,omitempty"` }
ProfileEvent a StripEvent
func NewProfileEvent ¶
func NewProfileEvent(id null.Int, typ EventType) *ProfileEvent
func (*ProfileEvent) With ¶
func (pe *ProfileEvent) With(profile ColorProfile) *ProfileEvent
type StripEvent ¶
type StripEvent struct { Type EventType `json:"type,omitempty"` ID null.Int `json:"id,omitempty"` Strip OptStrip `json:"state,omitempty"` }
StripEvent a StripEvent
func NewStripEvent ¶
func NewStripEvent(id null.Int, typ EventType) *StripEvent
func (*StripEvent) With ¶
func (pe *StripEvent) With(strip *LedStrip) *StripEvent