Line data Source code
1 : // Package entity は ユーザーの連絡先情報を表すドメインエンティティです。
2 : package entity
3 :
4 : import (
5 : "time"
6 :
7 : "gorm.io/gorm"
8 : )
9 :
10 : // UserContact は ユーザーの連絡先情報を表すドメインエンティティです。
11 : type UserContact struct {
12 : ID uint64 `gorm:"primaryKey;autoIncrement;column:id"`
13 : UserID uint64 `gorm:"not null;column:user_id"`
14 : RelationshipTypeID uint64 `gorm:"not null;column:relationship_type_id"`
15 : DisplayName string `gorm:"size:255;not null;column:display_name"`
16 : Email *string `gorm:"size:64;column:email"`
17 : Phone *string `gorm:"size:32;column:phone"`
18 : Note *string `gorm:"type:text;column:note"`
19 : SortOrder int `gorm:"not null;default:0;column:sort_order"`
20 : CreatedAt time.Time `gorm:"autoCreateTime;column:created_at"`
21 : UpdatedAt time.Time `gorm:"autoUpdateTime;column:updated_at"`
22 : DeletedAt gorm.DeletedAt `gorm:"column:deleted_at"`
23 :
24 : // Relations
25 : RelationshipType *RelationshipType `gorm:"foreignKey:RelationshipTypeID;references:ID"`
26 : }
27 :
28 : // TableName は GORM用のテーブル名を返します
29 0 : func (UserContact) TableName() string {
30 0 : return "user_contacts"
31 0 : }
|