Documentation
¶
Index ¶
Constants ¶
View Source
const ( BASIC statusType = "BASIC" VIP statusType = "VIP" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Course ¶
type Course struct {
gorm.Model
ID int64 `gorm:"primary_key;auto_increment" json:"course_id"`
School_id int64 `gorm:"not null" json:"school_id"`
Course_no string `gorm:"not null" json:"course_no"`
Course_name string `gorm:"not null" json:"course_name"`
View_cnt int64 `gorm:"default:0" json:"view_cnt"`
Note_cnt int64 `gorm:"default:0" json:"note_cnt"`
Last_updated_time time.Time `gorm:"default:null" json:"last_updated_time"`
School School `gorm:"foreignKey:School_id;constraint:OnDelete:CASCADE;"`
}
type Download ¶
type Download struct {
gorm.Model
User_id int64 `gorm:"not null;uniqueIndex:compositeindex_download;" json:"user_id"`
Note_id int64 `gorm:"not null;uniqueIndex:compositeindex_download;" json:"note_id"`
User User `gorm:"foreignKey:User_id;constraint:OnDelete:CASCADE;"`
Note Note `gorm:"foreignKey:Note_id;constraint:OnDelete:CASCADE;"`
}
type Follow ¶
type Follow struct {
gorm.Model
Follower_id int64 `gorm:"not null;uniqueIndex:compositeindex_follow;" json:"follower_id"`
Followee_id int64 `gorm:"not null;uniqueIndex:compositeindex_follow;" json:"followee_id"`
Follower User `gorm:"foreignKey:Follower_id;constraint:OnDelete:CASCADE;"`
Followee User `gorm:"foreignKey:Followee_id;constraint:OnDelete:CASCADE;"`
}
type Note ¶
type Note struct {
gorm.Model
ID int64 `gorm:"primary_key;auto_increment" json:"note_id"`
User_id int64 `gorm:"not null" json:"user_id"`
Title string `gorm:"not null" json:"title"`
Description string `json:"description"`
View_cnt int64 `gorm:"default:0" json:"view_cnt"`
Is_template bool `gorm:"default:false" json:"is_template"`
Course_id int64 `gorm:"default:null" json:"course_id"`
Bean int `gorm:"default:0" json:"bean"`
Pdf_filename string `gorm:"default:null" json:"pdf_filename"`
Preview_filename string `gorm:"default:null" json:"preview_filename"`
Goodnotes_filename string `gorm:"default:null" json:"goodnotes_filename"`
Notability_filename string `gorm:"default:null" json:"notability_filename"`
CreatedAt time.Time `json:"created_at"`
User User `gorm:"foreignKey:User_id;constraint:OnDelete:SET NULL;"`
Course Course `gorm:"foreignKey:Course_id;constraint:OnDelete:SET NULL;"`
}
Note: filename should be "{create_time}_{random_string}"
type NoteTag ¶
type NoteTag struct {
gorm.Model
Tag_id int64 `gorm:"not null;uniqueIndex:compositeindex;" json:"tag_id"`
Note_id int64 `gorm:"not null;uniqueIndex:compositeindex;" json:"note_id"`
Tag Tag `gorm:"foreignKey:Tag_id;constraint:OnDelete:CASCADE;"`
Note Note `gorm:"foreignKey:Note_id;constraint:OnDelete:CASCADE;"`
}
type Saved ¶
type Saved struct {
gorm.Model
User_id int64 `gorm:"not null;uniqueIndex:compositeindex_like;" json:"user_id"`
Note_id int64 `gorm:"not null;uniqueIndex:compositeindex_like;" json:"note_id"`
User User `gorm:"foreignKey:User_id;constraint:OnDelete:CASCADE;"`
Note Note `gorm:"foreignKey:Note_id;constraint:OnDelete:CASCADE;"`
}
type User ¶
type User struct {
gorm.Model
ID int64 `gorm:"primary_key;auto_increment" json:"user_id"`
Google_ID string `gorm:"default null" json:"google_id"`
Username string `gorm:"not null;unique" json:"username"`
Full_name string `gorm:"not null" json:"full_name"`
Email string `gorm:"not null" json:"email"`
Password string `json:"password_hash"`
Description string `json:"description"`
Status statusType `sql:"status_type" gorm:"default:'BASIC';not null" json:"status"`
Bean int64 `gorm:"default:150" json:"bean"`
}
Click to show internal directories.
Click to hide internal directories.