package
Version:
v0.0.0-...-d6508de
Opens a new window with list of versions in this module.
Published: Apr 14, 2023
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type Category struct {
ID uint `gorm:"primary_key:auto_increment" json:"id"`
Name string `gorm:"type:varchar(100)" json:"name"`
Posts []Post `json:"posts"`
}
type Comment struct {
Body string `gorm:"type:varchar(150)" json:"body"`
}
type Post struct {
gorm.Model
Title string `gorm:"type:varchar(100)" json:"title"`
Description string `gorm:"type:text" json:"description"`
Image string `gorm:"type:varchar(255)" json:"image"`
CategoryID uint `json:"category"`
Category Category `gorm:"foreignkey:CategoryID" json:"-"`
}
type User struct {
ID uint64 `gorm:"primary_key:auto_increment" json:"id"`
Name string `gorm:"type:varchar(255)" json:"name"`
Email string `gorm:"uniqueIndex;type:varchar(255)" json:"email"`
Password string `gorm:"not null" json:"-"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.