entities

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func IncPendingCount

func IncPendingCount(id uint)

func InitializeDB

func InitializeDB()

Types

type Entity

type Entity interface {
	Save() Entity
	Delete()
}

type RecurTask

type RecurTask struct {
	gorm.Model
	Deadline   time.Time `gorm:"index:idx_member"`
	IsFinished bool
	StackID    uint `gorm:"index:idx_member"`
	TaskID     uint
}

func (RecurTask) Save

func (r RecurTask) Save()

type Stack

type Stack struct {
	gorm.Model
	Title            string `gorm:"notnull"`
	PendingTaskCount int
	Tasks            []Task
}

Skipping priority field, just sort them alphabetically

func FetchAllStacks

func FetchAllStacks() ([]Stack, error)

func InitializeStacks

func InitializeStacks() (Stack, error)

func (Stack) Delete

func (s Stack) Delete()

func (Stack) PendingRecurringCount

func (s Stack) PendingRecurringCount() int

func (Stack) Save

func (s Stack) Save() Entity

type Step

type Step struct {
	gorm.Model
	Title      string
	IsFinished bool
	TaskID     uint
}

func (Step) Delete

func (s Step) Delete()

func (Step) Save

func (s Step) Save() Step

type Task

type Task struct {
	gorm.Model
	Title              string `gorm:"notnull"`
	Description        string
	Steps              []Step
	Deadline           time.Time
	Priority           int //3: High, 2: Mid, 1: Low, 0: No Priority
	IsFinished         bool
	IsRecurring        bool
	StartTime          time.Time //Applicable only for recurring tasks
	RecurrenceInterval int       // in days
	RecurChildren      []RecurTask
	StackID            uint
}

func (Task) Delete

func (t Task) Delete()

func (Task) FetchAllRecurTasks

func (t Task) FetchAllRecurTasks() []RecurTask

func (Task) LatestRecurTask

func (t Task) LatestRecurTask() (RecurTask, int64)

func (Task) RemoveFutureRecurTasks

func (t Task) RemoveFutureRecurTasks()

func (Task) Save

func (t Task) Save() Entity

Jump to

Keyboard shortcuts

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