model

package
v0.0.0-...-f922c86 Latest Latest
Warning

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

Go to latest
Published: May 30, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func PostCount

func PostCount() (int, error)

func PostCountByTid

func PostCountByTid(tid uint) int

func PostGetNavMap

func PostGetNavMap(post *Post) map[string]string

func PostSetAllTags

func PostSetAllTags(posts []Post) error

func PostSetTags

func PostSetTags(post *Post)

func PostTagSetName

func PostTagSetName(postTags ...PostTag)

Types

type Archive

type Archive struct {
	Time  time.Time
	Posts []Post
}

func PostGetArchives

func PostGetArchives() []Archive

type Post

type Post struct {
	gorm.Model
	Author      string
	Title       string
	Path        string
	Des         string
	Content     string
	Draft       bool
	PublishedAt *time.Time

	HTML string `gorm:"-"`
	Tags []*Tag `gorm:"-"`
}

func PostGetByPath

func PostGetByPath(path string) *Post

func PostGetPage

func PostGetPage(pi, ps int) ([]Post, error)

func PostGetPageByTid

func PostGetPageByTid(tid uint, pi, ps int) []Post

func (Post) TableName

func (Post) TableName() string

type PostTag

type PostTag struct {
	ID        uint
	PostID    uint
	TagID     uint
	PostCount uint

	TagValue string `gorm:"-"`
	TagName  string `gorm:"-"`
}

func PostTagCountGroupByTid

func PostTagCountGroupByTid() []PostTag

func PostTagGetByPids

func PostTagGetByPids(pids []uint) []PostTag

func PostTagsGetByPid

func PostTagsGetByPid(pid uint) []PostTag

func (PostTag) TableName

func (PostTag) TableName() string

type Tag

type Tag struct {
	gorm.Model
	Value string
	Name  string
}

func TagGetAll

func TagGetAll() ([]*Tag, error)

func TagGetByValue

func TagGetByValue(value string) *Tag

func (Tag) TableName

func (Tag) TableName() string

Jump to

Keyboard shortcuts

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