Documentation
¶
Index ¶
- Constants
- Variables
- type CacheService
- func (cs *CacheService) BatchClearRelatedCache(ctx context.Context, userID int64) error
- func (cs *CacheService) ClearCache(ctx context.Context, key string) error
- func (cs *CacheService) ClearOrderCache(ctx context.Context, orderNo string) error
- func (cs *CacheService) ClearUserCache(ctx context.Context, userID int64) error
- func (cs *CacheService) GetCache(ctx context.Context, key string, dest interface{}) error
- func (cs *CacheService) GetOrderFromCache(ctx context.Context, orderNo string) (*OrderCacheModel, error)
- func (cs *CacheService) GetUserFromCache(ctx context.Context, userID int64) (*UserCacheModel, error)
- func (cs *CacheService) SetCache(ctx context.Context, key string, value interface{}, expiry time.Duration) error
- func (cs *CacheService) SetOrderCache(ctx context.Context, order *ent.ProxyOrder) error
- func (cs *CacheService) SetUserCache(ctx context.Context, user *ent.ProxyUser) error
- func (cs *CacheService) UpdateUserBalanceCache(ctx context.Context, userID int64, balance, giftAmount int64) error
- type OrderCacheModel
- type UserAuthMethod
- type UserCacheModel
- type UserServiceService
- func (s *UserServiceService) BatchDeleteUser(ctx context.Context, req *pb.BatchDeleteUserRequest) (*pb.BatchDeleteUserReply, error)
- func (s *UserServiceService) CreateUser(ctx context.Context, req *pb.CreateUserRequest) (*pb.CreateUserReply, error)
- func (s *UserServiceService) CurrentUser(ctx context.Context, req *pb.CurrentUserRequest) (*pb.CurrentUserReply, error)
- func (s *UserServiceService) DeleteUser(ctx context.Context, req *pb.DeleteUserRequest) (*pb.DeleteUserReply, error)
- func (s *UserServiceService) GetUserDetail(ctx context.Context, req *pb.GetUserDetailRequest) (*pb.GetUserDetailReply, error)
- func (s *UserServiceService) GetUserList(ctx context.Context, req *pb.GetUserListRequest) (*pb.GetUserListReply, error)
- func (s *UserServiceService) GetUserLoginLogs(ctx context.Context, req *pb.GetUserLoginLogsRequest) (*pb.GetUserLoginLogsReply, error)
- func (s *UserServiceService) UpdateUserBasicInfo(ctx context.Context, req *pb.UpdateUserBasicInfoRequest) (*pb.UpdateUserBasicInfoReply, error)
- func (s *UserServiceService) UpdateUserNotifySettings(ctx context.Context, req *pb.UpdateUserNotifySettingsRequest) (*pb.UpdateUserNotifySettingsReply, error)
Constants ¶
View Source
const ( UserIDKeyPrefix = "user:%d" UserBalanceKeyPrefix = "user_balance:%d" UserEmailKeyPrefix = "user_email:%s" OrderNoKeyPrefix = "order:%s" UserOrdersPrefix = "user_orders:%d:%s" )
缓存键前缀
Variables ¶
View Source
var ProviderSet = wire.NewSet( ads.NewAdsService, announcement.NewAnnouncementService, application.NewSubscribeApplicationService, authmethod.NewAuthMethodService, adminconsole.NewConsoleService, admincoupon.NewCouponService, admindocument.NewDocumentService, adminlog.NewLogService, adminmarketing.NewMarketingService, adminorder.NewOrderService, adminpayment.NewPaymentService, adminserver.NewServerService, adminsubscribe.NewSubscribeService, adminsystem.NewSystemService, adminticket.NewTicketService, adminredemption.NewRedemptionService, admintool.NewToolService, maingroup.NewGroupService, adminuser.NewUserService, adminuser.NewUserAuthMethodService, adminuser.NewUserDeviceService, adminuser.NewUserSubscribeService, auth.NewAuthService, authoauth.NewOAuthService, common.NewCommonService, publicorder.NewPublicOrderService, publicannouncement.NewAnnouncementService, publicdocument.NewDocumentService, publicpayment.NewPaymentService, publicportal.NewPortalService, publicsubscribe.NewSubscribeService, publicsubscription.NewPublicSubscriptionService, publicredemption.NewRedemptionService, publicticket.NewTicketService, publicuser.NewUserService, server.NewServerService, )
ProviderSet is service providers
Functions ¶
This section is empty.
Types ¶
type CacheService ¶
type CacheService struct {
// contains filtered or unexported fields
}
CacheService 缓存服务
func NewCacheService ¶
NewCacheService 创建缓存服务
func (*CacheService) BatchClearRelatedCache ¶
func (cs *CacheService) BatchClearRelatedCache(ctx context.Context, userID int64) error
BatchClearRelatedCache 批量清理相关缓存
func (*CacheService) ClearCache ¶
func (cs *CacheService) ClearCache(ctx context.Context, key string) error
ClearCache 清理通用缓存
func (*CacheService) ClearOrderCache ¶
func (cs *CacheService) ClearOrderCache(ctx context.Context, orderNo string) error
ClearOrderCache 清理订单相关缓存
func (*CacheService) ClearUserCache ¶
func (cs *CacheService) ClearUserCache(ctx context.Context, userID int64) error
ClearUserCache 清理用户相关缓存
func (*CacheService) GetCache ¶
func (cs *CacheService) GetCache(ctx context.Context, key string, dest interface{}) error
GetCache 获取通用缓存
func (*CacheService) GetOrderFromCache ¶
func (cs *CacheService) GetOrderFromCache(ctx context.Context, orderNo string) (*OrderCacheModel, error)
GetOrderFromCache 从缓存获取订单信息
func (*CacheService) GetUserFromCache ¶
func (cs *CacheService) GetUserFromCache(ctx context.Context, userID int64) (*UserCacheModel, error)
GetUserFromCache 从缓存获取用户信息
func (*CacheService) SetCache ¶
func (cs *CacheService) SetCache(ctx context.Context, key string, value interface{}, expiry time.Duration) error
SetCache 设置通用缓存
func (*CacheService) SetOrderCache ¶
func (cs *CacheService) SetOrderCache(ctx context.Context, order *ent.ProxyOrder) error
SetOrderCache 设置订单缓存
func (*CacheService) SetUserCache ¶
SetUserCache 设置用户缓存
func (*CacheService) UpdateUserBalanceCache ¶
func (cs *CacheService) UpdateUserBalanceCache(ctx context.Context, userID int64, balance, giftAmount int64) error
UpdateUserBalanceCache 更新用户余额缓存
type OrderCacheModel ¶
type OrderCacheModel struct {
ID int64 `json:"id"`
OrderNo string `json:"order_no"`
UserID int64 `json:"user_id"`
Status int8 `json:"status"`
Amount int64 `json:"amount"`
GiftAmount int64 `json:"gift_amount"`
}
OrderCacheModel 订单缓存模型
func (*OrderCacheModel) GetCacheKeys ¶
func (o *OrderCacheModel) GetCacheKeys() []string
GetCacheKeys 实现CacheKeyGenerator接口
type UserAuthMethod ¶
type UserAuthMethod struct {
UserID int64 `json:"user_id"`
AuthType string `json:"auth_type"`
AuthIdentifier string `json:"auth_identifier"`
}
UserAuthMethod 用户认证方法
type UserCacheModel ¶
type UserCacheModel struct {
ID int64 `json:"id"`
Email string `json:"email"`
Balance *int64 `json:"balance,omitempty"`
GiftAmount *int64 `json:"gift_amount,omitempty"`
AuthMethods []UserAuthMethod `json:"auth_methods,omitempty"`
}
UserCacheModel 用户缓存模型
func (*UserCacheModel) GetCacheKeys ¶
func (u *UserCacheModel) GetCacheKeys() []string
GetCacheKeys 实现CacheKeyGenerator接口
type UserServiceService ¶
type UserServiceService struct {
pb.UnimplementedUserServiceServer
}
func NewUserServiceService ¶
func NewUserServiceService() *UserServiceService
func (*UserServiceService) BatchDeleteUser ¶
func (s *UserServiceService) BatchDeleteUser(ctx context.Context, req *pb.BatchDeleteUserRequest) (*pb.BatchDeleteUserReply, error)
func (*UserServiceService) CreateUser ¶
func (s *UserServiceService) CreateUser(ctx context.Context, req *pb.CreateUserRequest) (*pb.CreateUserReply, error)
func (*UserServiceService) CurrentUser ¶
func (s *UserServiceService) CurrentUser(ctx context.Context, req *pb.CurrentUserRequest) (*pb.CurrentUserReply, error)
func (*UserServiceService) DeleteUser ¶
func (s *UserServiceService) DeleteUser(ctx context.Context, req *pb.DeleteUserRequest) (*pb.DeleteUserReply, error)
func (*UserServiceService) GetUserDetail ¶
func (s *UserServiceService) GetUserDetail(ctx context.Context, req *pb.GetUserDetailRequest) (*pb.GetUserDetailReply, error)
func (*UserServiceService) GetUserList ¶
func (s *UserServiceService) GetUserList(ctx context.Context, req *pb.GetUserListRequest) (*pb.GetUserListReply, error)
func (*UserServiceService) GetUserLoginLogs ¶
func (s *UserServiceService) GetUserLoginLogs(ctx context.Context, req *pb.GetUserLoginLogsRequest) (*pb.GetUserLoginLogsReply, error)
func (*UserServiceService) UpdateUserBasicInfo ¶
func (s *UserServiceService) UpdateUserBasicInfo(ctx context.Context, req *pb.UpdateUserBasicInfoRequest) (*pb.UpdateUserBasicInfoReply, error)
func (*UserServiceService) UpdateUserNotifySettings ¶
func (s *UserServiceService) UpdateUserNotifySettings(ctx context.Context, req *pb.UpdateUserNotifySettingsRequest) (*pb.UpdateUserNotifySettingsReply, error)
Click to show internal directories.
Click to hide internal directories.