model

package
v0.0.0-...-8d4a05d Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ModelArticleSet = wire.NewSet(wire.Struct(new(ModelArticle), "*"))

Functions

This section is empty.

Types

type Article

type Article struct {
	gorm.Model
	Id        string `gorm:"primarykey;index:idx_id;unique;varchar(20);not null;"`
	Title     string `gorm:"index:idx_title;unique;varchar(150);not null;"`
	Author    string `gorm:"varchar(30);not null;default:'马克西'"`
	Reference string `gorm:"varchar(300);"`
	Link      string `gorm:"varchar(300);"`
	View      uint   `gorm:"number;not null;default:0;"`
	Like      uint   `gorm:"number;not null;default:0;"`
	Cover     string `gorm:"varchar(300);"`
	Content   string `gorm:"text;"`
	Tags      []Tag  `gorm:"many2many:article_tag;"`
}

type ModelArticle

type ModelArticle struct {
	DB *gorm.DB
}

func (*ModelArticle) CreateArticle

func (m *ModelArticle) CreateArticle(ctx context.Context, article *Article) error

func (*ModelArticle) CreateTag

func (m *ModelArticle) CreateTag(ctx context.Context, tag *Tag) error

func (*ModelArticle) DeleteArticleByID

func (m *ModelArticle) DeleteArticleByID(ctx context.Context, articleId string) error

func (*ModelArticle) DeleteTagByName

func (m *ModelArticle) DeleteTagByName(ctx context.Context, tagName string) error

func (*ModelArticle) QueryArticleByID

func (m *ModelArticle) QueryArticleByID(ctx context.Context, article *Article, articleId string) error

func (*ModelArticle) QueryArticleList

func (m *ModelArticle) QueryArticleList(c *gin.Context, list *[]Article, pageNo int, pageSize int, tagNames []string, search string) error

func (*ModelArticle) QueryTagByName

func (m *ModelArticle) QueryTagByName(ctx context.Context, tag *Tag, tagName string) error

func (*ModelArticle) QueryTags

func (m *ModelArticle) QueryTags(c *gin.Context, tags *[]Tag) error

func (*ModelArticle) UpdateArticleByID

func (m *ModelArticle) UpdateArticleByID(ctx context.Context, article *Article, articleId string) error

func (*ModelArticle) UpdateArticleLikeByID

func (m *ModelArticle) UpdateArticleLikeByID(ctx context.Context, article *Article) error

func (*ModelArticle) UpdateArticleViewByID

func (m *ModelArticle) UpdateArticleViewByID(ctx context.Context, article *Article) error

func (*ModelArticle) UpdateTagByName

func (m *ModelArticle) UpdateTagByName(ctx context.Context, tag *Tag, tagName string) error

type Tag

type Tag struct {
	Name     string    `gorm:"primarykey;index:idx_name;unique;varchar(20);not null;"`
	Articles []Article `gorm:"many2many:article_tag;"`
}

Jump to

Keyboard shortcuts

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