Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Cibernomadas
Created June 7, 2018 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cibernomadas/3cac49105ac996d01541bbe007d29de4 to your computer and use it in GitHub Desktop.
Save Cibernomadas/3cac49105ac996d01541bbe007d29de4 to your computer and use it in GitHub Desktop.
package models
import "github.com/jinzhu/gorm"
type User struct {
gorm.Model
Username string `gorm:"type:varchar(32);UNIQUE"`
Email string `gorm:"type:varchar(256);UNIQUE"`
Password string `gorm:"type:varchar(128)"`
}
type Post struct {
gorm.Model
UserID int
User User
Body string `gorm:"type:varchar(512)"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment