models

package
v0.0.0-...-f59f382 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID        uint      `gorm:"primaryKey"`
	PostID    uint      `gorm:"index"`
	ParentID  *uint     `gorm:"index"`
	Content   string    `gorm:"type:text;size:2000"`
	CreatedAt time.Time `gorm:"autoCreateTime"`
	UpdatedAt time.Time `gorm:"autoUpdateTime"`
	Replies   []Comment `gorm:"foreignKey:ParentID"`
}

type Post

type Post struct {
	ID            uint      `gorm:"primaryKey"`
	Title         string    `gorm:"type:varchar(255)"`
	Content       string    `gorm:"type:text"`
	AllowComments bool      `gorm:"default:true"`
	CreatedAt     time.Time `gorm:"autoCreateTime"`
	UpdatedAt     time.Time `gorm:"autoUpdateTime"`
	Comments      []Comment `gorm:"foreignKey:PostID"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL