service

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLogin = errors.New("Password Or Username Incorrect")

Functions

func ExtractMenu

func ExtractMenu(html string) string

func Initialize

func Initialize(ctx context.Context)

func ParseMarkdown2HTML

func ParseMarkdown2HTML(md []byte) (cnt string)

ParseMarkdown2HTML parse markdown to string

Types

type Type

type Type struct {
	// contains filtered or unexported fields
}
var Instance *Type

func New

func New(dao *dao.Type) *Type

func (*Type) IsNameExists

func (s *Type) IsNameExists(name string) (bool, error)

func (*Type) LoadAllCategories

func (s *Type) LoadAllCategories() (cates []*model.Category, err error)

func (*Type) LoadCategoryByID

func (s *Type) LoadCategoryByID(cateid bson.ObjectId) (cate *model.Category, err error)

func (*Type) LoadCategoryByName

func (s *Type) LoadCategoryByName(name string) (cate *model.Category, err error)

func (*Type) LoadCategoryByURL

func (s *Type) LoadCategoryByURL(url string) (cate *model.Category, err error)

func (*Type) LoadPostInfo

func (s *Type) LoadPostInfo() (*dto.PostInfo, error)

func (*Type) LoadPostSeries

func (s *Type) LoadPostSeries(id bson.ObjectId, key string) (se []*model.PostSeries, err error)

func (*Type) LoadPosts

func (s *Type) LoadPosts(cfg *dto.PostCfg) (results []*model.Post, err error)

func (*Type) LoadUserByID

func (s *Type) LoadUserByID(uid bson.ObjectId) (user *model.User, err error)

func (*Type) NewPost

func (s *Type) NewPost(authorID bson.ObjectId, title, name, md, ptype string) (post *model.Post, err error)

NewPost insert new post

  • title: post title
  • name: post url
  • md: post markdown content
  • ptype: post type, markdown/slide

func (*Type) UpdatePost

func (s *Type) UpdatePost(user *model.User,
	name string,
	title string,
	md string,
	typeArg string) (p *model.Post, err error)

func (*Type) UpdatePostCategory

func (s *Type) UpdatePostCategory(name, category string) (p *model.Post, err error)

UpdatePostCategory change blog post's category

func (*Type) ValidateAndGetUser

func (s *Type) ValidateAndGetUser(ctx context.Context) (user *model.User, err error)

func (*Type) ValidateLogin

func (s *Type) ValidateLogin(account, password string) (u *model.User, err error)

Jump to

Keyboard shortcuts

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