model

package
v0.0.0-...-c098066 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: LGPL-2.1 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

This section is empty.

Types

type DailyDetail

type DailyDetail struct {
	DailyPlanId uint   `json:"daily_plan_id" gorm:"not null;"`
	StartTime   string `json:"start_time" gorm:"type:varchar(255);not null;"`
	EndTime     string `json:"end_time" gorm:"type:varchar(255);not null;"`
	Detail      string `json:"detail" gorm:"type:varchar(255);not null;"`
	gorm.Model
}

func SelecetDailyDetailByDailyPlanId

func SelecetDailyDetailByDailyPlanId(dailyPlanid uint) (dailyDetails []DailyDetail, ok bool)

func (*DailyDetail) Create

func (item *DailyDetail) Create() (ok bool)

func (*DailyDetail) Delete

func (item *DailyDetail) Delete() (ok bool)

func (*DailyDetail) Update

func (item *DailyDetail) Update() (ok bool)

type DailyPlan

type DailyPlan struct {
	UserId uint   `json:"user_id" gorm:"not null;"`
	Name   string `json:"name" gorm:"type:varchar(255);not null;"`
	gorm.Model
}

func SelecetDailyPlanByUserId

func SelecetDailyPlanByUserId(userid uint) (dailyPlans []DailyPlan, ok bool)

func (*DailyPlan) Create

func (item *DailyPlan) Create() (ok bool)

func (*DailyPlan) Delete

func (item *DailyPlan) Delete() (ok bool)

func (*DailyPlan) Update

func (item *DailyPlan) Update() (ok bool)

type FamousQuote

type FamousQuote struct {
	UserId uint   `json:"user_id" gorm:"not null;"`
	Quote  string `json:"quote" gorm:"default '励志名言'"`
	Author uint   `json:"author" gorm:"default '作家'"`
	gorm.Model
}

func SelecetFamousQuoteByUserId

func SelecetFamousQuoteByUserId(userid uint) (famousQuotes []FamousQuote, ok bool)

func (*FamousQuote) Create

func (item *FamousQuote) Create() (ok bool)

func (*FamousQuote) Delete

func (item *FamousQuote) Delete() (ok bool)

func (*FamousQuote) Update

func (item *FamousQuote) Update() (ok bool)

type Goal

type Goal struct {
	UserId uint      `json:"userid" gorm:"not null;"`
	Cotent string    `json:"content" gorm:"default 'todu'"`
	Done   uint      `json:"done" gorm:"default 0"`
	Time   time.Time `json:"time" gorm:""`
	gorm.Model
}

func (*Goal) Create

func (goal *Goal) Create() (tx *gorm.DB, ok bool)

func (*Goal) Delete

func (goal *Goal) Delete() (tx *gorm.DB, ok bool)

func (*Goal) Update

func (goal *Goal) Update() (tx *gorm.DB, ok bool)

type Happy

type Happy struct {
	UserId uint      `json:"user_id" gorm:"not null;"`
	Cotent string    `json:"content" gorm:"default 'Some thing make me happy'"`
	Time   time.Time `json:"time" gorm:""`
	gorm.Model
}

func SelecetHappyByID

func SelecetHappyByID(id uint) (happy Happy, ok bool)

func SelecetHappyByUserId

func SelecetHappyByUserId(userid uint) (happys []Happy, ok bool)

func SelecetHappyByUserIdAndTime

func SelecetHappyByUserIdAndTime(userid uint, start, end time.Time) (happys []Happy, ok bool)

func (*Happy) Create

func (item *Happy) Create() (ok bool)

func (*Happy) Delete

func (item *Happy) Delete() (ok bool)

func (*Happy) Update

func (item *Happy) Update() (ok bool)

type Modeler

type Modeler interface {
	Create() (ok bool)
	Update() (ok bool)
	Delete() (ok bool)
}

Model 通用方法

type PageData

type PageData struct {
	Page     int           `json:"page"`
	PageSize int           `json:"pageSize"`
	Total    int           `json:"total"`
	Data     []interface{} `json:"data"`
}

type PageInfo

