Documentation ¶
Index ¶
- Constants
- Variables
- type CreatedInput
- type DeletedInput
- type DetailGotInput
- type IService
- type ListGotInput
- type Output
- type OutputList
- type ServiceImpl
- func (u *ServiceImpl) CreateUser(ctx context.Context, userInfo *CreatedInput) (*Output, error)
- func (u *ServiceImpl) DeleteUser(ctx context.Context, userInfo *DeletedInput) (*Output, error)
- func (u *ServiceImpl) GetUserDetail(ctx context.Context, userInfo *DetailGotInput) (*Output, error)
- func (u *ServiceImpl) GetUserList(ctx context.Context, userInfo *ListGotInput) (*OutputList, error)
- func (u *ServiceImpl) UpdateUser(ctx context.Context, userInfo *UpdatedInput) (*Output, error)
- type UpdatedInput
Constants ¶
View Source
const ( ErrorCodeRepository = domainerrors.ErrorCodeApplication + domainerrors.ErrorCodeApplicationUser + iota ErrorCodeValidateInput ErrorCodeCast )
Variables ¶
View Source
var ( ErrValidation = errors.New("validation failed") ErrCastToEntityFailed = errors.New("cast to entity failed") )
Functions ¶
This section is empty.
Types ¶
type CreatedInput ¶
type CreatedInput struct { Username string `json:"username" validate:"required,lte=30,alphanum"` Password string `json:"password" validate:"required"` EMail string `json:"email" validate:"required,email"` DisplayName string `json:"displayName" validate:"required,lte=30"` Avatar string `json:"avatar" validate:"required"` RoleIDs []string `json:"roleIds"` GroupID string `json:"groupId"` }
func (*CreatedInput) ToEntity ¶
func (i *CreatedInput) ToEntity() *entity.User
func (*CreatedInput) Validate ¶
func (i *CreatedInput) Validate() error
type DeletedInput ¶
type DeletedInput struct {
ID string `json:"id" validate:"required,alphanum,len=20"`
}
func (*DeletedInput) Validate ¶
func (i *DeletedInput) Validate() error
type DetailGotInput ¶
type DetailGotInput struct {
ID string `json:"id" validate:"required,alphanum,len=20"`
}
func (*DetailGotInput) Validate ¶
func (i *DetailGotInput) Validate() error
type IService ¶
type IService interface { // Command CreateUser(ctx context.Context, UserInfo *CreatedInput) (*Output, error) // AssignRole(ctx context.Context, UserInfo *AssignedInput) (*Output, error) UpdateUser(ctx context.Context, UserInfo *UpdatedInput) (*Output, error) DeleteUser(ctx context.Context, UserInfo *DeletedInput) (*Output, error) // // Query GetUserList(ctx context.Context, UserInfo *ListGotInput) (*OutputList, error) GetUserDetail(ctx context.Context, UserInfo *DetailGotInput) (*Output, error) }
type ListGotInput ¶
type ListGotInput struct { Limit int `json:"limit"` Offset int `json:"offset"` FilterName string `json:"filterName" validate:"omitempty,oneof=name"` SortFields []string `json:"sortFields" validate:"dive,oneof=id name updated_at created_at"` Dir string `json:"dir" validate:"oneof=asc desc"` }
func (*ListGotInput) ToSearchQuery ¶
func (i *ListGotInput) ToSearchQuery() *domain.SearchQuery
func (*ListGotInput) Validate ¶
func (i *ListGotInput) Validate() error
type Output ¶
type OutputList ¶
type OutputList struct { Offset int64 `json:"offset"` Limit int64 `json:"limit"` Total int64 `json:"total"` Items []Output `json:"items"` }
func NewListOutput ¶
func NewListOutput(e *domain.List) *OutputList
type ServiceImpl ¶
type ServiceImpl struct { TransactionRepo domain.ITransactionRepo EventProducer event.Producer RoleRepo repository.RoleRepository UserRepo repository.UserRepository // contains filtered or unexported fields }
ServiceImpl -.
func NewServiceImpl ¶
func NewServiceImpl(roleRepo repository.RoleRepository, userRepo repository.UserRepository, transactionRepo domain.ITransactionRepo, eventProducer event.Producer, eventStore event.Store, l pwlogger.Interface) *ServiceImpl
NewServiceImpl -.
func (*ServiceImpl) CreateUser ¶
func (u *ServiceImpl) CreateUser(ctx context.Context, userInfo *CreatedInput) (*Output, error)
CreateUser creates a user.
func (*ServiceImpl) DeleteUser ¶
func (u *ServiceImpl) DeleteUser(ctx context.Context, userInfo *DeletedInput) (*Output, error)
DeleteUser deletes a user.
func (*ServiceImpl) GetUserDetail ¶
func (u *ServiceImpl) GetUserDetail(ctx context.Context, userInfo *DetailGotInput) (*Output, error)
GetUser gets a user.
func (*ServiceImpl) GetUserList ¶
func (u *ServiceImpl) GetUserList(ctx context.Context, userInfo *ListGotInput) (*OutputList, error)
GetUserList lists users.
func (*ServiceImpl) UpdateUser ¶
func (u *ServiceImpl) UpdateUser(ctx context.Context, userInfo *UpdatedInput) (*Output, error)
UpdateUser updates a user.
type UpdatedInput ¶
type UpdatedInput struct { ID string `json:"id" validate:"required,alphanum,len=20"` DisplayName string `json:"displayName" validate:"required,lte=30"` Avatar string `json:"avatar" validate:"required"` }
func (*UpdatedInput) ToEntity ¶
func (i *UpdatedInput) ToEntity() *entity.User
func (*UpdatedInput) Validate ¶
func (i *UpdatedInput) Validate() error
Click to show internal directories.
Click to hide internal directories.