models

package
v0.0.0-...-1bee8d1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	gorm.Model
	DiaryEntryID uint
	Comment      string             `gorm:"type:text" valid:"required"`
	Author       authorization.User `valid:"-"`
	AuthorID     uint
}

func (*Comment) AfterFind

func (c *Comment) AfterFind() error

type DataEntry

type DataEntry struct {
	Time      time.Time `json:"time.Time"`
	Latitude  Float     `json:"lat"`
	Longitude Float     `json:"lon"`
	Elevation Float     `json:"elevation"`
	Distance  Float     `json:"dist"`
}

type DiaryEntry

type DiaryEntry struct {
	gorm.Model
	Title      string             `valid:"required"`
	Text       string             `gorm:"type:text" valid:"required"`
	Author     authorization.User `valid:"-"`
	AuthorID   uint               `valid:"required"`
	Comments   []Comment          `valid:"-"`
	MapEntry   MapEntry           `valid:"-"`
	MapEntryID uint
	Images     []files.Image `gorm:"many2many:diary_image"`
	Published  bool

	NumComments uint `gorm:"-"`
	Viewed      bool `gorm:"-"`
	NewComments bool `gorm:"-"`
}

func (*DiaryEntry) AfterFind

func (de *DiaryEntry) AfterFind() error

TODO: handle timezone nicer

type EntryUserRead

type EntryUserRead struct {
	gorm.Model
	DiaryEntryID uint
	UserID       uint
}

type Float

type Float float64

Old data in db sometimes has strings instead of floats, this accepts string when json unmarshaling

func (*Float) UnmarshalJSON

func (f *Float) UnmarshalJSON(data []byte) error

type GpsData

type GpsData struct {
	gorm.Model
	Start     string
	End       string
	Date      time.Time
	Length    float64
	Duration  float64
	AvgSpeed  float64
	WorkoutID string `gorm:"column:endomondo_id"`
	Data      string `gorm:"type:text"`
	MapURL    string
}

func (GpsData) OptimizedData

func (g GpsData) OptimizedData() (string, error)

type MapEntry

type MapEntry struct {
	gorm.Model
	City        string
	Description string
	MapGroup    MapGroup
	MapGroupID  uint
	Lon         float64
	Lat         float64
	GpsData     GpsData
	GpsDataID   uint

	DiaryEntry *DiaryEntry
}

func (*MapEntry) BeforeSave

func (me *MapEntry) BeforeSave() error

type MapGroup

type MapGroup struct {
	gorm.Model
	Name  string
	Color string

	Entries []MapEntry
}

type Workout

type Workout struct {
	ID          string
	Description string
}

Jump to

Keyboard shortcuts

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