package user import "github.com/golangkit/formatime" type Addr struct { ID uint `gorm:"column:id;primary_key" json:"id"` UserID uint `gorm:"column:user_id" json:"-"` Name string `gorm:"column:name" json:"name"` Mobile string `gorm:"column:mobile" json:"mobile"` Province string `gorm:"column:province" json:"province"` City string `gorm:"column:city" json:"city"` District string `gorm:"column:district" json:"district"` Address string `gorm:"column:address" json:"address"` IsDefault uint `gorm:"column:is_default" json:"isDefault"` CreatedAt formatime.Second `gorm:"column:created_at" json:"-"` } // TableName sets the insert table name for this struct type func (r *Addr) TableName() string { return "recook_user_addr" } func (r *Addr) GetAddress() string { return r.Province + r.City + r.District + r.Address }