biz

package
v0.0.0-...-6fd7e0b Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 24 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrApiGroupNotFound is api group not found.
	ErrApiGroupNotFound = errors.NotFound("102404", "api group not found")
)
View Source
var (
	// ErrApiNotFound is api not found.
	ErrApiNotFound = errors.NotFound("101404", "api not found")
)
View Source
var (
	// ErrArticleContentNotFound is article content  not found.
	ErrArticleContentNotFound = errors.NotFound("104404", "article content not found")
)
View Source
var (
	// ErrArticleNotFound is article not found.
	ErrArticleNotFound = errors.NotFound("103404", "article not found")
)
View Source
var (
	// ErrCategoryNotFound is category not found.
	ErrCategoryNotFound = errors.NotFound("105404", "category not found")
)
View Source
var (
	// ErrCommentAgentNotFound is common agent not found.
	ErrCommentAgentNotFound = errors.NotFound("106404", "common agent not found")
)
View Source
var (
	// ErrCommentContentNotFound is comment content  not found.
	ErrCommentContentNotFound = errors.NotFound("107404", "comment content not found")
)
View Source
var (
	// ErrCommentIndexNotFound is comment index not found.
	ErrCommentIndexNotFound = errors.NotFound("108404", "comment index not found")
)
View Source
var (
	// ErrFileLibConfigNotFound is file lib config not found.
	ErrFileLibConfigNotFound = errors.NotFound("110404", "file lib config not found")
)
View Source
var (
	// ErrFileLibNotFound is file lib not found.
	ErrFileLibNotFound = errors.NotFound("109404", "file lib not found")
)
View Source
var (
	// ErrFileLibTypeNotFound is file lib type not found.
	ErrFileLibTypeNotFound = errors.NotFound("111404", "file lib type not found")
)
View Source
var (
	// ErrLinkNotFound is link not found.
	ErrLinkNotFound = errors.NotFound("112404", "link not found")
)
View Source
var (
	// ErrMenusAgentNotFound is menus agent not found.
	ErrMenusAgentNotFound = errors.NotFound("114404", "menus agent not found")
)
View Source
var (
	// ErrMenusNotFound is menus not found.
	ErrMenusNotFound = errors.NotFound("113404", "menus not found")
)
View Source
var (
	// ErrRoleNotFound is role not found.
	ErrRoleNotFound = errors.NotFound("115404", "role not found")
)
View Source
var (
	// ErrShortLinkNotFound is short link not found.
	ErrShortLinkNotFound = errors.NotFound("116404", "short link not found")
)
View Source
var (
	// ErrSiteConfigNotFound is site config not found.
	ErrSiteConfigNotFound = errors.NotFound("117404", "site config not found")
)
View Source
var (
	// ErrTagNotFound is tag not found.
	ErrTagNotFound = errors.NotFound("118404", "tag not found")
)
View Source
var (
	// ErrUserNotFound is user not found.
	ErrUserNotFound = kerrors.NotFound("1002404", "user not found")
)

ProviderSet is biz providers.

Functions

This section is empty.

Types

type ApiDO

type ApiDO struct {
	metaV1.ObjectMeta
	ApiGroup    string
	Method      string
	Path        string
	Description string
	Identifier  string
	GroupId     uint64
}

type ApiDOList

type ApiDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*ApiDO `json:"items"`
}

type ApiDOListOption

type ApiDOListOption struct {
	metaV1.ListOptions `json:"page"`
	ApiDO              `json:"item"`
}

type ApiGroupDO

type ApiGroupDO struct {
	metaV1.ObjectMeta
	Name       string
	Identifier string
}

type ApiGroupDOList

type ApiGroupDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*ApiGroupDO `json:"items"`
}

type ApiGroupDOListOption

type ApiGroupDOListOption struct {
	metaV1.ListOptions `json:"page"`
	ApiGroupDO         `json:"item"`
}

type ApiGroupRepo

type ApiGroupRepo interface {
	Save(context.Context, *ApiGroupDO) (*ApiGroupDO, error)
	Update(context.Context, *ApiGroupDO) (*ApiGroupDO, error)
	//Delete(context.Context, uint64) error
	DeleteList(c context.Context, uids []uint64) error
	FindByID(context.Context, uint64) (*ApiGroupDO, error)
	ListAll(c context.Context, opts ApiGroupDOListOption) (*ApiGroupDOList, error)
}

type ApiGroupUsecase

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

func NewApiGroupUsecase

func NewApiGroupUsecase(repo ApiGroupRepo, logger log.Logger) *ApiGroupUsecase

func (*ApiGroupUsecase) Create

func (uc *ApiGroupUsecase) Create(ctx context.Context, obj *ApiGroupDO) (*ApiGroupDO, error)

func (*ApiGroupUsecase) DeleteList

func (uc *ApiGroupUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除用户

func (*ApiGroupUsecase) FindOneByID

func (uc *ApiGroupUsecase) FindOneByID(ctx context.Context, id uint64) (*ApiGroupDO, error)

FindOneByID 根据ID查询用户信息

func (*ApiGroupUsecase) ListAll

ListAll 批量查询

func (*ApiGroupUsecase) Update

func (uc *ApiGroupUsecase) Update(ctx context.Context, obj *ApiGroupDO) (*ApiGroupDO, error)

Update 更新用户

type ApiRepo

type ApiRepo interface {
	Save(context.Context, *ApiDO) (*ApiDO, error)
	Update(context.Context, *ApiDO) (*ApiDO, error)
	Delete(context.Context, uint64) error
	DeleteList(c context.Context, uids []uint64) error
	FindByID(context.Context, uint64) (*ApiDO, error)
	ListAll(c context.Context, opts ApiDOListOption) (*ApiDOList, error)
}

type ApiTreeDO

type ApiTreeDO struct {
	ID          string
	ApiGroup    string
	Method      string
	Path        string
	Description string
	Identifier  string
	GroupId     uint64
	Children    []*ApiTreeDO
}

type ApiUsecase

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

func NewApiUsecase

func NewApiUsecase(repo ApiRepo, acg *ApiGroupUsecase, casbRepo CasbinRuleRepo, logger log.Logger) *ApiUsecase

func (*ApiUsecase) Create

func (uc *ApiUsecase) Create(ctx context.Context, obj *ApiDO) (*ApiDO, error)

func (*ApiUsecase) Delete

func (uc *ApiUsecase) Delete(ctx context.Context, id uint64) error

Delete 根据ID删除用户

func (*ApiUsecase) DeleteList

func (uc *ApiUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除用户

func (*ApiUsecase) FindOneByID

func (uc *ApiUsecase) FindOneByID(ctx context.Context, id uint64) (*ApiDO, error)

FindOneByID 根据ID查询用户信息

func (*ApiUsecase) ListAll

func (uc *ApiUsecase) ListAll(ctx context.Context, opts ApiDOListOption) (*ApiDOList, error)

ListAll 批量查询

func (*ApiUsecase) TreeAll

func (uc *ApiUsecase) TreeAll(ctx context.Context) ([]*ApiTreeDO, error)

func (*ApiUsecase) Update

func (uc *ApiUsecase) Update(ctx context.Context, obj *ApiDO) (*ApiDO, error)

Update 更新用户

type ArticleContentDO

type ArticleContentDO struct {
	ID          uint64
	StatusFlag  int
	Atype       int
	Content     string
	ContentHtml string
}

type ArticleContentRepo

ArticleContentRepo is a Greater repo.

type ArticleContentUsecase

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

ArticleContentUsecase is a ArticleDO usecase.

func NewArticleContentUsecase

func NewArticleContentUsecase(repo ArticleContentRepo, logger log.Logger) *ArticleContentUsecase

NewArticleContentUsecase new a ArticleDO usecase.

func (*ArticleContentUsecase) Create

Create creates a ArticleDO, and returns the new ArticleDO.

func (*ArticleContentUsecase) CreateByArticle

func (uc *ArticleContentUsecase) CreateByArticle(ctx context.Context, g *ArticleDO) (*ArticleContentDO, error)

func (*ArticleContentUsecase) Delete

func (uc *ArticleContentUsecase) Delete(ctx context.Context, id uint64) error

Delete 根据ID删除

func (*ArticleContentUsecase) DeleteList

func (uc *ArticleContentUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除

func (*ArticleContentUsecase) FindOneByID

func (uc *ArticleContentUsecase) FindOneByID(ctx context.Context, id uint64) (*ArticleContentDO, error)

FindOneByID 根据ID查询信息

func (*ArticleContentUsecase) ListAll

ListAll 批量查询

func (*ArticleContentUsecase) Update

Update 更新

func (*ArticleContentUsecase) UpdateByArticle

func (uc *ArticleContentUsecase) UpdateByArticle(ctx context.Context, g *ArticleDO) (*ArticleContentDO, error)

type ArticleDO

type ArticleDO struct {
	metaV1.ObjectMeta
	Title           string
	PermaLink       string
	CanonicalLink   string
	Summary         string
	Thumbnail       string
	Password        string
	Atype           int
	CategoryId      uint64
	CategoryName    string
	CommentAgentId  uint64
	CommentFlag     bool
	Published       bool
	ViewCount       int32
	CommentCount    int32
	LikeCount       int32
	HateCount       int32
	Nickname        string
	PublishedAt     time.Time
	TagStrings      []string
	Tags            []*TagsDO
	Category        *CategoryDO
	Content         string
	ContentHtml     string
	TagName         string
	Resource        []*ArticleResourceDO
	ResourceStrings []string
	ResourceCount   int64
}

ArticleDO is a ArticleDO model.

type ArticleDOList

type ArticleDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*ArticleDO `json:"items"`
}

type ArticleDOListOption

type ArticleDOListOption struct {
	metaV1.ListOptions `json:"page"`
	ArticleDO          `json:"item"`
}

type ArticleRepo

type ArticleRepo interface {
	Save(context.Context, *ArticleDO) (*ArticleDO, error)
	Update(context.Context, *ArticleDO) (*ArticleDO, error)
	Delete(context.Context, uint64) error
	DeleteList(c context.Context, uids []uint64) error
	FindByID(context.Context, uint64) (*ArticleDO, error)
	FindByAgentID(context.Context, uint64) (*ArticleDO, error)
	CountByPermaLink(ctx context.Context, str string) (int64, error)
	ListAll(context.Context, ArticleDOListOption) (*ArticleDOList, error)
	FindByLink(ctx context.Context, link string) (*ArticleDO, error)
	SetArticleCache(ctx context.Context, user *ArticleDO, key string)
	GetUserFromCache(ctx context.Context, key string) (*ArticleDO, error)
	UpdateCommentContByAgentIds(context.Context) error
	UpdateAllPostsCount(context.Context)
	AddPostViewCount(context.Context, uint64, string)
	GetPostViewCount(context.Context, uint64) int64
}

ArticleRepo is a Greater repo.

type ArticleResourceDO

type ArticleResourceDO struct {
	metaV1.ObjectMeta
	ArticleID uint64
	Name      string
	Url       string
	Password  string
}

type ArticleResourceRepo

type ArticleResourceRepo interface {
	CreateInBatches(ctx context.Context, articleID uint64, articleResource []*ArticleResourceDO) error
	UpdateInBatches(ctx context.Context, articleResource []*ArticleResourceDO) error
	FindAllByArticleID(ctx context.Context, articleId uint64) ([]*ArticleResourceDO, error)
	FindAllByArticlePermaLink(ctx context.Context, permaLink string) ([]*ArticleResourceDO, error)
	DeleteByArticleID(ctx context.Context, articleId uint64) error
	DeleteByIDs(ctx context.Context, ids []uint64) error
	CountByArticleID(ctx context.Context, articleId uint64) (int64, error)
}

type ArticleResourceUsecase

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

func NewArticleResourceUsecase

func NewArticleResourceUsecase(repo ArticleResourceRepo, logger log.Logger) *ArticleResourceUsecase

NewArticleResourceUsecase new a ArticleResourceDO usecase.

func (*ArticleResourceUsecase) CountByArticleID

func (uc *ArticleResourceUsecase) CountByArticleID(ctx context.Context, articleId uint64) int64

func (*ArticleResourceUsecase) FindAllByArticleID

func (uc *ArticleResourceUsecase) FindAllByArticleID(ctx context.Context, aid uint64) ([]*ArticleResourceDO, error)
func (uc *ArticleResourceUsecase) FindAllByArticlePermaLink(ctx context.Context, permaLink string) ([]*ArticleResourceDO, error)

func (*ArticleResourceUsecase) SaveResourcesForArticle

func (uc *ArticleResourceUsecase) SaveResourcesForArticle(ctx context.Context, articleID uint64, articleResources []*ArticleResourceDO) error

func (*ArticleResourceUsecase) UpdateResourcesByOldFiles

func (uc *ArticleResourceUsecase) UpdateResourcesByOldFiles(ctx context.Context, articleID uint64, needLen int,
	oldList []*ArticleResourceDO, articleResources []*ArticleResourceDO) error

func (*ArticleResourceUsecase) UpdateResourcesForArticle

func (uc *ArticleResourceUsecase) UpdateResourcesForArticle(ctx context.Context, articleID uint64, articleResources []*ArticleResourceDO) error

type ArticleTagsDO

type ArticleTagsDO struct {
	ArticleID uint64
	TagID     uint64
}

type ArticleTagsRepo

type ArticleTagsRepo interface {
	CreateInBatches(ctx context.Context, articleTags []*ArticleTagsDO) error
	UpdateInBatches(ctx context.Context, articleTags []*ArticleTagsDO) error
	DeleteByArticleID(ctx context.Context, articleId uint64) error
}

type ArticleTagsUsecase

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

func NewArticleTagsUsecase

func NewArticleTagsUsecase(repo ArticleTagsRepo, tu *TagsUsecase, logger log.Logger) *ArticleTagsUsecase

NewArticleTagsUsecase new a ArticleDO usecase.

func (*ArticleTagsUsecase) FindAllByArticleID

func (uc *ArticleTagsUsecase) FindAllByArticleID(ctx context.Context, aid uint64) ([]*TagsDO, error)

func (*ArticleTagsUsecase) SaveTagsForArticle

func (uc *ArticleTagsUsecase) SaveTagsForArticle(ctx context.Context, article *ArticleDO) error

func (*ArticleTagsUsecase) UpdateRoleForUser

func (uc *ArticleTagsUsecase) UpdateRoleForUser(ctx context.Context, article *ArticleDO) error

type ArticleUsecase

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

ArticleUsecase is a ArticleDO usecase.

func NewArticleUsecase

NewArticleUsecase new a ArticleDO usecase.

func (*ArticleUsecase) AddPostViewCount

func (uc *ArticleUsecase) AddPostViewCount(ctx context.Context, id uint64, ip string)

func (*ArticleUsecase) Create

func (uc *ArticleUsecase) Create(ctx context.Context, g *ArticleDO) (*ArticleDO, error)

Create creates a ArticleDO, and returns the new ArticleDO.

func (*ArticleUsecase) Delete

func (uc *ArticleUsecase) Delete(ctx context.Context, id uint64) error

Delete 根据ID删除

func (*ArticleUsecase) DeleteList

func (uc *ArticleUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除

func (*ArticleUsecase) FindOneByAgentID

func (uc *ArticleUsecase) FindOneByAgentID(ctx context.Context, id uint64) (*ArticleDO, error)

FindOneByAgentID 根据ID查询信息

func (*ArticleUsecase) FindOneByID

func (uc *ArticleUsecase) FindOneByID(ctx context.Context, id uint64) (*ArticleDO, error)

FindOneByID 根据ID查询信息

func (uc *ArticleUsecase) FindOneByLink(ctx context.Context, link string) (*ArticleDO, error)

func (*ArticleUsecase) GeneratorMapListAll

func (uc *ArticleUsecase) GeneratorMapListAll(ctx context.Context, opts ArticleDOListOption) (*ArticleDOList, error)

func (*ArticleUsecase) GetPostViewCount

func (uc *ArticleUsecase) GetPostViewCount(ctx context.Context, id uint64) int64
func (uc *ArticleUsecase) InitArticlePermaLink(ctx context.Context, title string) string

func (*ArticleUsecase) ListAll

ListAll 批量查询

func (*ArticleUsecase) ListAllForWeb

func (uc *ArticleUsecase) ListAllForWeb(ctx context.Context, opts ArticleDOListOption) (*ArticleDOList, error)

func (*ArticleUsecase) Update

func (uc *ArticleUsecase) Update(ctx context.Context, g *ArticleDO) (*ArticleDO, error)

Update 更新

func (*ArticleUsecase) UpdateAllPostsCount

func (uc *ArticleUsecase) UpdateAllPostsCount(ctx context.Context)

func (*ArticleUsecase) UpdateCommentContByAgentIds

func (uc *ArticleUsecase) UpdateCommentContByAgentIds(ctx context.Context) error

UpdateCommentContByAgentIds 更新评论总数

type ArticleVisitorDO

type ArticleVisitorDO struct {
	ID        uint64
	ArticleId uint64
	Ip        string
	Agent     string
	Atype     int
	CreatedAt *time.Time
	UpdatedAt *time.Time
}

type ArticleVisitorRepo

type ArticleVisitorRepo interface {
	Save(context.Context, *ArticleVisitorDO) (*ArticleVisitorDO, error)
}

type ArticleVisitorUsecase

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

func NewArticleVisitorUsecase

func NewArticleVisitorUsecase(repo ArticleVisitorRepo, logger log.Logger) *ArticleVisitorUsecase

func (*ArticleVisitorUsecase) Create

type CasbinRuleDO

type CasbinRuleDO struct {
	metaV1.ObjectNoInstMeta
	PType string
	V0    string
	V1    string
	V2    string
	V3    string
	V4    string
	V5    string
}

type CasbinRuleRepo

type CasbinRuleRepo interface {
	SaveRoleForUser(ctx context.Context, user string, roles []string, domain ...string) (bool, error)
	UpdateRoleForUser(ctx context.Context, user string, roles []string, domain ...string) (bool, error)
	SavePolicies(ctx context.Context, rules [][]string) (bool, error)
	CleanPolicy(ctx context.Context, p ...string) (bool, error)
	UpdatePolicies(ctx context.Context, oldApi, newApi *ApiDO) (bool, error)
	DeleteRoleForUser(ctx context.Context, user string, domain ...string) (bool, error)
}

type CasbinRuleUsecase

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

func NewCasbinRuleUsecase

func NewCasbinRuleUsecase(repo CasbinRuleRepo, logger log.Logger) *CasbinRuleUsecase

type CategoryDO

type CategoryDO struct {
	metaV1.ObjectMeta
	Name        string
	Identifier  string
	Description string
	ParentId    uint64
	Children    []*CategoryDO // 子集
}

type CategoryDOList

type CategoryDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*CategoryDO `json:"items"`
}

type CategoryDOListOption

type CategoryDOListOption struct {
	metaV1.ListOptions `json:"page"`
	CategoryDO         `json:"item"`
}

type CategoryRepo

type CategoryRepo interface {
	Save(context.Context, *CategoryDO) (*CategoryDO, error)
	Update(context.Context, *CategoryDO) (*CategoryDO, error)
	//Delete(context.Context, uint64) error
	DeleteList(c context.Context, uids []uint64) error
	FindByID(context.Context, uint64) (*CategoryDO, error)
	CountByIdentifier(ctx context.Context, str string) (int64, error)
	ListAll(c context.Context, opts CategoryDOListOption) (*CategoryDOList, error)
	ListAllWithChildren(c context.Context, opts CategoryDOListOption) (*CategoryDOList, error)
	FindByIdentifier(ctx context.Context, name string) (*CategoryDO, error)
}

type CategoryUsecase

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

func NewCategoryUsecase

func NewCategoryUsecase(repo CategoryRepo, logger log.Logger) *CategoryUsecase

func (*CategoryUsecase) Create

func (uc *CategoryUsecase) Create(ctx context.Context, obj *CategoryDO) (*CategoryDO, error)

func (*CategoryUsecase) DeleteList

func (uc *CategoryUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除用户

func (*CategoryUsecase) FindByIdentifier

func (uc *CategoryUsecase) FindByIdentifier(ctx context.Context, name string) (*CategoryDO, error)

func (*CategoryUsecase) FindOneByID

func (uc *CategoryUsecase) FindOneByID(ctx context.Context, id uint64) (*CategoryDO, error)

FindOneByID 根据ID查询用户信息

func (*CategoryUsecase) ListAll

ListAll 批量查询

func (*CategoryUsecase) Update

func (uc *CategoryUsecase) Update(ctx context.Context, obj *CategoryDO) (*CategoryDO, error)

Update 更新

type CommentAgentDO

type CommentAgentDO struct {
	metaV1.ObjectMeta
	ObjId     uint64
	ObjType   int32
	MemberId  uint64
	Count     int32
	RootCount int32
	AllCount  int32
	Attrs     string
}

CommentAgentDO is a CommentAgentDO model.

type CommentAgentRepo

type CommentAgentRepo interface {
	Save(context.Context, *CommentAgentDO) (*CommentAgentDO, error)
	Update(context.Context, *CommentAgentDO) (*CommentAgentDO, error)
	FindByID(context.Context, uint64) (*CommentAgentDO, error)
	UpdateAddCountById(context.Context, uint64, bool) error
	UpdateMinusCountById(context.Context, uint64, bool) error
}

CommentAgentRepo is a Greater repo.

type CommentAgentUsecase

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

CommentIndexUsecase is a CommentAgentDO usecase.

func NewCommentAgentUsecase

func NewCommentAgentUsecase(repo CommentAgentRepo, logger log.Logger) *CommentAgentUsecase

NewCommentAgentUsecase new a CommentAgentDO usecase.

func (*CommentAgentUsecase) CreateCommentAgent

func (uc *CommentAgentUsecase) CreateCommentAgent(ctx context.Context, g *CommentAgentDO) (*CommentAgentDO, error)

CreateCommentAgent creates a CommentAgentDO, and returns the new CommentAgentDO.

func (*CommentAgentUsecase) FindByID

func (uc *CommentAgentUsecase) FindByID(ctx context.Context, id uint64) (*CommentAgentDO, error)

FindByID 根据ID查询

func (*CommentAgentUsecase) Update

Update 更新

func (*CommentAgentUsecase) UpdateAddCountById

func (uc *CommentAgentUsecase) UpdateAddCountById(ctx context.Context, id uint64, isRoot bool) error

func (*CommentAgentUsecase) UpdateMinusCountById

func (uc *CommentAgentUsecase) UpdateMinusCountById(ctx context.Context, id uint64, isRoot bool) error

type CommentContentDO

type CommentContentDO struct {
	metaV1.ObjectMeta
	AgentId        uint64
	MemberId       uint64
	AtMemberIds    string
	Agent          string
	MemberName     string
	Ip             string
	Email          string
	Url            string
	RootId         uint64
	Content        string
	Attrs          string
	ParentUserName string
	ObjTitle       string
	ObjLink        string
	Avatar         string
	Count          int32
	RootCount      int32
	EmailState     int32
	Children       []*CommentContentDO
}

type CommentContentDOList

type CommentContentDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*CommentContentDO `json:"items"`
}

type CommentContentDOListOption

type CommentContentDOListOption struct {
	metaV1.ListOptions `json:"page"`
	CommentContentDO   `json:"item"`
	IsWeb              bool
	IsChild            bool
}

type CommentContentRepo

type CommentContentRepo interface {
	Save(context.Context, *CommentContentDO) (*CommentContentDO, error)
	Update(context.Context, *CommentContentDO) (*CommentContentDO, error)
	UpdaeStateByIDs(context.Context, []uint64, int) error
	UpdaeCommentById(context.Context, uint64, string) error
	DeleteList(c context.Context, uids []uint64) error
	FindByID(context.Context, uint64) (*CommentContentDO, error)
	FindParentByID(context.Context, uint64) (*CommentContentDO, error)
	ListAll(context.Context, CommentContentDOListOption) (*CommentContentDOList, error)
	CountByState(context.Context, int) (int64, error)
	UpdaeEmailStateById(context.Context, uint64, int32) error
	FindAllByParentID(context.Context, uint64, int) ([]*CommentContentDO, error)
}

CommentAgentRepo is a Greater repo.

type CommentContentUsecase

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

CommentContentUsecase is a CommentAgentDO usecase.

func NewCommentContentUsecase

func NewCommentContentUsecase(repo CommentContentRepo, logger log.Logger,
	au *ArticleUsecase, ci *CommentIndexUsecase, uu *UserUsecase,
) *CommentContentUsecase

NewCommentContentUsecase new a CommentContentDO usecase.

func (*CommentContentUsecase) CountAll

func (*CommentContentUsecase) CreateCommentContent

func (uc *CommentContentUsecase) CreateCommentContent(ctx context.Context, g *CommentContentDO) (*CommentContentDO, error)

CreateCommentContent creates a CommentContentDO, and returns the new CommentContentDO.

func (*CommentContentUsecase) DeleteList

func (uc *CommentContentUsecase) DeleteList(ctx context.Context, ids []uint64) error

func (*CommentContentUsecase) FindAllByParentID

func (uc *CommentContentUsecase) FindAllByParentID(ctx context.Context, id uint64, size int) ([]*CommentContentDO, error)

func (*CommentContentUsecase) FindByID

FindByID 根据ID查询

func (*CommentContentUsecase) ListAll

func (*CommentContentUsecase) UpdaeCommentById

func (uc *CommentContentUsecase) UpdaeCommentById(ctx context.Context, id uint64, comment string) error

func (*CommentContentUsecase) UpdaeEmailStateById

func (uc *CommentContentUsecase) UpdaeEmailStateById(ctx context.Context, id uint64, state int32) error

func (*CommentContentUsecase) Update

Update 更新

func (*CommentContentUsecase) UpdateStateByIDs

func (uc *CommentContentUsecase) UpdateStateByIDs(ctx context.Context, ids []uint64, state int) error

type CommentCount

type CommentCount struct {
	Total        int64 // 总共
	NowTotal     int64 // 当前已审核
	PendingTotal int64 // 待审核

}

type CommentDO

type CommentDO struct {
	metaV1.ObjectMeta
	AgentId        uint64
	MemberId       uint64
	AtMemberIds    string
	Agent          string
	MemberName     string
	Ip             string
	Email          string
	Url            string
	RootId         uint64
	ParentId       uint64
	Content        string
	Meta           string
	ParentUserName string
	ObjTitle       string
	ObjLink        string
	Avatar         string
	EmailState     int32
}

type CommentDOList

type CommentDOList struct {
	metaV1.ListMeta
	Agent *CommentAgentDO
	Items []*CommentContentDO
}

type CommentIndexDO

type CommentIndexDO struct {
	metaV1.ObjectMeta
	AgentId   uint64
	ObjId     uint64
	ObjType   int32
	MemberId  uint64
	RootId    uint64
	ParentId  uint64
	Floor     int32
	Count     int32
	RootCount int32
	LikeCount int32
	HateCount int32
	Attrs     string
}

type CommentIndexRepo

type CommentIndexRepo interface {
	Save(context.Context, *CommentIndexDO) (*CommentIndexDO, error)
	Update(context.Context, *CommentIndexDO) (*CommentIndexDO, error)
	UpdaeStateByIDs(context.Context, []uint64, int) error
	UpdateAddCountById(context.Context, uint64, bool) error
	UpdateMinusCountById(context.Context, uint64, bool) error
	FindByID(context.Context, uint64) (*CommentIndexDO, error)
	FindAllByParentID(context.Context, uint64) ([]*CommentIndexDO, error)
	DeleteList(c context.Context, uids []uint64) error
	UpdateObjIdByAgentIds(context.Context) error
}

CommentAgentRepo is a Greater repo.

type CommentIndexUsecase

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

CommentIndexUsecase is a CommentAgentDO usecase.

func NewCommentIndexUsecase

func NewCommentIndexUsecase(repo CommentIndexRepo, logger log.Logger) *CommentIndexUsecase

NewCommentIndexUsecase new a CommentIndexDO usecase.

func (*CommentIndexUsecase) CreateCommentIndex

func (uc *CommentIndexUsecase) CreateCommentIndex(ctx context.Context, g *CommentIndexDO) (*CommentIndexDO, error)

CreateCommentIndex creates a CommentIndexDO, and returns the new CommentIndexDO.

func (*CommentIndexUsecase) CreateCommentIndexByContent

func (uc *CommentIndexUsecase) CreateCommentIndexByContent(ctx context.Context, g *CommentContentDO) (*CommentIndexDO, error)

func (*CommentIndexUsecase) DeleteList

func (uc *CommentIndexUsecase) DeleteList(ctx context.Context, ids []uint64) error

func (*CommentIndexUsecase) FindAllByParentID

func (uc *CommentIndexUsecase) FindAllByParentID(ctx context.Context, id uint64) ([]*CommentIndexDO, error)

func (*CommentIndexUsecase) FindByID

func (uc *CommentIndexUsecase) FindByID(ctx context.Context, id uint64) (*CommentIndexDO, error)

FindByID 根据ID查询

func (*CommentIndexUsecase) Update

Update 更新

func (*CommentIndexUsecase) UpdateAddCountById

func (uc *CommentIndexUsecase) UpdateAddCountById(ctx context.Context, id uint64, isRoot bool) error

func (*CommentIndexUsecase) UpdateMinusCountById

func (uc *CommentIndexUsecase) UpdateMinusCountById(ctx context.Context, id uint64, isRoot bool) error

func (*CommentIndexUsecase) UpdateObjIdByAgentIds

func (uc *CommentIndexUsecase) UpdateObjIdByAgentIds(ctx context.Context) error

func (*CommentIndexUsecase) UpdateStateByIDs

func (uc *CommentIndexUsecase) UpdateStateByIDs(ctx context.Context, ids []uint64, state int) error

type CommentUsecase

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

func (*CommentUsecase) CreateComment

func (uc *CommentUsecase) CreateComment(ctx context.Context, g *CommentDO) (*CommentContentDO, error)

CreateComment 新增评论

func (*CommentUsecase) CreateCommentWeb

func (uc *CommentUsecase) CreateCommentWeb(ctx context.Context, g *CommentDO, conf *conf.Qycms) (*CommentContentDO, error)

CreateCommentWeb 新增评论

func (*CommentUsecase) DeleteList

func (uc *CommentUsecase) DeleteList(ctx context.Context, ids []uint64) error

func (*CommentUsecase) EmailToNotSend

func (uc *CommentUsecase) EmailToNotSend(ctx context.Context, conf *conf.Qycms)

func (*CommentUsecase) EmailToSend

func (uc *CommentUsecase) EmailToSend(ctx context.Context, items []*CommentContentDO, conf *conf.Qycms, siteInfo map[string]string)

func (*CommentUsecase) ListAllForWeb

func (*CommentUsecase) ListAllNeedEmail

func (uc *CommentUsecase) ListAllNeedEmail(ctx context.Context, opts CommentContentDOListOption) *CommentDOList

func (*CommentUsecase) UpdateAddCount

func (uc *CommentUsecase) UpdateAddCount(ctx context.Context, idx *CommentIndexDO)

func (*CommentUsecase) UpdateCommentComent

func (uc *CommentUsecase) UpdateCommentComent(ctx context.Context, g *CommentDO) error

UpdateCommentComent 更新评论内容

func (*CommentUsecase) UpdateCommentState

func (uc *CommentUsecase) UpdateCommentState(ctx context.Context, ids []uint64, state int) error

UpdateCommentState 更新状态

func (*CommentUsecase) UpdateContentCountAndObjIds

func (uc *CommentUsecase) UpdateContentCountAndObjIds(ctx context.Context) error

UpdateContentCountAndObjIds 更新文章的评论数和评论的objId等

func (*CommentUsecase) UpdateMinusCount

func (uc *CommentUsecase) UpdateMinusCount(ctx context.Context, idx *CommentIndexDO)

type FileLibConfigDO

type FileLibConfigDO struct {
	metaV1.ObjectMeta
	AccessKey string
	SecretKey string
	Bucket    string
	Prefix    string
	Domain    string
	Endpoint  string
	TypeId    uint64
}

type FileLibConfigRepo

type FileLibConfigRepo interface {
	Save(ctx context.Context, data *FileLibConfigDO) (*FileLibConfigDO, error)
	Update(context.Context, *FileLibConfigDO) (*FileLibConfigDO, error)
	FindByID(context.Context, uint64) (*FileLibConfigDO, error)
	FindByTypeId(context.Context, uint64) (*FileLibConfigDO, error)
	SetTokenByTypeId(context.Context, uint64, string) (bool, error)
	GetTokenByTypeId(context.Context, uint64) (string, error)
}

type FileLibConfigUsecase

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

func NewFileLibConfigUsecase

func NewFileLibConfigUsecase(repo FileLibConfigRepo, logger log.Logger) *FileLibConfigUsecase

func (*FileLibConfigUsecase) FindById

func (uc *FileLibConfigUsecase) FindById(ctx context.Context, id uint64) (*FileLibConfigDO, error)

func (*FileLibConfigUsecase) FindByTypeId

func (uc *FileLibConfigUsecase) FindByTypeId(ctx context.Context, id uint64) (*FileLibConfigDO, error)

func (*FileLibConfigUsecase) GetTokenByTypeId

func (uc *FileLibConfigUsecase) GetTokenByTypeId(ctx context.Context, id uint64) (string, error)

func (*FileLibConfigUsecase) SaveOrUpdate

func (uc *FileLibConfigUsecase) SaveOrUpdate(ctx context.Context, data *FileLibConfigDO) (*FileLibConfigDO, error)

func (*FileLibConfigUsecase) SetTokenByTypeId

func (uc *FileLibConfigUsecase) SetTokenByTypeId(ctx context.Context, id uint64, token string) bool

type FileLibDO

type FileLibDO struct {
	metaV1.ObjectMeta
	OriginFileName string // 原始名称
	Fname          string // 文件名
	Fsize          uint64 // 文件大小
	Extention      string // 文件扩展名
	MimeType       string // 资源的 MIME 类型
	Fhash          string // 文件的HASH值
	Fmd5           string // 文件md5值
	RelativePath   string // 通过浏览器访问的相对路径
	Ftype          int    // 文件的存储类型,0为普通存储,1为低频存储
	EndUser        string // 文件上传时设置的endUser 七牛
	Domain         string // 域名
	DefUrl         string // 文件链接
}

type FileLibDOList

type FileLibDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*FileLibDO `json:"items"`
}

type FileLibDOListOption

type FileLibDOListOption struct {
	metaV1.ListOptions `json:"page"`
	FileLibDO          `json:"item"`
}

type FileLibRepo

type FileLibRepo interface {
	Save(ctx context.Context, data *FileLibDO) (*FileLibDO, error)
	Update(context.Context, *FileLibDO) (*FileLibDO, error)
	FindByMd5(context.Context, string) (*FileLibDO, error)
	CountByMd5(ctx context.Context, fmd5 string) (int64, error)
	DeleteList(c context.Context, uids []uint64) error
	ListAll(c context.Context, opts FileLibDOListOption) (*FileLibDOList, error)
}

type FileLibTypeDO

type FileLibTypeDO struct {
	metaV1.ObjectMeta
	Name       string
	Identifier int
	Ftype      string
}

type FileLibTypeDOList

type FileLibTypeDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*FileLibTypeDO `json:"items"`
}

type FileLibTypeDOListOption

type FileLibTypeDOListOption struct {
	metaV1.ListOptions `json:"page"`
	FileLibTypeDO      `json:"item"`
}

type FileLibTypeRepo

type FileLibTypeRepo interface {
	Save(ctx context.Context, data *FileLibTypeDO) (*FileLibTypeDO, error)
	Update(context.Context, *FileLibTypeDO) (*FileLibTypeDO, error)
	DeleteList(c context.Context, uids []uint64) error
	ListAll(c context.Context, opts FileLibTypeDOListOption) (*FileLibTypeDOList, error)
}

type FileLibTypeUsecase

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

func NewFileLibTypeUsecase

func NewFileLibTypeUsecase(repo FileLibTypeRepo, logger log.Logger) *FileLibTypeUsecase

NewFileLibTypeUsecase new a UserDO usecase.

func (*FileLibTypeUsecase) DeleteList

func (uc *FileLibTypeUsecase) DeleteList(ctx context.Context, ids []uint64) error

func (*FileLibTypeUsecase) ListAll

func (*FileLibTypeUsecase) Save

func (*FileLibTypeUsecase) Update

type FileLibUsecase

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

func NewFileLibUsecase

func NewFileLibUsecase(repo FileLibRepo, logger log.Logger) *FileLibUsecase

NewFileLibUsecase new a UserDO usecase.

func (*FileLibUsecase) CountByMd5

func (uc *FileLibUsecase) CountByMd5(ctx context.Context, fmd5 string) int64

func (*FileLibUsecase) DeleteList

func (uc *FileLibUsecase) DeleteList(ctx context.Context, ids []uint64) error

func (*FileLibUsecase) FindByMd5

func (uc *FileLibUsecase) FindByMd5(ctx context.Context, fmd5 string) (*FileLibDO, error)

func (*FileLibUsecase) ListAll

func (*FileLibUsecase) Save

func (uc *FileLibUsecase) Save(ctx context.Context, data *FileLibDO) (*FileLibDO, error)

func (*FileLibUsecase) Update

func (uc *FileLibUsecase) Update(ctx context.Context, data *FileLibDO) (*FileLibDO, error)

type LinkDO

type LinkDO struct {
	metaV1.ObjectMeta
	Name        string
	Url         string
	Description string
	Ftype       int32
}

type LinkDOList

type LinkDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*LinkDO `json:"items"`
}

type LinkDOListOption

type LinkDOListOption struct {
	metaV1.ListOptions `json:"page"`
	LinkDO             `json:"item"`
}

type LinkRepo

type LinkRepo interface {
	Save(context.Context, *LinkDO) (*LinkDO, error)
	Update(context.Context, *LinkDO) (*LinkDO, error)
	Delete(context.Context, uint64) error
	DeleteList(c context.Context, uids []uint64) error
	FindByID(context.Context, uint64) (*LinkDO, error)
	ListAll(c context.Context, opts LinkDOListOption) (*LinkDOList, error)
	FindIndexLinkAllWitchCache(context.Context) ([]*LinkDO, error)
	FindAllWitchCache(context.Context) ([]*LinkDO, error)
}

type LinkUsecase

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

func NewLinkUsecase

func NewLinkUsecase(repo LinkRepo, logger log.Logger) *LinkUsecase

func (*LinkUsecase) Create

func (uc *LinkUsecase) Create(ctx context.Context, obj *LinkDO) (*LinkDO, error)

func (*LinkUsecase) Delete

func (uc *LinkUsecase) Delete(ctx context.Context, id uint64) error

Delete 根据ID删除

func (*LinkUsecase) DeleteList

func (uc *LinkUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除

func (*LinkUsecase) FindAllWitchCache

func (uc *LinkUsecase) FindAllWitchCache(ctx context.Context) ([]*LinkDO, error)

func (*LinkUsecase) FindIndexLinkAllWitchCache

func (uc *LinkUsecase) FindIndexLinkAllWitchCache(ctx context.Context) ([]*LinkDO, error)

func (*LinkUsecase) FindOneByID

func (uc *LinkUsecase) FindOneByID(ctx context.Context, id uint64) (*LinkDO, error)

FindOneByID 根据ID查询信息

func (*LinkUsecase) ListAll

func (uc *LinkUsecase) ListAll(ctx context.Context, opts LinkDOListOption) (*LinkDOList, error)

ListAll 批量查询

func (*LinkUsecase) Update

func (uc *LinkUsecase) Update(ctx context.Context, obj *LinkDO) (*LinkDO, error)

Update 更新

type MenusAdminDO struct {
	metaV1.ObjectMeta
	Name           string          // 展示名称
	BreadcrumbName string          // 标签页名称
	Identifier     string          // 路由名称
	ParentId       uint64          // 父菜单ID
	Icon           string          // Icon图标
	MType          int             // 路由类型
	Path           string          // 路由 path
	Redirect       string          // 路由重定向
	Component      string          // 对应前端文件路径
	Sort           int             // 排序标记
	Children       []*MenusAdminDO // 子集
	HasChildren    bool            // 子集
}
type MenusAdminDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*MenusAdminDO `json:"items"`
}
type MenusAdminDOListOption struct {
	metaV1.ListOptions `json:"page"`
	MenusAdminDO       `json:"item"`
}
type MenusAdminRepo interface {
	Save(context.Context, *MenusAdminDO) (*MenusAdminDO, error)
	Update(context.Context, *MenusAdminDO) (*MenusAdminDO, error)
	Delete(context.Context, uint64) error
	DeleteList(c context.Context, uids []uint64) error
	FindByID(context.Context, uint64) (*MenusAdminDO, error)
	//FindByKey(c context.Context, key string) (*po.MenusAdminPO, error)
	ListAll(c context.Context, opts MenusAdminDOListOption) (*MenusAdminDOList, error)
	FindAllByRoleID(ctx context.Context, rid uint64) ([]*MenusAdminDO, error)
}
type MenusAdminUsecase struct {
	// contains filtered or unexported fields
}

func NewMenusAdminUsecase

func NewMenusAdminUsecase(repo MenusAdminRepo, logger log.Logger) *MenusAdminUsecase
func (uc *MenusAdminUsecase) Create(ctx context.Context, obj *MenusAdminDO) (*MenusAdminDO, error)
func (uc *MenusAdminUsecase) Delete(ctx context.Context, id uint64) error

Delete 根据ID删除用户

func (uc *MenusAdminUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除用户

func (uc *MenusAdminUsecase) FindAllByRoleID(ctx context.Context, rid uint64) ([]*MenusAdminDO, error)
func (uc *MenusAdminUsecase) FindOneByID(ctx context.Context, id uint64) (*MenusAdminDO, error)

FindOneByID 根据ID查询用户信息

ListAll 批量查询

func (uc *MenusAdminUsecase) Update(ctx context.Context, obj *MenusAdminDO) (*MenusAdminDO, error)

Update 更新用户

type MenusAgentDO struct {
	metaV1.ObjectMeta
	Name  string
	Ftype string
}
type MenusAgentDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*MenusAgentDO `json:"items"`
}
type MenusAgentDOListOption struct {
	metaV1.ListOptions `json:"page"`
	MenusAgentDO       `json:"item"`
}
type MenusAgentUsecase struct {
	// contains filtered or unexported fields
}

func NewMenusAgentUsecase

func NewMenusAgentUsecase(repo MenusAgentRepo, logger log.Logger) *MenusAgentUsecase
func (uc *MenusAgentUsecase) Create(ctx context.Context, obj *MenusAgentDO) (*MenusAgentDO, error)
func (uc *MenusAgentUsecase) Delete(ctx context.Context, id uint64) error

Delete 根据ID删除

func (uc *MenusAgentUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除

func (uc *MenusAgentUsecase) FindOneByID(ctx context.Context, id uint64) (*MenusAgentDO, error)

FindOneByID 根据ID查询信息

ListAll 批量查询

func (uc *MenusAgentUsecase) Update(ctx context.Context, obj *MenusAgentDO) (*MenusAgentDO, error)

Update 更新

type MenusDO struct {
	metaV1.ObjectMeta
	Name        string
	Url         string
	Blanked     int32
	ParentId    uint64
	TargetId    uint64
	Children    []*MenusDO
	HasChildren bool
}
type MenusDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*MenusDO `json:"items"`
}
type MenusDOListOption struct {
	metaV1.ListOptions `json:"page"`
	MenusDO            `json:"item"`
}
type MenusRepo interface {
	Save(context.Context, *MenusDO) (*MenusDO, error)
	Update(context.Context, *MenusDO) (*MenusDO, error)
	Delete(context.Context, uint64) error
	DeleteList(context.Context, []uint64, uint64) error
	FindByID(context.Context, uint64) (*MenusDO, error)
	ListAll(c context.Context, opts MenusDOListOption) (*MenusDOList, error)
	ListAllWithChildren(c context.Context, opts MenusDOListOption) (*MenusDOList, error)
}
type MenusUsecase struct {
	// contains filtered or unexported fields
}

func NewMenusUsecase

func NewMenusUsecase(repo MenusRepo, logger log.Logger) *MenusUsecase
func (uc *MenusUsecase) Create(ctx context.Context, obj *MenusDO) (*MenusDO, error)
func (uc *MenusUsecase) Delete(ctx context.Context, id uint64) error

Delete 根据ID删除

func (uc *MenusUsecase) DeleteList(ctx context.Context, ids []uint64, targetId uint64) error

DeleteList 根据ID批量删除

func (uc *MenusUsecase) FindOneByID(ctx context.Context, id uint64) (*MenusDO, error)

FindOneByID 根据ID查询信息

func (uc *MenusUsecase) ListAll(ctx context.Context, opts MenusDOListOption) (*MenusDOList, error)

ListAll 批量查询

func (uc *MenusUsecase) Update(ctx context.Context, obj *MenusDO) (*MenusDO, error)

Update 更新

type RoleApiDO

type RoleApiDO struct {
	RoleID uint64
	ApiID  uint64
}

type RoleApiRepo

type RoleApiRepo interface {
	CreateInBatches(ctx context.Context, userRoles []*RoleApiDO) error
	UpdateInBatches(ctx context.Context, userRoles []*RoleApiDO) error
	DeleteByRoleId(ctx context.Context, roleId uint64) error
	FindApiIdsByRoleId(ctx context.Context, roleId uint64) ([]uint64, error)
}

type RoleApiUsecase

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

func NewRoleApiUsecase

func NewRoleApiUsecase(repo RoleApiRepo, cabinRepo CasbinRuleRepo, logger log.Logger) *RoleApiUsecase

NewRoleApiUsecase new a UserDO usecase.

