model

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypePieChart        DashboardType = "piechart"
	TypeBarChart        DashboardType = "barchart"
	TypeLineChart       DashboardType = "linechart"
	HorizontalTable     DashboardType = "horizontaltable"
	VerticalTable       DashboardType = "verticaltable"
	TypeStackedBarChart DashboardType = "stackedbarchart"

	IntervalHourly  Interval = "hourly"
	IntervalDaily   Interval = "daily"
	IntervalWeekly  Interval = "weekly"
	IntervalMonthly Interval = "monthly"
	IntervalYearly  Interval = "yearly"
	IntervalSingle  Interval = "single"

	NoRangeIDDefined = -1
)

No lint errors please.

View Source
const (
	ThemeGruvboxDark   = "GruvboxDark"
	ThemeGruvboxLight  = "GruvboxLight"
	ThemeMaterialDark  = "MaterialDark"
	ThemeMaterialLight = "MaterialLight"

	DateLocaleGerman      = "German"
	DateLocaleAmerican    = "American"
	DateLocaleAmerican24h = "American24h"
	DateLocaleBritish     = "British"
	DateLocaleAustralian  = "Australian"
)

Settings constants

Variables

This section is empty.

Functions

func All

func All() []interface{}

All returns all schema instances.

Types

type Dashboard

type Dashboard struct {
	ID      int `gorm:"primary_key;unique_index;AUTO_INCREMENT"`
	UserID  int `gorm:"type:int REFERENCES users(id) ON DELETE CASCADE"`
	Name    string
	Entries []DashboardEntry
	Ranges  []DashboardRange
}

Dashboard a dashboard

type DashboardEntry

type DashboardEntry struct {
	ID          int `gorm:"primary_key;unique_index;AUTO_INCREMENT"`
	DashboardID int `gorm:"type:int REFERENCES dashboards(id) ON DELETE CASCADE"`
	Title       string
	Total       bool `gorm:"default:false"`
	Type        DashboardType
	Keys        string
	Interval    Interval
	RangeID     int
	RangeFrom   string
	RangeTo     string

	MobilePosition  string
	DesktopPosition string
}

DashboardEntry an entry which represents a diagram in a dashboard.

type DashboardRange

type DashboardRange struct {
	ID          int `gorm:"primary_key;unique_index;AUTO_INCREMENT"`
	Name        string
	DashboardID int `gorm:"type:int REFERENCES dashboards(id) ON DELETE CASCADE"`
	Editable    bool
	From        string
	To          string
}

DashboardRange a named range of a dashboard.

type DashboardType

type DashboardType string

DashboardType the dashboard type

func (*DashboardType) Scan

func (t *DashboardType) Scan(value interface{}) error

Scan for db

func (DashboardType) Value

func (t DashboardType) Value() (driver.Value, error)

Value for db

type Device

type Device struct {
	ID        int    `gorm:"primary_key;unique_index;AUTO_INCREMENT"`
	Token     string `gorm:"unique"`
	Name      string
	UserID    int `gorm:"type:int REFERENCES users(id) ON DELETE CASCADE"`
	CreatedAt time.Time
	Type      DeviceType
	ActiveAt  time.Time
}

Device represents something which can connect to traggo

type DeviceType

type DeviceType string

DeviceType the device type

const (
	TypeShortExpiry DeviceType = "ShortExpiry"
	TypeLongExpiry  DeviceType = "LongExpiry"
	TypeNoExpiry    DeviceType = "NoExpiry"
)

Device types

func (*DeviceType) Scan

func (t *DeviceType) Scan(value interface{}) error

Scan for db

func (DeviceType) Seconds

func (t DeviceType) Seconds() int

Seconds returns the amount of seconds after the device expires.

func (DeviceType) Valid

func (t DeviceType) Valid() error

Valid checks if the device type is valid.

func (DeviceType) Value

func (t DeviceType) Value() (driver.Value, error)

Value for db

type Interval

type Interval string

Interval the interval in which the diagram data should be grouped.

func (*Interval) Scan

func (t *Interval) Scan(value interface{}) error

Scan for db

func (Interval) Value

func (t Interval) Value() (driver.Value, error)

Value for db

type TagDefinition

type TagDefinition struct {
	Key    string
	UserID int `gorm:"type:int REFERENCES users(id) ON DELETE CASCADE"`
	Color  string
	Usages int `gorm:"-"`
}

TagDefinition describes a tag.

type Time

type Time time.Time

Time scalar type for graphql

func (Time) MarshalGQL

func (t Time) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface

func (Time) OmitTimeZone

func (t Time) OmitTimeZone() time.Time

OmitTimeZone omits the time zone and removes a utc date.

func (Time) Time

func (t Time) Time() time.Time

Time returns the wrapped time

func (Time) UTC

func (t Time) UTC() time.Time

UTC changes the timezone to utc.

func (*Time) UnmarshalGQL

func (t *Time) UnmarshalGQL(v interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface

type TimeSpan

type TimeSpan struct {
	ID            int `gorm:"primary_key;unique_index;AUTO_INCREMENT"`
	StartUTC      time.Time
	EndUTC        *time.Time
	StartUserTime time.Time
	EndUserTime   *time.Time
	OffsetUTC     int
	UserID        int `gorm:"type:int REFERENCES users(id) ON DELETE CASCADE"`
	Tags          []TimeSpanTag
	Note          string
}

TimeSpan is basically a tagged time range.

type TimeSpanTag

type TimeSpanTag struct {
	TimeSpanID  int `gorm:"type:int REFERENCES time_spans(id) ON DELETE CASCADE"`
	Key         string
	StringValue string
}

TimeSpanTag is a tag for a time range

type User

type User struct {
	ID    int    `gorm:"primary_key;unique_index;AUTO_INCREMENT"`
	Name  string `gorm:"unique"`
	Pass  []byte
	Admin bool
}

User holds information about credentials and authorizations.

type UserSetting

type UserSetting struct {
	UserID            int `gorm:"primary_key;unique_index"`
	Theme             string
	DateLocale        string
	FirstDayOfTheWeek string
}

UserSetting a setting for a user.

func (UserSetting) FirstDayOfTheWeekTimeWeekday

func (s UserSetting) FirstDayOfTheWeekTimeWeekday() time.Weekday

FirstDayOfTheWeekTimeWeekday returns the configured first day of the week.

func (UserSetting) LastDayOfTheWeekTimeWeekday

func (s UserSetting) LastDayOfTheWeekTimeWeekday() time.Weekday

LastDayOfTheWeekTimeWeekday returns the configured last day of the week.

type Version

type Version struct {
	Commit    string
	Name      string
	BuildDate string
}

The Version of traggo.

Jump to

Keyboard shortcuts

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