Skip to content

Instantly share code, notes, and snippets.

@eoinahern
Created January 9, 2018 17:21
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 eoinahern/7096a2149dfba801d93e94de68600599 to your computer and use it in GitHub Desktop.
Save eoinahern/7096a2149dfba801d93e94de68600599 to your computer and use it in GitHub Desktop.
package models
type User struct {
UserName string `json: "username" gorm: "type:TEXT; primary_key; not null"`
Verified bool `json: "verified" gorm: "type : "BOOLEAN" `
Password string `json: "password" gorm: "type: TEXT"`
Token string `json: "token" sql:"-" gorm:"-" `
Podcasts []Podcast `json: "podcasts" gorm: "ForeignKey:UserEmail;AssociationForeignKey:UserName"`
}
type Podcast struct {
PodcastID int `json: "podcastid" gorm: "AUTO_INCREMENT;primary_key; type:INTEGER; not null"`
UserEmail string `json: "useremail" gorm: "type:TEXT"`
Icon string `json: "icon" gorm: "type:TEXT"`
Name string `json: "name" gorm: "type: TEXT"`
EpisodeNum int `json: "episodenum" gorm: "type:INTEGER; DEFAULT:0"`
Details string `json : "details" gorm: "type:TEXT"`
Episodes []Episode `json: "episodes" gorm: "ForeignKey:PodID; AssociationForeignKey:PodcastID"`
}
type Episode struct {
PodID int `json: "podid" gorm: "type:INTEGER"`
Created string `json: "created" gorm: "type: TEXT"`
Updated string `json: "updated" gorm: "type: TEXT"`
URL string `json: "url" gorm: "type: TEXT"`
Downloads int32 `json: "downloads" gorm: "type: INTEGER; not null default:0"`
Blurb string `json: "blurb" gorm: "type: TEXT"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment