appbackend

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

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

Go to latest
Published: Aug 20, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSGLOverlays

func AddSGLOverlays(box Box, plant Plant, meta MetricsMeta, img *bytes.Buffer) (*bytes.Buffer, error)

func AddSGLOverlaysForFile

func AddSGLOverlaysForFile(box Box, plant Plant, meta MetricsMeta, file string) error

func DownloadFile

func DownloadFile(url, dst string) error

func GETSGLObject

func GETSGLObject(token, url string, obj interface{}) error

func POSTSGLObject

func POSTSGLObject(token, url string, obj interface{}, respObj interface{}) error

func UploadSGLObject

func UploadSGLObject(url string, obj io.Reader, length int64) error

func UploadSGLObjectFile

func UploadSGLObjectFile(url, file string) error

Types

type Box

type Box struct {
	ID        uuid.NullUUID `db:"id,omitempty" json:"id"`
	UserID    uuid.UUID     `db:"userid" json:"userID"`
	DeviceID  uuid.NullUUID `db:"deviceid" json:"deviceID"`
	DeviceBox *uint         `db:"devicebox,omitempty" json:"deviceBox,omitempty"`
	FeedID    uuid.NullUUID `db:"feedid" json:"feedID"`
	Name      string        `db:"name" json:"name"`

	Settings string `db:"settings" json:"settings"`

	Deleted bool `db:"deleted" json:"deleted"`

	CreatedAt time.Time `db:"cat,omitempty" json:"cat"`
	UpdatedAt time.Time `db:"uat,omitempty" json:"uat"`
}

Box -

func (Box) GetID

func (o Box) GetID() uuid.NullUUID

GetID -

func (Box) GetUserID

func (o Box) GetUserID() uuid.UUID

GetUserID -

func (*Box) SetUserID

func (o *Box) SetUserID(userID uuid.UUID)

SetUserID -

type Boxes

type Boxes []Box

Boxes -

func (Boxes) Each

func (os Boxes) Each(fn func(Object))

Each -

type Device

type Device struct {
	ID         uuid.NullUUID `db:"id,omitempty" json:"id"`
	UserID     uuid.UUID     `db:"userid" json:"userID"`
	Identifier string        `db:"identifier" json:"identifier"`
	Name       string        `db:"name" json:"name"`
	IP         string        `db:"ip" json:"ip"`
	Mdns       string        `db:"mdns" json:"mdns"`

	Deleted bool `db:"deleted" json:"deleted"`

	CreatedAt time.Time `db:"cat,omitempty" json:"cat"`
	UpdatedAt time.Time `db:"uat,omitempty" json:"uat"`
}

Device -

func (Device) GetID

func (o Device) GetID() uuid.NullUUID

GetID -

func (Device) GetUserID

func (o Device) GetUserID() uuid.UUID

GetUserID -

func (*Device) SetUserID

func (o *Device) SetUserID(userID uuid.UUID)

SetUserID -

type Devices

type Devices []Device

Devices -

func (Devices) Each

func (os Devices) Each(fn func(Object))

Each -

type Feed

type Feed struct {
	ID         uuid.NullUUID `db:"id,omitempty" json:"id"`
	UserID     uuid.UUID     `db:"userid" json:"userID"`
	Name       string        `db:"name" json:"name"`
	IsNewsFeed bool          `db:"isnewsfeed" json:"isNewsFeed"`

	Deleted bool `db:"deleted" json:"deleted"`

	CreatedAt time.Time `db:"cat,omitempty" json:"cat"`
	UpdatedAt time.Time `db:"uat,omitempty" json:"uat"`
}

Feed -

func (Feed) GetID

func (o Feed) GetID() uuid.NullUUID

GetID -

func (Feed) GetUserID

func (o Feed) GetUserID() uuid.UUID

GetUserID -

func (*Feed) SetUserID

func (o *Feed) SetUserID(userID uuid.UUID)

SetUserID -

type FeedEntries

type FeedEntries []FeedEntry

FeedEntries -

func (FeedEntries) Each

func (os FeedEntries) Each(fn func(Object))

Each -

type FeedEntry

