Documentation ¶
Index ¶
Constants ¶
View Source
const ( Lt = "<" Gt = ">" Le = "<=" Ge = ">=" )
View Source
const ( DefaultPasswordCost = 12 DefaultExpirationDelta = 30 * 24 * time.Hour )
View Source
const (
Email = "email"
)
Variables ¶
View Source
var ( True = true False = false )
Functions ¶
func CheckCondition ¶ added in v0.0.5
Types ¶
type Admin ¶ added in v0.0.5
type Admin struct { Model Username string `json:"username" gorm:"unique;not null;"` Password string `json:"password" gorm:"-"` PasswordHash []byte `json:"-" gorm:"not null;"` }
func RandomAdmin ¶ added in v0.0.5
func RandomAdmin() *Admin
func (*Admin) Authenticate ¶ added in v0.0.5
func (*Admin) FromClaims ¶ added in v0.0.5
type Alert ¶
type Alert struct { Model User User `json:"user" gorm:"foreignKey:UserUUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` UserUUID uuid.UUID `json:"userUUID" gorm:"uniqueIndex:idx_unique_alarm;not null;"` Name *string `json:"name" gorm:"uniqueIndex:idx_unique_alarm;not null;"` Sensor Sensor `json:"sensor" gorm:"foreignKey:SensorUUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` SensorUUID uuid.UUID `json:"sensorUUID" gorm:"not null;"` Condition *string `json:"condition" gorm:"not null;"` Value *float64 `json:"value" gorm:"not null;"` Enabled *bool `json:"enabled" gorm:"not null;default:FALSE"` }
func RandomAlert ¶
type Message ¶ added in v0.0.6
type Message struct { Model Type string `json:"type" gorm:"not null;"` Recipient string `json:"recipient" gorm:"not null;"` Subject string `json:"subject" gorm:"not null;"` Body string `json:"body" gorm:"not null;"` }
func RandomMessage ¶ added in v0.0.6
type Model ¶
type Sensor ¶
type Sensor struct { Model Station Station `json:"station" gorm:"foreignKey:StationUUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` StationUUID uuid.UUID `json:"stationUUID" gorm:"uniqueIndex:idx_unique_sensor;not null;"` Type string `json:"type" gorm:"uniqueIndex:idx_unique_sensor;not null;"` Registries []SensorRegistry `json:"registries" gorm:"constraint:OnDelete:CASCADE;"` }
func RandomSensor ¶
type SensorRegistry ¶
type Station ¶
type Station struct { Model User User `json:"user" gorm:"foreignKey:UserUUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` UserUUID uuid.UUID `json:"userUUID" gorm:"uniqueIndex:idx_unique_station;not null;"` Name *string `json:"name" gorm:"uniqueIndex:idx_unique_station;not null;"` Description *string `json:"description"` Country *countries.CountryCode `json:"country" gorm:"not null;"` Subdivision *countries.SubdivisionCode `json:"subdivision" gorm:"not null"` Latitude *float64 `json:"latitude" gorm:"not null;"` Longitude *float64 `json:"longitude" gorm:"not null;"` APIKey string `json:"-" gorm:"not null;"` APIKeyJSON *string `json:"apiKey" gorm:"-"` Sensors []Sensor `json:"sensors" gorm:"constraint:OnDelete:CASCADE;"` }
func RandomStation ¶
type User ¶
type User struct { Model Username string `json:"username" gorm:"unique;not null;"` Password string `json:"password" gorm:"-"` PasswordHash []byte `json:"-" gorm:"not null;"` Name *string `json:"name" gorm:"not null"` Phone *string `json:"phone" gorm:"unique;not null"` Email *string `json:"email" gorm:"unique;not null"` Confirmed *bool `json:"confirmed" gorm:"not null;default:FALSE;"` Alerts []Alert `json:"alerts" gorm:"constraint:OnDelete:CASCADE;"` Stations []Station `json:"stations" gorm:"constraint:OnDelete:CASCADE;"` }
func RandomUser ¶
func RandomUser() *User
func (*User) Authenticate ¶
func (*User) FromClaims ¶
Click to show internal directories.
Click to hide internal directories.