Documentation ¶
Index ¶
- Constants
- Variables
- type CreatedInput
- type DeletedInput
- type DetailGotInput
- type IService
- type ListGotInput
- type Output
- type OutputList
- type ServiceImpl
- func (u *ServiceImpl) CreateCurrency(ctx context.Context, currencyInfo *CreatedInput) (*Output, error)
- func (u *ServiceImpl) DeleteCurrency(ctx context.Context, currencyInfo *DeletedInput) (*Output, error)
- func (u *ServiceImpl) GetCurrencyDetail(ctx context.Context, currencyInfo *DetailGotInput) (*Output, error)
- func (u *ServiceImpl) GetCurrencyList(ctx context.Context, currencyInfo *ListGotInput) (*OutputList, error)
- func (u *ServiceImpl) UpdateCurrency(ctx context.Context, currencyInfo *UpdatedInput) (*Output, error)
- type UpdatedInput
- type WalletBalance
Constants ¶
View Source
const ( ErrorCodeRepository = domainerrors.ErrorCodeApplication + domainerrors.ErrorCodeApplicationCurrency + 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 ¶
func (*CreatedInput) ToEntity ¶
func (c *CreatedInput) ToEntity() *entity.Currency
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 CreateCurrency(ctx context.Context, currencyInfo *CreatedInput) (*Output, error) // AssignCurrency(ctx context.Context, currencyInfo *AssignedInput) (*Output, error) UpdateCurrency(ctx context.Context, currencyInfo *UpdatedInput) (*Output, error) DeleteCurrency(ctx context.Context, currencyInfo *DeletedInput) (*Output, error) // // Query GetCurrencyList(ctx context.Context, currencyInfo *ListGotInput) (*OutputList, error) GetCurrencyDetail(ctx context.Context, currencyInfo *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.Currency
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 CurrencyRepo repository.CurrencyRepository UserRepo repository.UserRepository EventProducer event.Producer // contains filtered or unexported fields }
ServiceImpl -.
func NewServiceImpl ¶
func NewServiceImpl(currencyRepo repository.CurrencyRepository, userRepo repository.UserRepository, transactionRepo domain.ITransactionRepo, eventProducer event.Producer, l pwlogger.Interface) *ServiceImpl
NewServiceImpl -.
func (*ServiceImpl) CreateCurrency ¶
func (u *ServiceImpl) CreateCurrency(ctx context.Context, currencyInfo *CreatedInput) (*Output, error)
CreateCurrency creates a currency.
func (*ServiceImpl) DeleteCurrency ¶
func (u *ServiceImpl) DeleteCurrency(ctx context.Context, currencyInfo *DeletedInput) (*Output, error)
DeleteCurrency deletes currency.
func (*ServiceImpl) GetCurrencyDetail ¶
func (u *ServiceImpl) GetCurrencyDetail(ctx context.Context, currencyInfo *DetailGotInput) (*Output, error)
GetCurrencyDetail gets currency detail.
func (*ServiceImpl) GetCurrencyList ¶
func (u *ServiceImpl) GetCurrencyList(ctx context.Context, currencyInfo *ListGotInput) (*OutputList, error)
GetCurrencyList gets currency list.
func (*ServiceImpl) UpdateCurrency ¶
func (u *ServiceImpl) UpdateCurrency(ctx context.Context, currencyInfo *UpdatedInput) (*Output, error)
UpdateCurrency updates currency.
type UpdatedInput ¶
type UpdatedInput struct { ID string `json:"id"` Name string `json:"name"` Symbol string `json:"symbol"` }
func (*UpdatedInput) ToEntity ¶
func (c *UpdatedInput) ToEntity() *entity.Currency
func (*UpdatedInput) Validate ¶
func (c *UpdatedInput) Validate() error
Click to show internal directories.
Click to hide internal directories.