Discover Packages
github.com/Asrez/GoAPIBlog
data
models
package
Version:
v0.0.0-...-6643502
Opens a new window with list of versions in this module.
Published: Dec 19, 2023
License: GPL-3.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
type BaseModel struct {
Id int `gorm:"primarykey"`
CreatedAt time .Time `gorm:"type:TIMESTAMP with time zone;not null"`
}
type Post struct {
BaseModel
Title string `gorm:"type=string;size:256;not null";`
Content string `gorm:"type=text;not null"`
User User `gorm:"foreignKey:AuthorId;constraint:OnUpdate:NO ACTION;OnDelete:NO ACTION"`
AuthorId uint
}
type User struct {
BaseModel
Username string `gorm:"type:string;size:50;not null;unique"`
Email string `gorm:"type:string;size:256;null;unique;default:null"`
Password string `gorm:"type:string;size:256;not null"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.