Last active
June 26, 2020 00:02
-
-
Save pjebs/5b4e0e2f88390f2add6f933f8b9bad1d to your computer and use it in GitHub Desktop.
benchmark model
This file contains hidden or 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
type model struct { | |
ID int `dbq:"id" gorm:"column:id" db:"id"` | |
Name string `dbq:"name" gorm:"column:name" db:"name"` | |
Email string `dbq:"email" gorm:"column:email" db:"email"` | |
} | |
// Recommended by dbq | |
func (m *model) ScanFast() []interface{} { | |
return []interface{}{&m.ID, &m.Name, &m.Email} | |
} | |
// Required by gorm | |
func (model) TableName() string { | |
return "tests" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment