Documentation ¶
Index ¶
- type Article
- type ArticleListRequest
- type ArticleRequest
- type AuthRequest
- type CountTagRequest
- type CreateArticleRequest
- type CreateTagRequest
- type DeleteArticleRequest
- type DeleteTagRequest
- type FileInfo
- type Service
- func (svc *Service) CheckAuth(param *AuthRequest) error
- func (svc *Service) CountTag(param *CountTagRequest) (int, error)
- func (svc *Service) CreateTag(param *CreateTagRequest) error
- func (svc *Service) DeleteTag(param *DeleteTagRequest) error
- func (svc *Service) GetTagList(param *TagListRequest, pager *app.Pager) ([]*model.Tag, error)
- func (svc *Service) UpdateTag(param *UpdateTagRequest) error
- func (svc *Service) UploadFile(fileType upload.FileType, file multipart.File, ...) (*FileInfo, error)
- type TagListRequest
- type UpdateArticleRequest
- type UpdateTagRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArticleListRequest ¶
type ArticleRequest ¶
type AuthRequest ¶
type CountTagRequest ¶
type CountTagRequest struct { Name string `form:"name" binding:"max=100"` State uint8 `form:"state,default=1" binding:"oneof=0 1"` }
CountTagRequest 定义了 Request 结构体作为接口入参的基准,而本项目由于并不会太复杂,所以直接放在了 service 层中便于使用 若后续业务不断增长,程序越来越复杂,service 也冗杂了,可以考虑将抽离一层接口校验层,便于解耦逻辑。
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 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 Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) CheckAuth ¶
func (svc *Service) CheckAuth(param *AuthRequest) error
CheckAuth 查询数据库只为了校验是否存在这条记录
func (*Service) CreateTag ¶
func (svc *Service) CreateTag(param *CreateTagRequest) error
func (*Service) DeleteTag ¶
func (svc *Service) DeleteTag(param *DeleteTagRequest) error
func (*Service) GetTagList ¶
func (*Service) UpdateTag ¶
func (svc *Service) UpdateTag(param *UpdateTagRequest) error
type TagListRequest ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.