model

package
v0.0.0-...-055cc3d Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	gorm.Model
	AlertName       string    `gorm:"type:varchar(100);not null" json:"alert_name"`
	UserID          uint      `gorm:"not null" json:"user_id"`
	DeviceID        uint      `gorm:"not null" json:"device_id"`
	SoilMoistureMin float64   `gorm:"not null" json:"soil_moisture_min"`
	SoilMoistureMax float64   `gorm:"not null" json:"soil_moisture_max"`
	TemperatureMin  float64   `gorm:"not null" json:"temperature_min"`
	TemperatureMax  float64   `gorm:"not null" json:"temperature_max"`
	LastSentAt      time.Time `json:"last_sent_at"`
}

type Device

type Device struct {
	gorm.Model
	Name            string `gorm:"not null"`
	RecentlySeenAt  *time.Time
	Token           string `gorm:"not null"`
	ReadingInterval int    `gorm:"not null"`
	PushInterval    int    `gorm:"not null"`
}

type Ownership

type Ownership struct {
	gorm.Model
	UserID   uint
	DeviceID uint
	Role     OwnershipRole
	User     *User `gorm:"-"`
}

type OwnershipRole

type OwnershipRole int
const (
	OwnershipRoleOwner OwnershipRole = iota
	OwnershipRoleMember
)

type Phone

type Phone struct {
	gorm.Model
	UserID            uint
	FirebasePushID    string
	FirebasePushToken string
}

type Reading

type Reading struct {
	gorm.Model
	DeviceID   uint
	Value      float64 `json:"value"`
	Type       string  `json:"type"`
	MeasuredAt time.Time
	UploadedAt time.Time
}

func (Reading) Protobuf

func (r Reading) Protobuf() *gen.Reading

type User

type User struct {
	gorm.Model
	Email    string `gorm:"uniqueIndex;not null"`
	Password string `gorm:"not null"`
}

Jump to

Keyboard shortcuts

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