Documentation ¶
Index ¶
- Constants
- Variables
- func ToProtoGroup(g *Group) (*v1.Group, error)
- func ToProtoGroupList(g []*Group) ([]*v1.Group, error)
- func ToProtoUser(u *User) (*v1.User, error)
- func ToProtoUserList(u []*User) ([]*v1.User, error)
- type Group
- type GroupPage
- type GroupRepo
- type GroupUsecase
- func (uc *GroupUsecase) CreateGroup(ctx context.Context, group *Group) (*v1.Group, error)
- func (uc *GroupUsecase) DeleteGroup(ctx context.Context, groupId int64) error
- func (uc *GroupUsecase) GetGroup(ctx context.Context, groupId int64, view GroupView) (*v1.Group, error)
- func (uc *GroupUsecase) ListGroups(ctx context.Context, pageSize int, pageToken string, view GroupView) ([]*v1.Group, string, error)
- func (uc *GroupUsecase) UpdateGroup(ctx context.Context, group *Group) (*v1.Group, error)
- type GroupView
- type Setting
- type SettingName
- type SettingRepo
- type SettingType
- type SettingUsecase
- type User
- type UserPage
- type UserRepo
- type UserStatus
- type UserUsecase
- func (uc *UserUsecase) DeleteUser(ctx context.Context, userId int64) error
- func (uc *UserUsecase) GetUser(ctx context.Context, userId int64) (*v1.User, error)
- func (uc *UserUsecase) GetUserSalt(ctx context.Context, email string) ([]byte, error)
- func (uc *UserUsecase) IsAdminUser(ctx context.Context, userId int64) (bool, error)
- func (uc *UserUsecase) ListUsers(ctx context.Context, pageSize int, pageToken string, view UserView) ([]*v1.User, string, error)
- func (uc *UserUsecase) SigninA(ctx context.Context, email string, a []byte) ([]byte, error)
- func (uc *UserUsecase) SigninM(ctx context.Context, email string, m1 []byte) (userid int64, k []byte, err error)
- func (uc *UserUsecase) Signup(ctx context.Context, email string, salt, verifier []byte) (*v1.User, error)
- func (uc *UserUsecase) UpdateUser(ctx context.Context, user *User) (*v1.User, error)
- type UserView
Constants ¶
View Source
const ( // MaxPageSize is the maximum page size that can be returned by a List call. Requesting page sizes larger than // this value will return, at most, MaxPageSize entries. MaxPageSize = 1000 // MaxBatchCreateSize is the maximum number of entries that can be created by a single BatchCreate call. Requests // exceeding this batch size will return an error. MaxBatchCreateSize = 1000 // MaxBatchUpdateSize is the maximum number of entries that can be updated by a single BatchUpdate call. Requests // exceeding this batch size will return an error. MaxBatchUpdateSize = 1000 )
Variables ¶
View Source
var ProviderSet = wire.NewSet( NewUserUsecase, NewGroupUsecase, NewSettingUsecase, )
ProviderSet is biz providers.
Functions ¶
Types ¶
type Group ¶
type GroupRepo ¶
type GroupRepo interface { Create(ctx context.Context, group *Group) (*Group, error) Get(ctx context.Context, groupId int64, groupView GroupView) (*Group, error) GetByName(ctx context.Context, name string, groupView GroupView) (*Group, error) Update(ctx context.Context, group *Group) (*Group, error) Delete(ctx context.Context, groupId int64) error List(ctx context.Context, pageSize int, pageToken string, groupView GroupView) (*GroupPage, error) BatchCreate(ctx context.Context, groups []*Group) ([]*Group, error) }
type GroupUsecase ¶
type GroupUsecase struct {
// contains filtered or unexported fields
}
func NewGroupUsecase ¶
func NewGroupUsecase(repo GroupRepo, logger log.Logger) *GroupUsecase
func (*GroupUsecase) CreateGroup ¶
func (*GroupUsecase) DeleteGroup ¶
func (uc *GroupUsecase) DeleteGroup(ctx context.Context, groupId int64) error
func (*GroupUsecase) ListGroups ¶
func (*GroupUsecase) UpdateGroup ¶
type Setting ¶
type Setting struct { Id int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` Value *string `json:"value,omitempty"` Type *SettingType `json:"type,omitempty"` }
type SettingName ¶
type SettingName string
const ( RegisterEnable SettingName = "register_enable" RegisterDefaultGroup SettingName = "register_default_group" RegisterMailActive SettingName = "register_mail_active" // RegisterMailFilter Indicates the status of the mail filter. "off" indicates that the mail filter // is disabled, "blacklist" indicates the blacklist, and "whitelist" indicates the whitelist RegisterMailFilter SettingName = "register_mail_filter" RegisterMailFilterList SettingName = "register_mail_filter_list" )
type SettingRepo ¶
type SettingRepo interface { Create(ctx context.Context, s *Setting) (*Setting, error) Get(ctx context.Context, id int64) (*Setting, error) GetByName(ctx context.Context, name string) (*Setting, error) Update(ctx context.Context, s *Setting) (*Setting, error) Delete(ctx context.Context, id int64) error List(ctx context.Context) (map[SettingName]*Setting, error) ListByType(ctx context.Context, t SettingType) (map[SettingName]*Setting, error) BatchCreate(ctx context.Context, settings []*Setting) ([]*Setting, error) BatchUpsert(ctx context.Context, settings []*Setting) error }
type SettingType ¶
type SettingType string
const ( TypeBasic SettingType = "basic" TypeRegister SettingType = "register" TypeLogin SettingType = "login" TypeMail SettingType = "mail" TypeCaptcha SettingType = "captcha" TypePwa SettingType = "pwa" TypeTimeout SettingType = "timeout" TypeUpload SettingType = "upload" TypeAvatar SettingType = "avatar" TypePayment SettingType = "payment" TypeScore SettingType = "score" TypeTask SettingType = "task" TypeAuth SettingType = "auth" TypeCron SettingType = "cron" )
func (SettingType) String ¶
func (s SettingType) String() string
type SettingUsecase ¶
type SettingUsecase struct {
// contains filtered or unexported fields
}
func NewSettingUsecase ¶
func NewSettingUsecase(repo SettingRepo, logger log.Logger) *SettingUsecase
type User ¶
type User struct { Id int64 `json:"id,omitempty"` GroupId int64 `json:"groupId,omitempty"` Email string `json:"email,omitempty"` NickName string `json:"nickName,omitempty"` Salt []byte `json:"salt,omitempty"` Verifier []byte `json:"verifier,omitempty"` Storage uint64 `json:"storage,omitempty"` Score int64 `json:"score,omitempty"` Status UserStatus `json:"status,omitempty"` CreateAt time.Time `json:"createAt"` UpdateAt time.Time `json:"updateAt"` OwnerGroup *Group `json:"ownerGroup,omitempty"` }
type UserRepo ¶
type UserRepo interface { Create(ctx context.Context, user *User) (*User, error) Get(ctx context.Context, userId int64, userView UserView) (*User, error) GetByEmail(ctx context.Context, email string, userView UserView) (*User, error) Update(ctx context.Context, user *User) (*User, error) Delete(ctx context.Context, userId int64) error List(ctx context.Context, pageSize int, pageToken string, userView UserView) (*UserPage, error) BatchCreate(ctx context.Context, users []*User) ([]*User, error) IsAdminUser(ctx context.Context, userId int64) (bool, error) CacheSRPServer(ctx context.Context, email string, server *srp.Server) error GetSRPServer(ctx context.Context, email string) (*srp.Server, error) }
type UserStatus ¶
type UserStatus string
const ( StatusNonActivated UserStatus = "non_activated" StatusActive UserStatus = "active" StatusBanned UserStatus = "banned" StatusOveruseBaned UserStatus = "overuse_baned" )
Status values.
func (UserStatus) String ¶
func (s UserStatus) String() string
type UserUsecase ¶
type UserUsecase struct {
// contains filtered or unexported fields
}
func NewUserUsecase ¶
func NewUserUsecase(ur UserRepo, gr GroupRepo, sr SettingRepo, params *srp.Params, logger log.Logger) *UserUsecase
func (*UserUsecase) DeleteUser ¶
func (uc *UserUsecase) DeleteUser(ctx context.Context, userId int64) error
func (*UserUsecase) GetUserSalt ¶
func (*UserUsecase) IsAdminUser ¶
func (*UserUsecase) UpdateUser ¶
Click to show internal directories.
Click to hide internal directories.