Skip to content

Instantly share code, notes, and snippets.

@pjebs
Last active June 26, 2020 00:02
Show Gist options
  • Save pjebs/5b4e0e2f88390f2add6f933f8b9bad1d to your computer and use it in GitHub Desktop.
Save pjebs/5b4e0e2f88390f2add6f933f8b9bad1d to your computer and use it in GitHub Desktop.
benchmark model
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