type FeedEntry struct {
	ID     uuid.NullUUID `db:"id,omitempty" json:"id"`
	UserID uuid.UUID     `db:"userid" json:"userID"`
	FeedID uuid.UUID     `db:"feedid" json:"feedID"`
	Date   time.Time     `db:"createdat" json:"date"`
	Type   string        `db:"etype" json:"type"`

	Params string      `db:"params" json:"params"`
	Meta   null.String `db:"meta,omitempty" json:"meta,omitempty"`

	Deleted bool `db:"deleted" json:"deleted"`

	CreatedAt time.Time `db:"cat,omitempty" json:"cat"`
	UpdatedAt time.Time `db:"uat,omitempty" json:"uat"`
}

FeedEntry -

func (FeedEntry) GetID

func (o FeedEntry) GetID() uuid.NullUUID

GetID -

func (FeedEntry) GetUserID

func (o FeedEntry) GetUserID() uuid.UUID

GetUserID -

func (*FeedEntry) SetUserID

func (o *FeedEntry) SetUserID(userID uuid.UUID)

SetUserID -

type FeedEntryMeta

type FeedEntryMeta struct {
	MetricsMeta
}

type FeedMedia

type FeedMedia struct {
	ID            uuid.NullUUID `db:"id,omitempty" json:"id"`
	UserID        uuid.UUID     `db:"userid" json:"userID"`
	FeedEntryID   uuid.UUID     `db:"feedentryid" json:"feedEntryID"`
	FilePath      string        `db:"filepath" json:"filePath"`
	ThumbnailPath string        `db:"thumbnailpath" json:"thumbnailPath"`

	Params string `db:"params" json:"params"`

	Deleted bool `db:"deleted" json:"deleted"`

	CreatedAt time.Time `db:"cat,omitempty" json:"cat"`
	UpdatedAt time.Time `db:"uat,omitempty" json:"uat"`
}

FeedMedia -

func (FeedMedia) GetID

func (o FeedMedia) GetID() uuid.NullUUID

GetID -

func (FeedMedia) GetUserID

func (o FeedMedia) GetUserID() uuid.UUID

GetUserID -

func (*FeedMedia) SetUserID

func (o *FeedMedia) SetUserID(userID uuid.UUID)

SetUserID -

type FeedMedias

type FeedMedias []FeedMedia

FeedMedias -

func (FeedMedias) Each

func (os FeedMedias) Each(fn func(Object))

Each -

type Feeds

type Feeds []Feed

Feeds -

func (Feeds) Each

func (os Feeds) Each(fn func(Object))

Each -

type GetLedBox

type GetLedBox func(i int) (int, error)

type MetricsLoader

type MetricsLoader func(device Device, from, to time.Time, module, metric string, i int) (TimeSeries, error)

type MetricsMeta

type MetricsMeta struct {
	Date        time.Time     `json:"date"`
	Temperature *TimeSeries   `json:"temperature,omitempty"`
	Humidity    *TimeSeries   `json:"humidity,omitempty"`
	VPD         *TimeSeries   `json:"vpd,omitempty"`
	Timer       *TimeSeries   `json:"timer,omitempty"`
	Dimming     *[]TimeSeries `json:"dimming,omitempty"`
	Ventilation *TimeSeries   `json:"ventilation,omitempty"`
}

func LoadMetricsMeta

func LoadMetricsMeta(device Device, box Box, from, to time.Time, loader MetricsLoader, getLedBox GetLedBox) MetricsMeta

type Object

type Object interface {
	GetID() uuid.NullUUID
}

Object -

type Objects

type Objects interface {
	Each(func(Object))
}

Objects -

type Plant

type Plant struct {
	ID            uuid.NullUUID `db:"id,omitempty" json:"id"`
	UserID        uuid.UUID     `db:"userid" json:"userID"`
	BoxID         uuid.UUID     `db:"boxid" json:"boxID"`
	FeedID        uuid.UUID     `db:"feedid" json:"feedID"`
	Name          string        `db:"name" json:"name"`
	Single        bool          `db:"single" json:"single"` // TODO remove this field
	Public        bool          `db:"is_public" json:"public"`
	AlertsEnabled bool          `db:"alerts_enabled" json:"alertsEnabled"`

	Settings string `db:"settings" json:"settings"`

	Deleted  bool `db:"deleted" json:"deleted"`
	Archived bool `db:"archived" json:"archived"`

	CreatedAt time.Time `db:"cat,omitempty" json:"cat"`
	UpdatedAt time.Time `db:"uat,omitempty" json:"uat"`
}

