model

package
v0.0.0-...-d75ea93 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	// contains filtered or unexported fields
}

func New

func New(config *config.Config, logger *logger.Logger, database *database.Database) (*Model, error)

func (Model) AutoMigrate

func (m Model) AutoMigrate() error

func (Model) DeleteProject

func (m Model) DeleteProject(id int) error

func (Model) DeleteTask

func (m Model) DeleteTask(id uint) error

func (Model) GetTask

func (m Model) GetTask(id uint) (*Task, error)

func (Model) GetTasks

func (m Model) GetTasks(dueStart int64, dueEnd int64) (*[]Task, error)

func (Model) IsErrNotFound

func (m Model) IsErrNotFound(err error) bool

func (Model) PutTask

func (m Model) PutTask(task *Task) error

func (Model) UpdateProject

func (m Model) UpdateProject(project *Project) error

func (Model) UpdateTask

func (m Model) UpdateTask(task *Task) error

type Project

type Project struct {
	Id    int    `json:"id"    gorm:"unique;AUTO_INCREMENT"`
	Title string `json:"title" gorm:"not null"`
}

type Task

type Task struct {
	Id      uint   `json:"id"    gorm:"unique;AUTO_INCREMENT"`
	Title   string `json:"title" gorm:"not null"`
	Note    string `json:"note"`
	Project int    `json:"project"`
	Due     int64  `json:"due"`
	Status  uint8  `json:"done" gorm:"default:0"`
}

type TaskStatus

type TaskStatus uint8
const (
	Todo  TaskStatus = 0
	Done  TaskStatus = 1
	Doing TaskStatus = 2
)

Jump to

Keyboard shortcuts

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