Skip to content

Instantly share code, notes, and snippets.

@dipeshhkc
Created June 24, 2021 11:39
Show Gist options
  • Save dipeshhkc/2281ee7d5564dbd82fa6aa9da0265076 to your computer and use it in GitHub Desktop.
Save dipeshhkc/2281ee7d5564dbd82fa6aa9da0265076 to your computer and use it in GitHub Desktop.
//User -> model for users table
type User struct {
gorm.Model
Name string `json:"name" `
Email string `json:"email" gorm:"unique"`
Role string `json:"role" gorm:"-"`
Password string `json:"password" `
}
//TableName --> Table for Product Model
func (User) TableName() string {
return "users"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment