orm

package
v0.0.0-...-c3d2762 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2018 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB() *gorm.DB

DB 返回 *gorm.DB

Types

type Task

type Task struct {
	ID        uint   `gorm:"primary_key"`
	OpenID    string `gorm:"size:255;sql:index"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

Task 任务

func (*Task) GetTaskByID

func (task *Task) GetTaskByID(id int)

GetTaskByID 获取任务

func (*Task) NewTask

func (task *Task) NewTask()

NewTask 新增一个任务

func (*Task) Save

func (task *Task) Save()

Save 保存信息

type User

type User struct {
	ID         uint   `gorm:"primary_key"`
	Email      string `gorm:"type:varchar(100);unique_index"` // `type` set sql type, `unique_index` will create unique index for this column
	OpenID     string `gorm:"size:255;sql:index"`
	Invited    bool
	Registered bool
	Subscribed bool `gorm:"default:true"`
	CreatedAt  time.Time
	UpdatedAt  time.Time
	DeletedAt  *time.Time `sql:"index"`
}

User has and belongs to many languages, use `user_languages` as join table

func (*User) GetUserByEmail

func (user *User) GetUserByEmail(email string)

GetUserByEmail 通过openID获取用户信息 如果没有的话进行初始化

func (*User) GetUserByID

func (user *User) GetUserByID(id int)

GetUserByID 获取用户关注的书籍

func (*User) GetUserByOpenID

func (user *User) GetUserByOpenID(openID string)

GetUserByOpenID 通过openID获取用户信息 如果没有的话进行初始化

func (*User) Save

func (user *User) Save()

Save 保存用户信息

Jump to

Keyboard shortcuts

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