Documentation
¶
Overview ¶
Package business implements different business services required by the tenant service
Package business implements different business services required by the tenant service ¶
Package business implements different business services required by the tenant service ¶
Package business implements different business services required by the tenant service ¶
Package business implements different business services required by the tenant service
Index ¶
- func IsTenantAlreadyExistsError(err error) bool
- func IsTenantNotFoundError(err error) bool
- func IsUnknownError(err error) bool
- func NewTenantAlreadyExistsError() error
- func NewTenantAlreadyExistsErrorWithError(err error) error
- func NewTenantNotFoundError(tenantID string) error
- func NewTenantNotFoundErrorWithError(tenantID string, err error) error
- func NewUnknownError(message string) error
- func NewUnknownErrorWithError(message string, err error) error
- type BusinessContract
- type CreateTenantRequest
- type CreateTenantResponse
- type DeleteTenantRequest
- type DeleteTenantResponse
- type ReadTenantRequest
- type ReadTenantResponse
- type TenantAlreadyExistsError
- type TenantNotFoundError
- type UnknownError
- type UpdateTenantRequest
- type UpdateTenantResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTenantAlreadyExistsError ¶
IsTenantAlreadyExistsError indicates whether the error is of type TenantAlreadyExistsError
func IsTenantNotFoundError ¶
IsTenantNotFoundError indicates whether the error is of type TenantNotFoundError
func IsUnknownError ¶
IsUnknownError indicates whether the error is of type UnknownError
func NewTenantAlreadyExistsError ¶
func NewTenantAlreadyExistsError() error
NewTenantAlreadyExistsError creates a new TenantAlreadyExistsError error
func NewTenantAlreadyExistsErrorWithError ¶
NewTenantAlreadyExistsErrorWithError creates a new TenantAlreadyExistsError error
func NewTenantNotFoundError ¶
NewTenantNotFoundError creates a new TenantNotFoundError error tenantID: Mandatory. The tenantID that did not match any existing tenant
func NewTenantNotFoundErrorWithError ¶
NewTenantNotFoundErrorWithError creates a new TenantNotFoundError error tenantID: Mandatory. The tenantID that did not match any existing tenant
func NewUnknownError ¶
NewUnknownError creates a new UnknownError error
func NewUnknownErrorWithError ¶
NewUnknownErrorWithError creates a new UnknownError error
Types ¶
type BusinessContract ¶
type BusinessContract interface { // CreateTenant creates a new tenant. // context: Mandatory The reference to the context // request: Mandatory. The request to create a new tenant // Returns either the result of creating new tenant or error if something goes wrong. CreateTenant( ctx context.Context, request *CreateTenantRequest) (*CreateTenantResponse, error) // ReadTenant read an existing tenant // context: Mandatory The reference to the context // request: Mandatory. The request to read an existing tenant // Returns either the result of reading an exiting tenant or error if something goes wrong. ReadTenant( ctx context.Context, request *ReadTenantRequest) (*ReadTenantResponse, error) // UpdateTenant update an existing tenant // context: Mandatory The reference to the context // request: Mandatory. The request to update an existing tenant // Returns either the result of updateing an exiting tenant or error if something goes wrong. UpdateTenant( ctx context.Context, request *UpdateTenantRequest) (*UpdateTenantResponse, error) // DeleteTenant delete an existing tenant // context: Mandatory The reference to the context // request: Mandatory. The request to delete an existing tenant // Returns either the result of deleting an exiting tenant or error if something goes wrong. DeleteTenant( ctx context.Context, request *DeleteTenantRequest) (*DeleteTenantResponse, error) }
BusinessContract declares the service that can create new tenant, read, update and delete existing tenants.
func NewBusinessService ¶
func NewBusinessService( repositoryService repository.RepositoryContract) (BusinessContract, error)
NewBusinessService creates new instance of the BusinessService, setting up all dependencies and returns the instance repositoryService: Mandatory. Reference to the repository service that can persist the tenant related data Returns the new service or error if something goes wrong
type CreateTenantRequest ¶
CreateTenantRequest contains the request to create a new tenant
func (CreateTenantRequest) Validate ¶
func (val CreateTenantRequest) Validate() error
Validate validates the CreateTenantRequest model and return error if the validation failes Returns error if validation failes
type CreateTenantResponse ¶
CreateTenantResponse contains the result of creating a new tenant
type DeleteTenantRequest ¶
type DeleteTenantRequest struct {
TenantID string
}
DeleteTenantRequest contains the request to delete an existing tenant
func (DeleteTenantRequest) Validate ¶
func (val DeleteTenantRequest) Validate() error
Validate validates the DeleteTenantRequest model and return error if the validation failes Returns error if validation failes
type DeleteTenantResponse ¶
type DeleteTenantResponse struct {
Err error
}
DeleteTenantResponse contains the result of deleting an existing tenant
type ReadTenantRequest ¶
type ReadTenantRequest struct {
TenantID string
}
ReadTenantRequest contains the request to read an existing tenant
func (ReadTenantRequest) Validate ¶
func (val ReadTenantRequest) Validate() error
Validate validates the ReadTenantRequest model and return error if the validation failes Returns error if validation failes
type ReadTenantResponse ¶
ReadTenantResponse contains the result of reading an existing tenant
type TenantAlreadyExistsError ¶
type TenantAlreadyExistsError struct {
Err error
}
TenantAlreadyExistsError indicates that the tenant with the given information already exists
func (TenantAlreadyExistsError) Error ¶
func (e TenantAlreadyExistsError) Error() string
Error returns message for the TenantAlreadyExistsError error type Returns the error nessage
func (TenantAlreadyExistsError) Unwrap ¶
func (e TenantAlreadyExistsError) Unwrap() error
Unwrap returns the err if provided through NewTenantAlreadyExistsErrorWithError function, otherwise returns nil
type TenantNotFoundError ¶
TenantNotFoundError indicates that the tenant with the given tenantID does not exist
func (TenantNotFoundError) Error ¶
func (e TenantNotFoundError) Error() string
Error returns message for the TenantNotFoundError error type Returns the error nessage
func (TenantNotFoundError) Unwrap ¶
func (e TenantNotFoundError) Unwrap() error
Unwrap returns the err if provided through NewTenantNotFoundErrorWithError function, otherwise returns nil
type UnknownError ¶
UnknownError indicates that an unknown error has happened
func (UnknownError) Error ¶
func (e UnknownError) Error() string
Error returns message for the UnknownError error type Returns the error nessage
func (UnknownError) Unwrap ¶
func (e UnknownError) Unwrap() error
Unwrap returns the err if provided through NewUnknownErrorWithError function, otherwise returns nil
type UpdateTenantRequest ¶
UpdateTenantRequest contains the request to update an existing tenant
func (UpdateTenantRequest) Validate ¶
func (val UpdateTenantRequest) Validate() error
Validate validates the UpdateTenantRequest model and return error if the validation failes Returns error if validation failes
type UpdateTenantResponse ¶
type UpdateTenantResponse struct {
Err error
}
UpdateTenantResponse contains the result of updating an existing tenant