-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf66499
commit da3cc8d
Showing
4 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
package testdata | ||
|
||
import "time" | ||
|
||
type Users struct { | ||
ID int32 `gorm:"primaryKey;autoIncrement;"` | ||
Name string `gorm:"size:255;not null;"` | ||
Email string `gorm:"size:255;not null;unique;"` | ||
} | ||
|
||
type UserDetail struct { | ||
UserDetailID string `gorm:"primaryKey;size:30;not null"` | ||
UserID int32 // 外部キー | ||
User Users `gorm:"foreignKey:UserID"` // Usersとの関連 | ||
Name string `gorm:"size:255;not null"` | ||
CreatedAt time.Time | ||
UpdatedAt time.Time | ||
} |