models

package
v0.7.27 Latest Latest
Warning

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

Go to latest
Published: May 8, 2021 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 int32
	// 结束时间戳
	EndTime int32
	// 题目 UUID
	QuestionUUID string
	// 所写答案是否选中A
	IsA bool
	// 所写答案是否选中B
	IsB bool
	// 所写答案是否选中C
	IsC bool
	// 所写答案是否选中D
	IsD bool
	// 所写答案是否为正确
	IsTrue bool
}

type Chapter added in v0.7.5

type Chapter struct {
	UUID        string         `gorm:"not null; primaryKey; type:uuid; default:gen_random_uuid()"`
	Name        sql.NullString `gorm:"not null; type:varchar(32)"`
	Description sql.NullString `gorm:"not null; type:varchar(99); default:''"`
	CourseUUID  sql.NullString `gorm:"not null; uniqueIndex:uk_chapter_courseUUID_index"`
	Course      Course         `gorm:"foreignKey:CourseUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Index       sql.NullInt32  `gorm:"not null; type:integer; uniqueIndex:uk_chapter_courseUUID_index"`
	Content     sql.NullString `gorm:"not null; type:text; default:''"`
	Questions   []Question     `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        sql.NullString `gorm:"not null; type:varchar(32); uniqueIndex:uk_class_name"`
	Description sql.NullString `gorm:"not null; type:varchar(99); default:''"`
	CourseUUID  sql.NullString `gorm:"not null"`
	Course      Course         `gorm:"foreignKey:CourseUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Belongs to
	CreatorID   sql.NullInt32  `gorm:"not null"`
	Creator     User           `gorm:"foreignKey:CreatorID; references:AccountID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Students    []User         `` /* 172-byte string literal not displayed */
}

type ContentReading added in v0.6.8

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

type Course added in v0.7.5

type Course struct {
	UUID        string         `gorm:"not null; primaryKey; type:uuid; default:gen_random_uuid()"`
	Name        sql.NullString `gorm:"not null; type:varchar(32); uniqueIndex:uk_course_name"`
	Description sql.NullString `gorm:"not null; type:varchar(99); default:''"`
	Chapters    []Chapter      `gorm:"foreignKey:CourseUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type Question added in v0.7.5

type Question struct {
	UUID           string         `gorm:"not null; primaryKey; type:uuid; default:gen_random_uuid()"`
	Question       sql.NullString `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    sql.NullInt32  `gorm:"not null; type:integer; default:0"`
	CorrectCount   sql.NullInt32  `gorm:"not null; type:integer; default:0"`
	ChapterUUID    sql.NullString `gorm:"not null; index:idx_question_chapterUUID; uniqueIndex:uk_question"`
	Chapter        Chapter        `gorm:"foreignKey:ChapterUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	IsExamQuestion sql.NullBool   `gorm:"not null; type:bool; default:false"`
}

type QuestionAnswer added in v0.7.0

type QuestionAnswer struct {
	StudentID    int32    `gorm:"not null; index:idx_questionAnswer_studentID"`
	Student      User     `gorm:"foreignKey:StudentID; references:AccountID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	QuestionUUID string   `gorm:"not null"`
	Question     Question `gorm:"foreignKey:QuestionUUID; references:UUID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	UsedTime     int32    `gorm:"not null; integer"`
	IsCorrect    bool     `gorm:"not null; type:bool"`
}

type Resource added in v0.7.5

type Resource struct {
	UUID        string  `gorm:"not null; primaryKey; type:uuid; default:gen_random_uuid()"`
	ChapterUUID string  `gorm:"not null"`
	Chapter     Chapter `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     User    `gorm:"foreignKey:PutUserUUID; references:AccountID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type User added in v0.7.5

type User struct {
	AccountID            int32          `gorm:"primaryKey; type:integer; uniqueIndex:uk_user_accountID"`
	Name                 sql.NullString `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         sql.NullString `gorm:"not null; type:char(64)"`
	PasswordSalt         sql.NullString `gorm:"not null; type:char(64)"`
	Classes              []ClassModel   `` /* 172-byte string literal not displayed */
	WrongAnswerQuestions []Question     `` /* 184-byte string literal not displayed */
}

func (*User) Check added in v0.7.5

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

func (*User) ComputePasswordSSHA added in v0.7.5

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

func (*User) GenSalt added in v0.7.5

func (u *User) GenSalt() string

func (*User) SetPassword added in v0.7.5

func (u *User) SetPassword(PasswordMD5 string)

Jump to

Keyboard shortcuts

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