models

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPgSQLConf added in v0.3.0

func GetPgSQLConf() string

Types

type Answer added in v0.6.8

type Answer struct {
	UserUUID string
	// 开始时间戳
	StartTime uint32
	// 结束时间戳
	EndTime uint32
	// 题目 UUID
	QuestionUUID string
	// 所写答案是否选中A
	IsA bool
	// 所写答案是否选中B
	IsB bool
	// 所写答案是否选中C
	IsC bool
	// 所写答案是否选中D
	IsD bool
	// 所写答案是否为正确
	IsTrue bool
}

type ChapterModel

type ChapterModel struct {
	UUID            string           `gorm:"not null; primaryKey; type:uuid; default:gen_random_uuid()"`
	Name            string           `gorm:"not null; type:varchar(32)"`
	Description     sql.NullString   `gorm:"not null; type:varchar(99); default:''"`
	CourseUUID      string           `gorm:"not null; uniqueIndex:uk_chapter_courseUUID_index"`
	Course          CourseModel      `gorm:"foreignKey:CourseUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Index           uint32           `gorm:"not null; type:integer; uniqueIndex:uk_chapter_courseUUID_index"`
	Content         sql.NullString   `gorm:"not null; type:text; default:''"`
	Questions       []QuestionModel  `gorm:"foreignKey:ChapterUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	KnowledgePoints []KnowledgePoint `gorm:"foreignKey:ChapterUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type ClassModel

type ClassModel struct {
	UUID        string         `gorm:"not null; primaryKey; type:uuid; default:gen_random_uuid()"`
	Name        string         `gorm:"not null; type:varchar(32); uniqueIndex:uk_class_name"`
	Description sql.NullString `gorm:"not null; type:varchar(99); default:''"`
	CourseUUID  string         `gorm:"not null"`
	Course      CourseModel    `gorm:"foreignKey:CourseUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Belongs to
	Managers    []UserModel    ``                                                                                            /* 172-byte string literal not displayed */
	Students    []UserModel    ``                                                                                            /* 174-byte string literal not displayed */
}

type ContentReading added in v0.6.8

type ContentReading struct {
	UserUUID string
	// 开始时间戳
	StartTime uint32
	// 结束时间戳
	EndTime uint32
	// 章节 UUID
	ChapterUUID string
}

type CourseModel

type CourseModel struct {
	UUID        string         `gorm:"not null; primaryKey; type:uuid; default:gen_random_uuid()"`
	Name        string         `gorm:"not null; type:varchar(32); uniqueIndex:uk_course_name"`
	Description sql.NullString `gorm:"not null; type:varchar(99); default:''"`
	Managers    []UserModel    `` /* 174-byte string literal not displayed */
	Chapters    []ChapterModel `gorm:"foreignKey:CourseUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type KnowledgePoint added in v0.6.8

type KnowledgePoint struct {
	UUID        string       `gorm:"not null; primaryKey; type:uuid; default:gen_random_uuid()"`
	Name        string       `gorm:"not null; type:varchar(16)"`
	ChapterUUID string       `gorm:"not null; index:idx_knowledgePoint_chapterUUID"`
	Chapter     ChapterModel `gorm:"foreignKey:ChapterUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type QuestionAnswer added in v0.7.0

type QuestionAnswer struct {
	StudentID    uint32        `gorm:"not null; index:idx_questionAnswer_studentID"`
	Student      UserModel     `gorm:"foreignKey:StudentID; references:AccountID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	StartTime    time.Time     `gorm:"not null; type:timestamp"`
	EndTime      time.Time     `gorm:"not null; type:timestamp"`
	QuestionUUID string        `gorm:"not null"`
	Question     QuestionModel `gorm:"foreignKey:QuestionUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	IsA          bool          `gorm:"not null; type:bool; default:false"`
	IsB          bool          `gorm:"not null; type:bool; default:false"`
	IsC          bool          `gorm:"not null; type:bool; default:false"`
	IsD          bool          `gorm:"not null; type:bool; default:false"`
	IsE          bool          `gorm:"not null; type:bool; default:false"`
	IsF          bool          `gorm:"not null; type:bool; default:false"`
	IsG          bool          `gorm:"not null; type:bool; default:false"`
	IsH          bool          `gorm:"not null; type:bool; default:false"`
	IsTrue       bool          `gorm:"not null; type:bool; default:false"`
}

type QuestionModel

type QuestionModel struct {
	UUID            string           `gorm:"not null; primaryKey; type:uuid; default:gen_random_uuid()"`
	Question        string           `gorm:"not null; type:text; uniqueIndex:uk_question"`
	Analysis        sql.NullString   `gorm:"not null; type:text; default:''"`
	AnswerA         sql.NullString   `gorm:"not null; type:text; default:''; uniqueIndex:uk_question"`
	AnswerB         sql.NullString   `gorm:"not null; type:text; default:''; uniqueIndex:uk_question"`
	AnswerC         sql.NullString   `gorm:"not null; type:text; default:''; uniqueIndex:uk_question"`
	AnswerD         sql.NullString   `gorm:"not null; type:text; default:''; uniqueIndex:uk_question"`
	AnswerE         sql.NullString   `gorm:"not null; type:text; default:''; uniqueIndex:uk_question"`
	AnswerF         sql.NullString   `gorm:"not null; type:text; default:''; uniqueIndex:uk_question"`
	AnswerG         sql.NullString   `gorm:"not null; type:text; default:''; uniqueIndex:uk_question"`
	AnswerH         sql.NullString   `gorm:"not null; type:text; default:''; uniqueIndex:uk_question"`
	IsA             sql.NullBool     `gorm:"not null; type:bool; default:false; uniqueIndex:uk_question"`
	IsB             sql.NullBool     `gorm:"not null; type:bool; default:false; uniqueIndex:uk_question"`
	IsC             sql.NullBool     `gorm:"not null; type:bool; default:false; uniqueIndex:uk_question"`
	IsD             sql.NullBool     `gorm:"not null; type:bool; default:false; uniqueIndex:uk_question"`
	IsE             sql.NullBool     `gorm:"not null; type:bool; default:false; uniqueIndex:uk_question"`
	IsF             sql.NullBool     `gorm:"not null; type:bool; default:false; uniqueIndex:uk_question"`
	IsG             sql.NullBool     `gorm:"not null; type:bool; default:false; uniqueIndex:uk_question"`
	IsH             sql.NullBool     `gorm:"not null; type:bool; default:false; uniqueIndex:uk_question"`
	IsTrue          sql.NullBool     `gorm:"not null; type:bool; default:false; uniqueIndex:uk_question"`
	Type            sql.NullInt32    `gorm:"not null; type:integer; uniqueIndex:uk_question"`
	Level           sql.NullInt32    `gorm:"not null; type:integer; default:0"`
	AnswerCount     uint32           `gorm:"not null; type:integer; default:0"`
	CorrectCount    uint32           `gorm:"not null; type:integer; default:0"`
	ChapterUUID     string           `gorm:"not null; index:idx_question_chapterUUID; uniqueIndex:uk_question"`
	Chapter         ChapterModel     `gorm:"foreignKey:ChapterUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	IsExamQuestion  sql.NullBool     `gorm:"not null; type:bool; default:false"`
	KnowledgePoints []KnowledgePoint `` /* 177-byte string literal not displayed */
}

type ResourceModel added in v0.5.0

type ResourceModel struct {
	UUID        string       `gorm:"not null; primaryKey; type:uuid; default:gen_random_uuid()"`
	ChapterUUID string       `gorm:"not null"`
	Chapter     ChapterModel `gorm:"foreignKey:ChapterUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Prefix      string       `gorm:"not null; type:char(3)"`
	StoreName   string       `gorm:"not null; type:char(40)"`
	FileName    string       `gorm:"not null; type:varchar(99)"`
	FileType    int          `gorm:"not null; type:integer"`
	PutUserUUID string       `gorm:"not null"`
	PutUser     UserModel    `gorm:"foreignKey:PutUserUUID; references:AccountID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type UserModel

type UserModel struct {
	AccountID            uint32          `gorm:"primaryKey; type:integer; uniqueIndex:uk_user_accountID"`
	Name                 string          `gorm:"not null; type:varchar(32)"`
	Gender               sql.NullInt32   `gorm:"not null; type:integer; default:0"`
	Type                 sql.NullInt32   `gorm:"not null; type:integer"`
	IsManager            sql.NullBool    `gorm:"not null; type:bool; default:false"`
	PasswordSSHA         string          `gorm:"not null; type:char(64)"`
	PasswordSalt         string          `gorm:"not null; type:char(64)"`
	Classes              []ClassModel    `` /* 179-byte string literal not displayed */
	WrongAnswerQuestions []QuestionModel `` /* 191-byte string literal not displayed */
}

func (*UserModel) Check

func (u *UserModel) Check(passwordMD5 string) bool

func (*UserModel) ComputePasswordSSHA

func (u *UserModel) ComputePasswordSSHA(passwordMD5 string) string

func (*UserModel) GenSalt

func (u *UserModel) GenSalt() string

func (*UserModel) SetPassword added in v0.7.0

func (u *UserModel) SetPassword(PasswordMD5 string)

Jump to

Keyboard shortcuts

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