func (*RoleApiUsecase) FindApiIdsByRoleId

func (uc *RoleApiUsecase) FindApiIdsByRoleId(ctx context.Context, roleId uint64) ([]uint64, error)

func (*RoleApiUsecase) SaveApisForRole

func (uc *RoleApiUsecase) SaveApisForRole(ctx context.Context, role *RoleDO) error

func (*RoleApiUsecase) UpdateApisForRole

func (uc *RoleApiUsecase) UpdateApisForRole(ctx context.Context, role *RoleDO) error

type RoleDO

type RoleDO struct {
	metaV1.ObjectMeta
	Name       string
	Identifier string
	MenusIDs   []uint64
	ApiIds     []uint64
	Apis       []*ApiDO
}

type RoleDOList

type RoleDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*RoleDO `json:"items"`
}

type RoleDOListOption

type RoleDOListOption struct {
	metaV1.ListOptions `json:"page"`
	RoleDO             `json:"item"`
}

type RoleMenusDO

type RoleMenusDO struct {
	RoleID  uint64
	MenusID uint64
}

type RoleMenusRepo

type RoleMenusRepo interface {
	CreateInBatches(ctx context.Context, userRoles []*RoleMenusDO) error
	UpdateInBatches(ctx context.Context, userRoles []*RoleMenusDO) error
	DeleteByRoleId(ctx context.Context, roleId uint64) error
	FindMenusIdsByRoleId(ctx context.Context, roleId uint64) ([]uint64, error)
}

type RoleMenusUsecase

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

func NewRoleMenusUsecase

func NewRoleMenusUsecase(repo RoleMenusRepo, logger log.Logger) *RoleMenusUsecase

NewRoleMenusUsecase new a UserDO usecase.

func (*RoleMenusUsecase) FindMenusIdsByRoleId

func (uc *RoleMenusUsecase) FindMenusIdsByRoleId(ctx context.Context, roleId uint64) ([]uint64, error)

func (*RoleMenusUsecase) SaveMenusForRole

func (uc *RoleMenusUsecase) SaveMenusForRole(ctx context.Context, role *RoleDO) error

func (*RoleMenusUsecase) UpdateRoleForUser

func (uc *RoleMenusUsecase) UpdateRoleForUser(ctx context.Context, role *RoleDO) error

type RoleRepo

type RoleRepo interface {
	Save(context.Context, *RoleDO) (*RoleDO, error)
	Update(context.Context, *RoleDO) (*RoleDO, error)
	Delete(context.Context, uint64) error
	DeleteList(c context.Context, uids []uint64) error
	FindByID(context.Context, uint64) (*po.RolePO, error)
	FindByKey(c context.Context, key string) (*po.RolePO, error)
	ListAll(c context.Context, opts RoleDOListOption) (*po.RolePOList, error)
	FindByUserId(c context.Context, userId uint64) ([]*RoleDO, error)
}

type RoleUsecase

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

func NewRoleUsecase

func NewRoleUsecase(repo RoleRepo, cabinRepo CasbinRuleRepo, roleMenus *RoleMenusUsecase, ra *RoleApiUsecase, logger log.Logger) *RoleUsecase

func (*RoleUsecase) Create

func (uc *RoleUsecase) Create(ctx context.Context, obj *RoleDO) (*RoleDO, error)

func (*RoleUsecase) Delete

func (uc *RoleUsecase) Delete(ctx context.Context, id uint64) error

Delete 根据ID删除

func (*RoleUsecase) DeleteList

func (uc *RoleUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除

func (*RoleUsecase) FindByKey

func (uc *RoleUsecase) FindByKey(ctx context.Context, objname string) (*RoleDO, error)

FindByKey 根据用户名查询信息

func (*RoleUsecase) FindByUserId

func (uc *RoleUsecase) FindByUserId(ctx context.Context, userId uint64) ([]*RoleDO, error)

func (*RoleUsecase) FindOneByID

func (uc *RoleUsecase) FindOneByID(ctx context.Context, id uint64) (*RoleDO, error)

FindOneByID 根据ID查询信息

func (*RoleUsecase) ListAll

func (uc *RoleUsecase) ListAll(ctx context.Context, opts RoleDOListOption) (*RoleDOList, error)

ListAll 批量查询

func (*RoleUsecase) Update

func (uc *RoleUsecase) Update(ctx context.Context, obj *RoleDO) (*RoleDO, error)

Update 更新

type ShortLinkDO

type ShortLinkDO struct {
	metaV1.ObjectMeta
	Url         string
	Description string
	Identifier  string
}

type ShortLinkDOList

type ShortLinkDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*ShortLinkDO `json:"items"`
}

type ShortLinkDOListOption

type ShortLinkDOListOption struct {
	metaV1.ListOptions `json:"page"`
	ShortLinkDO        `json:"item"`
}

type ShortLinkRepo

type ShortLinkRepo interface {
	Save(context.Context, *ShortLinkDO) (*ShortLinkDO, error)
	Update(context.Context, *ShortLinkDO) (*ShortLinkDO, error)
	Delete(context.Context, uint64) error
	DeleteList(c context.Context, uids []uint64) error
	FindByID(context.Context, uint64) (*ShortLinkDO, error)
	ListAll(c context.Context, opts ShortLinkDOListOption) (*ShortLinkDOList, error)
	FindAllWitchCache(context.Context) ([]*ShortLinkDO, error)
}

type ShortLinkUsecase

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

func NewShortLinkUsecase

func NewShortLinkUsecase(repo ShortLinkRepo, logger log.Logger) *ShortLinkUsecase

func (*ShortLinkUsecase) Create

func (uc *ShortLinkUsecase) Create(ctx context.Context, obj *ShortLinkDO) (*ShortLinkDO, error)

func (*ShortLinkUsecase) Delete

func (uc *ShortLinkUsecase) Delete(ctx context.Context, id uint64) error

Delete 根据ID删除

func (*ShortLinkUsecase) DeleteList

func (uc *ShortLinkUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除

func (*ShortLinkUsecase) FindAllWitchCache

func (uc *ShortLinkUsecase) FindAllWitchCache(ctx context.Context) ([]*ShortLinkDO, error)

func (*ShortLinkUsecase) FindOneByID

func (uc *ShortLinkUsecase) FindOneByID(ctx context.Context, id uint64) (*ShortLinkDO, error)

FindOneByID 根据ID查询信息

func (*ShortLinkUsecase) ListAll

ListAll 批量查询

func (*ShortLinkUsecase) Update

func (uc *ShortLinkUsecase) Update(ctx context.Context, obj *ShortLinkDO) (*ShortLinkDO, error)

Update 更新

type SiteConfigDO

type SiteConfigDO struct {
	metaV1.ObjectMeta
	ConfigKey   string
	ConfigValue string
	ConfigName  string
	ConfigTip   string
	Ftype       int
}

type SiteConfigDOList

type SiteConfigDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*SiteConfigDO `json:"items"`
}

type SiteConfigDOListOption

type SiteConfigDOListOption struct {
	metaV1.ListOptions `json:"page"`
	SiteConfigDO       `json:"item"`
	Types              string
}

type SiteConfigRepo

type SiteConfigRepo interface {
	Save(ctx context.Context, data *SiteConfigDO) (*SiteConfigDO, error)
	Update(context.Context, *SiteConfigDO) (*SiteConfigDO, error)
	UpdateInBatches(context.Context, []*SiteConfigDO) error
	GetValueByKey(key string) (any, bool)
	ListAll(c context.Context, opts SiteConfigDOListOption) ([]*SiteConfigDO, error)
	InitLocalSiteConfigCache(ctx context.Context)
}

type SiteConfigUsecase

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

func NewSiteConfigUsecase

func NewSiteConfigUsecase(repo SiteConfigRepo, logger log.Logger) *SiteConfigUsecase

