orm

package
v0.0.0-...-3244c54 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB() *gorm.DB

DB 返回 *gorm.DB

Types

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