daos

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTag

func AddTag(tag model.Tag) (id int, err error)

func AddUser

func AddUser(user model.User) (id int, err error)

func CategoryDelete

func CategoryDelete(category model.Category) (id int, err error)

func CategorySave

func CategorySave(category model.Category) (id int, err error)

func GetCategories

func GetCategories() (categories []model.Category, err error)

func GetCategory

func GetCategory(id int) (category model.Category)

func GetCategoryIdsByName

func GetCategoryIdsByName(name string) (categoryIds []string, err error)

func GetDB

func GetDB() *sql.DB

GetDB 返回默认的数据库

func GetPage

func GetPage(id string) (page model.Page)

func GetPageByIdent

func GetPageByIdent(ident string) (page model.Page)

func GetPages

func GetPages(params PageParams) (pages []model.Page, err error)

func GetPost

func GetPost(id string) (post model.Post)

func GetPostCountByTagId

func GetPostCountByTagId(id string) (int, error)

func GetPostIdsByContent

func GetPostIdsByContent(content string) ([]string, error)

func GetPosts

func GetPosts(params PostParams) (posts []model.Post, err error)

func GetTagIdsByName

func GetTagIdsByName(name string) (tagIds []string, err error)

func GetTags

func GetTags() (tags []model.Tag, err error)

func GetUser

func GetUser(email string) (user model.User)

func IncrTagCount

func IncrTagCount(id string)

func IncrView

func IncrView(id string)

func Init

func Init(cfg *mysql.Config) *sql.DB

Init 初始化数据库

func PageDelete

func PageDelete(page model.Page) (id int, err error)

func PageSave

func PageSave(page model.Page) (id int, err error)

func PostDelete

func PostDelete(post model.Post) (id int, err error)

func PostSave

func PostSave(post model.Post) (id int, err error)

Types

type PageParams

type PageParams struct {
	PerPage int
	Page    int
}

type PostParams

type PostParams struct {
	Ids        map[string][]string
	CategoryId string
	TagId      string
	PerPage    int
	Page       int
	Keyword    string
}

Jump to

Keyboard shortcuts

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