model

package
v0.0.0-...-6690423 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppointmentItemType = "appointment"
	NoteItemType        = "note"
)

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) error

Types

type Alarm

type Alarm struct {
	Model
	Time uint `json:"time"`
}

type Appointment

type Appointment struct {
	Item
	Timezone          string             `json:"timezone"`
	Alarms            []AppointmentAlarm `json:"alarms"`
	SkipDefaultAlarms bool               `json:"skip_default_alarms"`

	// DeletedDates cannot be inherited since we need to use gorm's preloading
	// which does not support preloading on anonymous structs.
	DeletedDates []AppointmentDeletedDate `json:"deleted"`
}

func (*Appointment) AfterCreate

func (a *Appointment) AfterCreate(tx *gorm.DB) error

func (*Appointment) BeforeCreate

func (a *Appointment) BeforeCreate(tx *gorm.DB) error

func (*Appointment) Name

func (a *Appointment) Name() string

type AppointmentAlarm

type AppointmentAlarm struct {
	Alarm
	AppointmentID uint `json:"appointment_id"`
}

type AppointmentDeletedDate

type AppointmentDeletedDate struct {
	DeletedDate

	AppointmentID uint `json:"-"`
}

type Calendar

type Calendar struct {
	Model
	Name         string
	DeletedFor   uint // which calendar is this the deleted calendar for?
	Version      float64
	Appointments []Appointment
	Notes        []Note
	Options      CalendarOptions
	Hidden       bool
}

type CalendarOptions

type CalendarOptions struct {
	Model
	CalendarID uint

	DefaultEarlyWarning uint           // how many days in advance should an appointment be alerted by?
	DefaultAlarms       []DefaultAlarm // what alarms are defaults?
	DayviewTimeStart    uint           // when should the calendar view start from by default?
	DayviewTimeFinish   uint           // when should the calendar view finish by default?
	ItemWidth           uint           // how wide is an item (deprecated)
	NoticeHeight        uint           // how tall is a notice (deprecated)
	AmPm                bool           // display times in AM/PM?
	MondayFirst         bool           // show monday first?
	AllowOverflow       bool           // allow overflow? not sure. deprecated
	Visible             bool           // is the calendar visible
	IgnoreAlarms        bool           // ignore alarm notifications
	Color               string         // default color
	Timezone            string         // timezone of calendar (by default)
	SoftDelete          bool           // actually delete appointments or just move them to a different calendar?
}

func DefaultCalendarOptions

func DefaultCalendarOptions() CalendarOptions

DefaultCalendarOptions returns the default options with the current timezone (system time) patched in This is naive if this were to become a website but for now this is fine.

func (*CalendarOptions) Set

func (c *CalendarOptions) Set(name, val string) error

type DefaultAlarm

type DefaultAlarm struct {
	Alarm

	CalendarOptionsID uint `json:"calendar_id"`
}

type DeletedDate

type DeletedDate struct {
	Model
	Date time.Time `json:"date"`
}

type Item

type Item struct {
	Model
	Text           string    `json:"text" validate:"required" gorm:"type:text"`
	Owner          string    `json:"owner"`
	UID            string    `json:"uid"`
	UIDPersistent  bool      `json:"uid_persistent" gorm:"column:uid_persistent"`
	RemindStart    int64     `json:"remind_start"`
	Hilite         string    `json:"hilite"`
	Todo           bool      `json:"todo"`
	Done           bool      `json:"done"`
	Start          time.Time `json:"start"`
	Finish         time.Time `json:"finish"`
	RecurrenceRule string    `json:"recurrence_rule"`
	CalendarID     uint      `json:"calendar_id"`
	DataType       string    `json:"data_type"`
}

func (*Item) BeforeCreate

func (i *Item) BeforeCreate() error

func (*Item) GetID

func (i *Item) GetID() uint

type Model

type Model struct {
	ID        uint      `gorm:"primary_key" json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Note

type Note struct {
	Item

	// DeletedDates cannot be inherited since we need to use gorm's preloading
	// which does not support preloading on anonymous structs.
	DeletedDates []NoteDeletedDate `json:"deleted"`
}

func (*Note) BeforeCreate

func (n *Note) BeforeCreate() error

func (*Note) Name

func (n *Note) Name() string

type NoteDeletedDate

type NoteDeletedDate struct {
	DeletedDate

	NoteID uint `json:"-"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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