Documentation
¶
Index ¶
- Constants
- func AnswerCreate(user *Users, question *Questions, content string, orm *orm.Ormer) (int64, error)
- func CreateQuestion(categoryId int64, title string, description string, user *Users) (int64, error)
- func CreateUser(nickname string, email string, password string, lock string, avatar string) (int64, error)
- func Init()
- func UserEmailExists(email string) bool
- func UserNicknameExists(nickname string) bool
- type Answers
- type Categories
- type Questions
- type Settings
- type Users
Constants ¶
View Source
const ( IS_LOCK_YES = 1 IS_LOCK_NO = -1 )
Variables ¶
This section is empty.
Functions ¶
func AnswerCreate ¶
func CreateQuestion ¶
func CreateUser ¶
func UserEmailExists ¶
func UserNicknameExists ¶
Types ¶
type Answers ¶
type Answers struct {
User *Users `orm:"rel(fk)"`
Question *Questions `orm:"rel(fk)"`
Id int64 `json:"id"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func AnswerPaginate ¶
type Categories ¶
type Categories struct {
Id int64 `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
Questions []*Questions `orm:"reverse(many)"`
}
func AllCategories ¶
func AllCategories() ([]*Categories, error)
func FindCategoryById ¶
func FindCategoryById(id int64) (*Categories, error)
type Questions ¶
type Questions struct {
User *Users `orm:"rel(fk)"`
Category *Categories `orm:"rel(fk)"`
Id int64 `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
ViewNum int `json:"view_num"`
IsBan int8 `json:"is_ban"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
AnswerAt time.Time `json:"answer_at"`
AnswerCount int64 `json:"answer_count"`
Answers []*Answers `orm:"reverse(many)"`
AnswerUser *Users `orm:"null;rel(one)"`
}
func FindQuestionById ¶
func QuestionPaginate ¶
type Users ¶
type Users struct {
Id int `json:"id"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Email string `json:"email"`
Password string `json:"-"`
IsLock int `json:"is_lock"`
Company string `json:"company"`
Age int64 `json:"age"`
Profession string `json:"profession"`
Website string `json:"website"`
Weibo string `json:"weibo"`
Wechat string `json:"wechat"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Questions []*Questions `orm:"reverse(many)" json:"questions"`
Answers []*Answers `orm:"reverse(many)" json:"answers"`
}
func FindUserById ¶
func (*Users) GenerateHashedUrl ¶
生成密码重置地址
Click to show internal directories.
Click to hide internal directories.