Line data Source code
1 : // Package entity はドメインエンティティを定義します。
2 : package entity
3 :
4 : import (
5 : "time"
6 : )
7 :
8 : // UserEducation はユーザーの学歴を表すドメインエンティティです
9 : type UserEducation struct {
10 : ID uint64 `gorm:"primaryKey;autoIncrement;comment:学歴ID"`
11 : UserID uint64 `gorm:"not null;index:idx_user_educations_user;index:idx_user_educations_user_sort,priority:1;comment:ユーザーID(users.id)"`
12 : InstitutionName string `gorm:"type:varchar(255);not null;comment:学校名"`
13 : FacultyName *string `gorm:"type:varchar(255);comment:学部"`
14 : DepartmentName *string `gorm:"type:varchar(255);comment:学科・専攻"`
15 : DegreeTypeID uint64 `gorm:"comment:学位種別ID(degree_types.id)"`
16 : EducationStatusID uint64 `gorm:"not null;comment:学歴状態ID(education_statuses.id)"`
17 : EventDate time.Time `gorm:"type:date;not null;comment:年月"`
18 : Description *string `gorm:"type:text;comment:補足"`
19 : SortOrder int `gorm:"not null;default:0;index:idx_user_educations_user_sort,priority:2;comment:表示順"`
20 : IsPublic *bool `gorm:"not null;default:true;comment:公開可否"`
21 : CreatedAt time.Time `gorm:"autoCreateTime;comment:作成日時"`
22 : UpdatedAt time.Time `gorm:"autoUpdateTime;comment:更新日時"`
23 :
24 : // 関連
25 : DegreeType *DegreeType `gorm:"foreignKey:DegreeTypeID"`
26 : EducationStatus *EducationStatus `gorm:"foreignKey:EducationStatusID"`
27 : }
28 :
29 : // TableName は GORM のテーブル名を返します。
30 0 : func (UserEducation) TableName() string {
31 0 : return "user_educations"
32 0 : }
|