Plant -

func (Plant) GetID

func (o Plant) GetID() uuid.NullUUID

GetID -

func (Plant) GetUserID

func (o Plant) GetUserID() uuid.UUID

GetUserID -

func (*Plant) SetUserID

func (o *Plant) SetUserID(userID uuid.UUID)

SetUserID -

type Plants

type Plants []Plant

Plants -

func (Plants) Each

func (os Plants) Each(fn func(Object))

Each -

type S3FileHolder

type S3FileHolder interface {
	SetURLs(paths []string)
	GetURLs() (paths []S3Path)
}

type S3FileHolders

type S3FileHolders interface {
	AsFeedMediasArray() []S3FileHolder
}

type S3Path

type S3Path struct {
	Path   *string
	Bucket string
}

type TimeSeries

type TimeSeries [][]float64

func LoadGraphValue

func LoadGraphValue(device Device, from, to time.Time, module, metric string, i int) (TimeSeries, error)

type Timelapse

type Timelapse struct {
	ID      uuid.NullUUID `db:"id,omitempty" json:"id"`
	UserID  uuid.UUID     `db:"userid" json:"userID"`
	PlantID uuid.UUID     `db:"plantid" json:"plantID"`

	Name     string `db:"name" json:"name"`
	Type     string `db:"ttype" json:"type"`
	Settings string `db:"settings" json:"settings"`

	Deleted bool `db:"deleted" json:"deleted"`

	CreatedAt time.Time `db:"cat,omitempty" json:"cat"`
	UpdatedAt time.Time `db:"uat,omitempty" json:"uat"`
}

Timelapse -

func (Timelapse) GetID

func (o Timelapse) GetID() uuid.NullUUID

GetID -

func (Timelapse) GetUserID

func (o Timelapse) GetUserID() uuid.UUID

GetUserID -

func (*Timelapse) SetUserID

func (o *Timelapse) SetUserID(userID uuid.UUID)

SetUserID -

type TimelapseFrame

type TimelapseFrame struct {
	ID          uuid.NullUUID `db:"id,omitempty" json:"id"`
	UserID      uuid.UUID     `db:"userid" json:"userID"`
	TimelapseID uuid.UUID     `db:"timelapseid" json:"timelapseID"`

	FilePath string `db:"filepath" json:"filePath"`
	Meta     string `db:"meta" json:"meta"`

	CreatedAt time.Time `db:"cat,omitempty" json:"cat"`
	UpdatedAt time.Time `db:"uat,omitempty" json:"uat"`
}

TimelapseFrame -

func (TimelapseFrame) GetID

func (o TimelapseFrame) GetID() uuid.NullUUID

GetID -

func (TimelapseFrame) GetURLs

func (r TimelapseFrame) GetURLs() []S3Path

func (TimelapseFrame) GetUserID

func (o TimelapseFrame) GetUserID() uuid.UUID

GetUserID -

func (*TimelapseFrame) SetURLs

func (r *TimelapseFrame) SetURLs(paths []string)

func (*TimelapseFrame) SetUserID

func (o *TimelapseFrame) SetUserID(userID uuid.UUID)

SetUserID -

type TimelapseFrameMeta

type TimelapseFrameMeta struct {
	MetricsMeta
}

type TimelapseFrames

type TimelapseFrames []TimelapseFrame

TimelapseFrames -

func (TimelapseFrames) Each

func (os TimelapseFrames) Each(fn func(Object))

Each -

type Timelapses

type Timelapses []Timelapse

Timelapses -

func (Timelapses) Each

func (os Timelapses) Each(fn func(Object))

Each -

type UserObject

type UserObject interface {
	Object
	SetUserID(uuid.UUID)
	GetUserID() uuid.UUID
}

UserObject -

Jump to

Keyboard shortcuts

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