NewSiteConfigUsecase new a UserDO usecase.

func (*SiteConfigUsecase) FindValueByKey

func (uc *SiteConfigUsecase) FindValueByKey(ctx context.Context, key string) string

func (*SiteConfigUsecase) ListAll

func (*SiteConfigUsecase) Save

func (*SiteConfigUsecase) Update

func (uc *SiteConfigUsecase) Update(ctx context.Context, data *SiteConfigDO) (*SiteConfigDO, error)

func (*SiteConfigUsecase) UpdateInBatches

func (uc *SiteConfigUsecase) UpdateInBatches(ctx context.Context, data []*SiteConfigDO) error

type SiteMapUsecase

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

func NewSiteMapUsecase

func NewSiteMapUsecase(logger log.Logger, site *SiteConfigUsecase,
	au *ArticleUsecase,
) *SiteMapUsecase

func (*SiteMapUsecase) GeneratorMap

func (uc *SiteMapUsecase) GeneratorMap(ctx context.Context, path string) error

GeneratorMap 生成地图 TODO: 后期考虑文件的问题

type TagsDO

type TagsDO struct {
	metaV1.ObjectMeta
	Name        string
	Identifier  string
	Description string
}

type TagsDOList

type TagsDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*TagsDO `json:"items"`
}

type TagsDOListOption

type TagsDOListOption struct {
	metaV1.ListOptions `json:"page"`
	TagsDO             `json:"item"`
}

type TagsRepo

type TagsRepo interface {
	Save(context.Context, *TagsDO) (*TagsDO, error)
	Update(context.Context, *TagsDO) (*TagsDO, error)
	//Delete(context.Context, uint64) error
	DeleteList(c context.Context, uids []uint64) error
	FindByID(context.Context, uint64) (*TagsDO, error)
	FindOneByName(context.Context, string) (*TagsDO, error)
	CountByIdentifier(ctx context.Context, str string) (int64, error)
	ListAll(c context.Context, opts TagsDOListOption) (*TagsDOList, error)
	FindAllByArticleID(ctx context.Context, articleId uint64) ([]*TagsDO, error)
	FindOneByIdentifier(ctx context.Context, name string) (*TagsDO, error)
}

type TagsUsecase

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

func NewTagsUsecase

func NewTagsUsecase(repo TagsRepo, logger log.Logger) *TagsUsecase

func (*TagsUsecase) Create

func (uc *TagsUsecase) Create(ctx context.Context, obj *TagsDO) (*TagsDO, error)

func (*TagsUsecase) DeleteList

func (uc *TagsUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除用户

func (*TagsUsecase) FindAllByArticleID

func (uc *TagsUsecase) FindAllByArticleID(ctx context.Context, articleId uint64) ([]*TagsDO, error)

func (*TagsUsecase) FindOneByID

func (uc *TagsUsecase) FindOneByID(ctx context.Context, id uint64) (*TagsDO, error)

FindOneByID 根据ID查询用户信息

func (*TagsUsecase) FindOneByIdentifier

func (uc *TagsUsecase) FindOneByIdentifier(ctx context.Context, name string) (*TagsDO, error)

func (*TagsUsecase) FindOneByName

func (uc *TagsUsecase) FindOneByName(ctx context.Context, name string) (*TagsDO, error)

func (*TagsUsecase) ListAll

func (uc *TagsUsecase) ListAll(ctx context.Context, opts TagsDOListOption) (*TagsDOList, error)

ListAll 批量查询

func (*TagsUsecase) Update

func (uc *TagsUsecase) Update(ctx context.Context, obj *TagsDO) (*TagsDO, error)

Update 更新用户

type UserDO

type UserDO struct {
	metaV1.ObjectMeta
	Username  string
	Nickname  string
	Avatar    string
	Password  string
	Salt      string
	Email     string
	Phone     string
	AdminFlag bool
	Roles     []*RoleDO
}

UserDO is a UserDO model.

type UserDOList

type UserDOList struct {
	metaV1.ListMeta `json:",inline"`
	Items           []*UserDO `json:"items"`
}

type UserDOListOption

type UserDOListOption struct {
	metaV1.ListOptions `json:"page"`
	UserDO             `json:"item"`
}

type UserInfoDO

type UserInfoDO struct {
	metaV1.ObjectMeta
	Nickname  string
	Avatar    string
	Email     string
	Phone     string
	Token     string
	RoleNames string
}

type UserRepo

type UserRepo interface {
	Save(context.Context, *UserDO) (*UserDO, error)
	Update(context.Context, *UserDO) (*UserDO, error)
	Delete(context.Context, uint64) error
	DeleteList(c context.Context, uids []uint64) error
	FindByID(context.Context, uint64) (*UserDO, error)
	FindByUsername(c context.Context, username string) (*UserDO, error)
	ListAll(c context.Context, opts UserDOListOption) (*UserDOList, error)
	ChangePassword(c context.Context, user *UserDO) error
}

UserRepo is a Greater repo.

type UserRoleDO

type UserRoleDO struct {
	UserID uint64
	RoleID uint64
}

type UserRoleRepo

type UserRoleRepo interface {
	CreateInBatches(ctx context.Context, userRoles []*UserRoleDO) error
	UpdateInBatches(ctx context.Context, userRoles []*UserRoleDO) error
	DeleteByUserId(ctx context.Context, userId uint64) error
}

type UserRoleUsecase

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

func NewUserRoleUsecase

func NewUserRoleUsecase(repo UserRoleRepo, cabinRepo CasbinRuleRepo, logger log.Logger) *UserRoleUsecase

NewUserRoleUsecase new a UserDO usecase.

func (*UserRoleUsecase) SaveRoleForUser

func (uc *UserRoleUsecase) SaveRoleForUser(ctx context.Context, user *UserDO) error

func (*UserRoleUsecase) UpdateRoleForUser

func (uc *UserRoleUsecase) UpdateRoleForUser(ctx context.Context, user *UserDO) error

type UserUsecase

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

UserUsecase is a UserDO usecase.

func NewUserUsecase

func NewUserUsecase(repo UserRepo, role *RoleUsecase, userRole *UserRoleUsecase, logger log.Logger) *UserUsecase

NewUserUsecase new a UserDO usecase.

func (*UserUsecase) ChangePassword

func (uc *UserUsecase) ChangePassword(ctx context.Context, user *UserDO) error

func (*UserUsecase) CreateUser

func (uc *UserUsecase) CreateUser(ctx context.Context, user *UserDO) (*UserDO, error)

CreateUser creates a UserDO, and returns the new UserDO.

func (*UserUsecase) Delete

func (uc *UserUsecase) Delete(ctx context.Context, id uint64) error

Delete 根据ID删除用户

func (*UserUsecase) DeleteList

func (uc *UserUsecase) DeleteList(ctx context.Context, ids []uint64) error

DeleteList 根据ID批量删除用户

func (*UserUsecase) FindOneByID

func (uc *UserUsecase) FindOneByID(ctx context.Context, id uint64) (*UserDO, error)

FindOneByID 根据ID查询用户信息

func (*UserUsecase) FindOneByUsername

func (uc *UserUsecase) FindOneByUsername(ctx context.Context, username string) (*UserDO, error)

FindOneByUsername 根据用户名查询用户信息

func (*UserUsecase) ListAll

func (uc *UserUsecase) ListAll(ctx context.Context, opts UserDOListOption) (*UserDOList, error)

ListAll 批量查询

func (*UserUsecase) Update

func (uc *UserUsecase) Update(ctx context.Context, user *UserDO) (*UserDO, error)

Update 更新用户

func (*UserUsecase) VerifyPassword

func (uc *UserUsecase) VerifyPassword(ctx context.Context, u *UserDO, authConf *conf.Auth) (*UserInfoDO, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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