增加标签model
This commit is contained in:
23
pkg/model/tag.go
Normal file
23
pkg/model/tag.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "next-terminal/pkg/global"
|
||||||
|
|
||||||
|
type Tag struct {
|
||||||
|
Tag string `json:"tag"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Tag) TableName() string {
|
||||||
|
return "tags"
|
||||||
|
}
|
||||||
|
|
||||||
|
func FindAllTag() (o []Property) {
|
||||||
|
if global.DB.Find(&o).Error != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateNewTag(o *Tag) (err error) {
|
||||||
|
err = global.DB.Create(o).Error
|
||||||
|
return
|
||||||
|
}
|
Reference in New Issue
Block a user