model

package
v0.0.0-...-7a06b2d Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBMigrate

func DBMigrate(db *gorm.DB) *gorm.DB

DBMigrate will create and migrate the tables, and then make the some relationships if necessary

Types

type BaseResponse

type BaseResponse struct {
	Status Status `json:"status"`
	Error  string `json:"error"`
}

func BadRequestResponse

func BadRequestResponse(err error) BaseResponse

func PrepareResponse

func PrepareResponse(code int, description string, err string) BaseResponse

func SuccessResponse

func SuccessResponse() BaseResponse

type Project

type Project struct {
	gorm.Model
	Title    string  `gorm:"unique" json:"title"`
	Archived bool    `json:"archived"`
	Tasks    []*Task `gorm:"foreignkey:ProjectID" json:"tasks"`
}

func (*Project) Parse

func (p *Project) Parse(r *http.Request) error

type ProjectsResponse

type ProjectsResponse struct {
	Response BaseResponse `json:"response"`
	Projects []*Project   `json:"projects"`
}

type Status

type Status struct {
	Code        int    `json:"code"`
	Description string `json:"description"`
}

type Task

type Task struct {
	gorm.Model
	Title     string     `json:"title"`
	Priority  string     `json:"priority"`
	Deadline  *time.Time `gorm:"default:null" json:"deadline"`
	Done      bool       `json:"done"`
	ProjectID uint       `json:"project_id"`
}

func (*Task) Parse

func (t *Task) Parse(r *http.Request) error

type TasksResponse

type TasksResponse struct {
	Response BaseResponse `json:"response"`
	Tasks    []*Task      `json:"tasks"`
}

Jump to

Keyboard shortcuts

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