Documentation ¶
Index ¶
- Constants
- Variables
- type CreatedInput
- type DeletedInput
- type DetailGotInput
- type IService
- type ListGotInput
- type Output
- type OutputList
- type ServiceImpl
- func (u *ServiceImpl) CreateWallet(ctx context.Context, walletInfo *CreatedInput) (*Output, error)
- func (u *ServiceImpl) DeleteWallet(ctx context.Context, walletInfo *DeletedInput) (*Output, error)
- func (u *ServiceImpl) GetWalletDetail(ctx context.Context, walletInfo *DetailGotInput) (*Output, error)
- func (u *ServiceImpl) GetWalletList(ctx context.Context, walletInfo *ListGotInput) (*OutputList, error)
- func (u *ServiceImpl) UpdateWallet(ctx context.Context, walletInfo *UpdatedInput) (*Output, error)
- type UpdatedInput
Constants ¶
View Source
const ( ErrorCodeRepository = domainerrors.ErrorCodeApplication + domainerrors.ErrorCodeApplicationWallet + 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 { Name string `json:"name"` Description string `json:"description" validate:"omitempty"` Chain entity.Chain `json:"chain"` UserID string `json:"userId" validate:"required,alphanum,len=20"` }
func (*CreatedInput) ToEntity ¶
func (c *CreatedInput) ToEntity() *entity.Wallet
func (*CreatedInput) Validate ¶
func (c *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 CreateWallet(ctx context.Context, walletInfo *CreatedInput) (*Output, error) UpdateWallet(ctx context.Context, walletInfo *UpdatedInput) (*Output, error) DeleteWallet(ctx context.Context, walletInfo *DeletedInput) (*Output, error) // // Query GetWalletList(ctx context.Context, walletInfo *ListGotInput) (*OutputList, error) GetWalletDetail(ctx context.Context, walletInfo *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) ToEntity ¶
func (i *ListGotInput) ToEntity() *entity.Role
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 WalletRepo repository.WalletRepository UserRepo repository.UserRepository EventProducer event.Producer // contains filtered or unexported fields }
ServiceImpl -.
func NewServiceImpl ¶
func NewServiceImpl(walletRepo repository.WalletRepository, userRepo repository.UserRepository, transactionRepo domain.ITransactionRepo, eventProducer event.Producer, l pwlogger.Interface) *ServiceImpl
NewServiceImpl -.
func (*ServiceImpl) CreateWallet ¶
func (u *ServiceImpl) CreateWallet(ctx context.Context, walletInfo *CreatedInput) (*Output, error)
CreateWallet creates a wallet.
func (*ServiceImpl) DeleteWallet ¶
func (u *ServiceImpl) DeleteWallet(ctx context.Context, walletInfo *DeletedInput) (*Output, error)
DeleteWallet deletes wallet.
func (*ServiceImpl) GetWalletDetail ¶
func (u *ServiceImpl) GetWalletDetail(ctx context.Context, walletInfo *DetailGotInput) (*Output, error)
GetWalletDetail gets wallet detail.
func (*ServiceImpl) GetWalletList ¶
func (u *ServiceImpl) GetWalletList(ctx context.Context, walletInfo *ListGotInput) (*OutputList, error)
GetWalletList gets wallet list.
func (*ServiceImpl) UpdateWallet ¶
func (u *ServiceImpl) UpdateWallet(ctx context.Context, walletInfo *UpdatedInput) (*Output, error)
UpdateWallet updates wallet.
type UpdatedInput ¶
type UpdatedInput struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` }
func (*UpdatedInput) ToEntity ¶
func (c *UpdatedInput) ToEntity() *entity.Role
func (*UpdatedInput) Validate ¶
func (c *UpdatedInput) Validate() error
Click to show internal directories.
Click to hide internal directories.