Line data Source code
1 : // Package entity は ユーザー保有のスキルを表すドメインエンティティです
2 : package entity
3 :
4 : import (
5 : "time"
6 :
7 : "gorm.io/gorm"
8 : )
9 :
10 : // UserSkill はユーザーのスキルを表すドメインエンティティです
11 : type UserSkill struct {
12 : ID uint64 `gorm:"primaryKey;autoIncrement"`
13 : UserID uint64 `gorm:"not null;index:idx_user_skill_user_sort,priority:1;index:idx_user_skill_user"`
14 : SkillCategoryID uint64 `gorm:"not null"`
15 : SkillLevelID uint64 `gorm:"not null"`
16 : ExperienceID uint64 `gorm:"not null"`
17 : SkillName string `gorm:"size:255;not null"`
18 : SkillNameNorm string `gorm:"size:255;not null"`
19 : Evidence string `gorm:"size:255;not null"`
20 : SortOrder int `gorm:"not null;default:0;index:idx_user_skill_user_sort,priority:2"`
21 : CreatedAt time.Time `gorm:"autoCreateTime"`
22 : UpdatedAt time.Time `gorm:"autoUpdateTime"`
23 : DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index"`
24 : }
25 :
26 : // SuggestUserSkill は Suggest の実行結果の1行を表します
27 : // note Text より SkillName の方が名前的に妥当かもしれない。フロントの結合後調整するかも
28 : // note TextNorm より SkillNameNorm の方が名前的に妥当かもしれない。フロントとの結合後調整するかも
29 : type SuggestUserSkill struct {
30 : Text string
31 : TextNorm string
32 : Count int
33 : ActiveCnt int
34 : DeletedCnt int
35 : }
36 :
37 : // TableName は テーブル名を返すメソッド
38 0 : func (UserSkill) TableName() string { return "user_skills" }
|