use themes
This commit is contained in:
18
models/article.go
Normal file
18
models/article.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package models
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type Article struct {
|
||||
gorm.Model
|
||||
Title string
|
||||
Content string `gorm:"type:text"`
|
||||
AuthorID uint
|
||||
Tags []Tag `gorm:"many2many:article_tags;"`
|
||||
}
|
||||
|
||||
// Tag represents the tag model
|
||||
type Tag struct {
|
||||
gorm.Model
|
||||
Name string `gorm:"uniqueIndex"` // Ensures tag names are unique
|
||||
Articles []Article `gorm:"many2many:article_tags;"` // Reverse relationship
|
||||
}
|
||||
@@ -8,7 +8,7 @@ package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_blog/conf"
|
||||
conf "go_blog/config"
|
||||
"go_blog/pkg/util"
|
||||
"time"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user