type PageInfo struct {
	Page      int       `json:"page" form:"page"`
	PageSize  int       `json:"pageSize" form:"pageSize"`
	Keyword   string    `json:"keyword" form:"keyword"`
	StartTime time.Time `json:"start_time" form:"start_time"`
	EndTime   time.Time `json:"end_time" form:"end_time"`
}

type Task

type Task struct {
	UserId   uint      `json:"user_id" gorm:"not null;"`
	Cotent   string    `json:"content" gorm:"default 'todu'"`
	Done     bool      `json:"done" gorm:"default false"`
	Time     time.Time `json:"time" gorm:""`
	Meridiem string    `json:"meridiem" gorm:"default 'am'"`
	Color    string    `json:"color" gorm:"default '#c2e9fb'"`
	gorm.Model
}

func SelecetTaskByID

func SelecetTaskByID(id uint) (task Task, ok bool)

func SelecetTaskByUserId

func SelecetTaskByUserId(userid uint) (tasks []Task, ok bool)

func SelecetTaskByUserIdAndTime

func SelecetTaskByUserIdAndTime(userid uint, start, end time.Time) (tasks []Task, ok bool)

func (*Task) Create

func (item *Task) Create() (ok bool)

func (*Task) Delete

func (item *Task) Delete() (ok bool)

func (*Task) Update

func (item *Task) Update() (ok bool)

type TaskList

type TaskList struct {
	UserId uint   `json:"userid" gorm:"not null;"`
	Cotent string `json:"content" gorm:"default 'todu'"`
	Color  string `json:"color" gorm:"default '#c2e9fb'"`
	gorm.Model
}

func (*TaskList) Create

func (taskList *TaskList) Create() (tx *gorm.DB, ok bool)

func (*TaskList) Delete

func (taskList *TaskList) Delete() (tx *gorm.DB, ok bool)

func (*TaskList) Update

func (taskList *TaskList) Update() (tx *gorm.DB, ok bool)

type Todo

type Todo struct {
	UserId uint      `json:"user_id" gorm:"not null;"`
	Cotent string    `json:"content" gorm:"default 'todu'"`
	Done   bool      `json:"done" gorm:"default 0"`
	Time   time.Time `json:"time" gorm:""`
	gorm.Model
}

func SelecetTodoByID

func SelecetTodoByID(id uint) (todo Todo, ok bool)

func SelecetTodoByUserId

func SelecetTodoByUserId(userid uint) (todos []Todo, ok bool)

func SelecetTodoByUserIdAndTime

func SelecetTodoByUserIdAndTime(userid uint, start, end time.Time) (todos []Todo, ok bool)

func (*Todo) Create

func (item *Todo) Create() (ok bool)

func (*Todo) Delete

func (item *Todo) Delete() (ok bool)

func (*Todo) Update

func (item *Todo) Update() (ok bool)

type User

type User struct {
	Username string `json:"username" gorm:"unique;not null;"`
	Password string `json:"password" gorm:"not null;"`
	Image    string `json:"image" gorm:"default ''"`
	Email    string `json:"email" gorm:"not null;"`
	gorm.Model
}

func SelectUser

func SelectUser() (users []User, ok bool)

func SelectUserById

func SelectUserById(id int) (user User, ok bool)

func SelectUserByUsername

func SelectUserByUsername(username string) (user User, ok bool)

func (*User) Create

func (user *User) Create() (ok bool)

func (*User) Delete

func (user *User) Delete() (ok bool)

func (*User) Update

func (user *User) Update() (ok bool)

type WeekPlan

type WeekPlan struct {
	UserId      uint `json:"user_id" gorm:"not null;"`
	DailyPlanId uint `json:"daily_plan_id"`
	Week        uint `json:"week"`
	gorm.Model
}

func SelecetWeekPlanByUserId

func SelecetWeekPlanByUserId(userid uint) (weekPlans []WeekPlan, ok bool)

func SelecetWeekPlanByUserIdAndWeek

func SelecetWeekPlanByUserIdAndWeek(userid uint, week time.Weekday) (weekPlan WeekPlan, ok bool)

func (*WeekPlan) Create

func (item *WeekPlan) Create() (ok bool)

func (*WeekPlan) Delete

func (item *WeekPlan) Delete() (ok bool)

func (*WeekPlan) Update

func (item *WeekPlan) Update() (ok bool)

Jump to

Keyboard shortcuts

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