service

package
v0.0.0-...-fc62a26 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	ID            uint32     `json:"id"`
	Title         string     `json:"title"`
	Desc          string     `json:"desc"`
	Content       string     `json:"content"`
	CoverImageUrl string     `json:"cover_image_url"`
	State         uint8      `json:"state"`
	Tag           *model.Tag `json:"tag"`
}

type ArticleListRequest

type ArticleListRequest struct {
	TagID uint32 `form:"tag_id" binding:"gte=1"`
	State uint8  `form:"state,default=1" binding:"oneof=0 1"`
}

type ArticleRequest

type ArticleRequest struct {
	ID    uint32 `form:"id" binding:"required,gte=1"`
	State uint8  `form:"state,default=1" binding:"oneof=0 1"`
}

type AuthRequest

type AuthRequest struct {
	AppKey    string `form:"app_key" binding:"required"`
	AppSecret string `form:"app_secret" binding:"required"`
}

type CountTagRequest

type CountTagRequest struct {
	Name  string `form:"name" binding:"max=100"`
	State uint8  `form:"state,default=1" binding:"oneof=0 1"`
}

type CreateArticleRequest

type CreateArticleRequest struct {
	TagID         uint32 `form:"tag_id" binding:"required,gte=1"`
	Title         string `form:"title" binding:"required,min=2,max=100"`
	Desc          string `form:"desc" binding:"required,min=2,max=255"`
	Content       string `form:"content" binding:"required,min=2,max=4294967295"`
	CoverImageUrl string `form:"cover_image_url" binding:"required,url"`
	CreatedBy     string `form:"created_by" binding:"required,min=2,max=100"`
	State         uint8  `form:"state,default=1" binding:"oneof=0 1"`
}

type CreateTagRequest

type CreateTagRequest struct {
	Name      string `form:"name" binding:"required,min=2,max=100"`
	CreatedBy string `form:"created_by" binding:"required,min=2,max=100"`
	State     uint8  `form:"state,default=1" binding:"oneof=0 1"`
}

type DeleteArticleRequest

type DeleteArticleRequest struct {
	ID uint32 `form:"id" binding:"required,gte=1"`
}

type DeleteTagRequest

type DeleteTagRequest struct {
	ID uint32 `form:"id" binding:"required,gte=1"`
}

type FileInfo

type FileInfo struct {
	Name      string
	AccessUrl string
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context) Service

func (*Service) CheckAuth

func (svc *Service) CheckAuth(param *AuthRequest) error

func (*Service) CountTag

func (svc *Service) CountTag(param *CountTagRequest) (int, error)

func (*Service) CreateArticle

func (svc *Service) CreateArticle(param *CreateArticleRequest) error

func (*Service) CreateTag

func (svc *Service) CreateTag(param *CreateTagRequest) error

func (*Service) DeleteArticle

func (svc *Service) DeleteArticle(param *DeleteArticleRequest) error

func (*Service) DeleteTag

func (svc *Service) DeleteTag(param *DeleteTagRequest) error

func (*Service) GetArticle

func (svc *Service) GetArticle(param *ArticleRequest) (*Article, error)

func (*Service) GetArticleList

func (svc *Service) GetArticleList(param *ArticleListRequest, pager *app.Pager) ([]*Article, int, error)

func (*Service) GetTagList

func (svc *Service) GetTagList(param *TagListRequest, pager *app.Pager) ([]*model.Tag, error)

func (*Service) UpdateArticle

func (svc *Service) UpdateArticle(param *UpdateArticleRequest) error

func (*Service) UpdateTag

func (svc *Service) UpdateTag(param *UpdateTagRequest) error

func (*Service) UploadFile

func (svc *Service) UploadFile(fileType upload.FileType, file multipart.File, fileHeader *multipart.FileHeader) (*FileInfo, error)

type TagListRequest

type TagListRequest struct {
	Name  string `form:"name" binding:"max=100"`
	State uint8  `form:"state,default=1" binding:"oneof=0 1"`
}

type UpdateArticleRequest

type UpdateArticleRequest struct {
	ID            uint32 `form:"id" binding:"required,gte=1"`
	TagID         uint32 `form:"tag_id" binding:"required,gte=1"`
	Title         string `form:"title" binding:"min=2,max=100"`
	Desc          string `form:"desc" binding:"min=2,max=255"`
	Content       string `form:"content" binding:"min=2,max=4294967295"`
	CoverImageUrl string `form:"cover_image_url" binding:"url"`
	ModifiedBy    string `form:"modified_by" binding:"required,min=2,max=100"`
	State         uint8  `form:"state,default=1" binding:"oneof=0 1"`
}

type UpdateTagRequest

type UpdateTagRequest struct {
	ID         uint32 `form:"id" binding:"required,gte=1"`
	Name       string `form:"name" binding:"max=100"`
	State      uint8  `form:"state" binding:"oneof=0 1"`
	ModifiedBy string `form:"modified_by" binding:"required,min=2,max=100"`
}

Jump to

Keyboard shortcuts

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