Documentation
¶
Index ¶
- Variables
- type ActivityService
- type ApiService
- type CheckService
- type CommentService
- type CronJobService
- type HistoryService
- type InteractiveService
- type LotteryDrawService
- type MenuService
- type PermissionService
- type PlateService
- type PostService
- type RankingService
- type RelationService
- type RoleService
- type Score
- type SearchService
- type UserService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrOffsetNegative = errors.New("偏移量不能为负数") ErrNilQueue = errors.New("队列为空") )
View Source
var ( ErrInvalidRole = errors.New("角色不能为空") ErrInvalidID = errors.New("无效的ID") ErrInvalidParams = errors.New("无效的参数") )
View Source
var ( // ErrDuplicateUsername 表示用户名重复错误 ErrDuplicateUsername = repository.ErrDuplicateUsername // ErrInvalidUserOrPassword 表示用户名或密码错误 ErrInvalidUserOrPassword = errors.New("用户名或密码错误") )
Functions ¶
This section is empty.
Types ¶
type ActivityService ¶
type ActivityService interface {
GetRecentActivity(ctx context.Context) ([]domain.RecentActivity, error)
}
func NewActivityService ¶
func NewActivityService(repo repository.ActivityRepository) ActivityService
type ApiService ¶
type ApiService interface { CreateApi(ctx context.Context, api *domain.Api) error GetApiById(ctx context.Context, id int) (*domain.Api, error) UpdateApi(ctx context.Context, api *domain.Api) error DeleteApi(ctx context.Context, id int) error ListApis(ctx context.Context, page, pageSize int) ([]*domain.Api, int, error) }
func NewApiService ¶
func NewApiService(l *zap.Logger, repo repository.ApiRepository) ApiService
type CheckService ¶
type CheckService interface { ApproveCheck(ctx context.Context, checkID int64, remark string, uid int64) error RejectCheck(ctx context.Context, checkID int64, remark string, uid int64) error ListChecks(ctx context.Context, pagination domain.Pagination) ([]domain.Check, error) CheckDetail(ctx context.Context, checkID int64) (domain.Check, error) }
func NewCheckService ¶
func NewCheckService(repo repository.CheckRepository, searchRepo repository.SearchRepository, l *zap.Logger, ActivityRepo repository.ActivityRepository, publishProducer publish.Producer, commentProducer comment.Producer) CheckService
type CommentService ¶
type CommentService interface { CreateComment(ctx context.Context, comment domain.Comment) error DeleteComment(ctx context.Context, commentId int64) error ListComments(ctx context.Context, postId, minID, limit int64) ([]domain.Comment, error) GetMoreCommentsReply(ctx context.Context, rootId, maxId, limit int64) ([]domain.Comment, error) GetTopCommentsReply(ctx context.Context, postId int64) (domain.Comment, error) }
func NewCommentService ¶
func NewCommentService(repo repository.CommentRepository, c check.Producer) CommentService
type CronJobService ¶
type CronJobService interface { Preempt(ctx context.Context) (domain.Job, error) ResetNextTime(ctx context.Context, dj domain.Job) error }
func NewCronJobService ¶
func NewCronJobService(repo repository.CronJobRepository, l *zap.Logger) CronJobService
type HistoryService ¶
type HistoryService interface { GetHistory(ctx context.Context, pagination domain.Pagination) ([]domain.History, error) DeleteOneHistory(ctx context.Context, postId uint, uid int64) error DeleteAllHistory(ctx context.Context, uid int64) error }
func NewHistoryService ¶
func NewHistoryService(repo repository.HistoryRepository, l *zap.Logger) HistoryService
type InteractiveService ¶
type InteractiveService interface { Like(ctx context.Context, postId uint, uid int64) error CancelLike(ctx context.Context, postId uint, uid int64) error Collect(ctx context.Context, postId uint, uid int64) error CancelCollect(ctx context.Context, postId uint, uid int64) error Get(ctx context.Context, postId uint) (domain.Interactive, error) GetByIds(ctx context.Context, postIds []uint) (map[uint]domain.Interactive, error) }
InteractiveService 定义互动相关的业务接口
func NewInteractiveService ¶
func NewInteractiveService(repo repository.InteractiveRepository, l *zap.Logger) InteractiveService
type LotteryDrawService ¶
type LotteryDrawService interface { // 抽奖活动相关方法 ListLotteryDraws(ctx context.Context, status string, pagination domain.Pagination) ([]domain.LotteryDraw, error) CreateLotteryDraw(ctx context.Context, input domain.LotteryDraw) error GetLotteryDrawByID(ctx context.Context, id int) (domain.LotteryDraw, error) ParticipateLotteryDraw(ctx context.Context, id int, userID int64) error // 秒杀活动相关方法 ListSecondKillEvents(ctx context.Context, status string, pagination domain.Pagination) ([]domain.SecondKillEvent, error) CreateSecondKillEvent(ctx context.Context, input domain.SecondKillEvent) error GetSecondKillEventByID(ctx context.Context, id int) (domain.SecondKillEvent, error) ParticipateSecondKill(ctx context.Context, id int, userID int64) error // 关闭服务 Close() error }
func NewLotteryDrawService ¶
func NewLotteryDrawService(repo repository.LotteryDrawRepository, l *zap.Logger) LotteryDrawService
type MenuService ¶
type MenuService interface { GetMenus(ctx context.Context, pageNum, pageSize int, isTree bool) ([]*domain.Menu, int, error) CreateMenu(ctx context.Context, menu *domain.Menu) error GetMenuById(ctx context.Context, id int) (*domain.Menu, error) UpdateMenu(ctx context.Context, menu *domain.Menu) error DeleteMenu(ctx context.Context, id int) error GetMenuTree(ctx context.Context) ([]*domain.Menu, error) }
func NewMenuService ¶
func NewMenuService(l *zap.Logger, repo repository.MenuRepository) MenuService
type PermissionService ¶
type PermissionService interface { AssignRole(ctx context.Context, roleId int, menuIds []int, apiIds []int) error AssignRoleToUser(ctx context.Context, userId int, roleIds []int, menuIds []int, apiIds []int) error AssignRoleToUsers(ctx context.Context, userIds []int, roleIds []int, menuIds []int, apiIds []int) error }
func NewPermissionService ¶
func NewPermissionService(l *zap.Logger, repo repository.PermissionRepository) PermissionService
type PlateService ¶
type PlateService interface { CreatePlate(ctx context.Context, plate domain.Plate) error ListPlate(ctx context.Context, pagination domain.Pagination) ([]domain.Plate, error) UpdatePlate(ctx context.Context, plate domain.Plate) error DeletePlate(ctx context.Context, plateId int64, uid int64) error }
func NewPlateService ¶
func NewPlateService(l *zap.Logger, repo repository.PlateRepository) PlateService
type PostService ¶
type PostService interface { Create(ctx context.Context, post domain.Post) (uint, error) Update(ctx context.Context, post domain.Post) error Publish(ctx context.Context, postId uint, uid int64) error Withdraw(ctx context.Context, postId uint, uid int64) error GetPostById(ctx context.Context, postId uint, uid int64) (domain.Post, error) GetPublishPostById(ctx context.Context, postId uint, uid int64) (domain.Post, error) ListPublishPosts(ctx context.Context, pagination domain.Pagination) ([]domain.Post, error) ListPosts(ctx context.Context, pagination domain.Pagination) ([]domain.Post, error) Delete(ctx context.Context, postId uint, uid int64) error ListAll(ctx context.Context, pagination domain.Pagination) ([]domain.Post, error) GetPost(ctx context.Context, postId uint) (domain.Post, error) }
func NewPostService ¶
func NewPostService(repo repository.PostRepository, l *zap.Logger, p post.Producer, c check.Producer, incRepo repository.InteractiveRepository) PostService
type RankingService ¶
type RankingService interface { interfaces.RankingService GetTopN(ctx context.Context) ([]domain.Post, error) GetRankingConfig(ctx context.Context) (domain.RankingParameter, error) ResetRankingConfig(ctx context.Context, rankingParameter domain.RankingParameter) error }
func NewRankingService ¶
func NewRankingService( interactiveRepo repository.InteractiveRepository, postRepo repository.PostRepository, rankingRepo repository.RankingRepository, rankingParameterRepository repository.RankingParameterRepository, l *zap.Logger, ) RankingService
type RelationService ¶
type RelationService interface { ListFollowerRelations(ctx context.Context, followerID int64, pagination domain.Pagination) ([]domain.Relation, error) ListFolloweeRelations(ctx context.Context, followeeID int64, pagination domain.Pagination) ([]domain.Relation, error) FollowUser(ctx context.Context, followerID, followeeID int64) error CancelFollowUser(ctx context.Context, followerID, followeeID int64) error GetFolloweeCount(ctx context.Context, UserID int64) (int64, error) GetFollowerCount(ctx context.Context, UserID int64) (int64, error) }
func NewRelationService ¶
func NewRelationService(repo repository.RelationRepository) RelationService
type RoleService ¶
type RoleService interface { CreateRole(ctx context.Context, role *domain.Role, menuIds []int, apiIds []int) error GetRoleById(ctx context.Context, id int) (*domain.Role, error) UpdateRole(ctx context.Context, role *domain.Role) error DeleteRole(ctx context.Context, id int) error ListRoles(ctx context.Context, page, pageSize int) ([]*domain.Role, int, error) GetUserRole(ctx context.Context, userId int) (*domain.Role, error) GetRole(ctx context.Context, roleId int) (*domain.Role, error) }
func NewRoleService ¶
func NewRoleService(repo repository.RoleRepository, permissionRepo repository.PermissionRepository, l *zap.Logger) RoleService
type SearchService ¶
type SearchService interface { SearchPosts(ctx context.Context, expression string) ([]domain.PostSearch, error) SearchUsers(ctx context.Context, expression string) ([]domain.UserSearch, error) SearchComments(ctx context.Context, expression string) ([]domain.CommentSearch, error) }
func NewSearchService ¶
func NewSearchService(repo repository.SearchRepository) SearchService
type UserService ¶
type UserService interface { SignUp(ctx context.Context, u domain.User) error Login(ctx context.Context, username string, password string) (domain.User, error) ChangePassword(ctx context.Context, username string, password string, newPassword string, confirmPassword string) error DeleteUser(ctx context.Context, username string, password string, uid int64) error UpdateProfile(ctx context.Context, profile domain.Profile) error GetProfileByUserID(ctx context.Context, UserID int64) (domain.Profile, error) ListUser(ctx context.Context, pagination domain.Pagination) ([]domain.UserWithProfile, error) UpdateProfileAdmin(ctx context.Context, profile domain.Profile) error }
func NewUserService ¶
func NewUserService(repo repository.UserRepository, l *zap.Logger, searchRepo repository.SearchRepository) UserService
Source Files
¶
Click to show internal directories.
Click to hide internal directories.