business

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package business implements different business services required by the user service

Package business implements different business services required by the user service

Package business implements different business services required by the user service

Package business implements different business services required by the user service

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BusinessContract

type BusinessContract interface {
	// CreateUser creates a new user.
	// ctx: Mandatory The reference to the context
	// request: Mandatory. The request to create a new user
	// Returns either the result of creating new user or error if something goes wrong.
	CreateUser(
		ctx context.Context,
		request *CreateUserRequest) (*CreateUserResponse, error)

	// ReadUser read an existing user
	// ctx: Mandatory The reference to the context
	// request: Mandatory. The request to read an existing user
	// Returns either the result of reading an existing user or error if something goes wrong.
	ReadUser(
		ctx context.Context,
		request *ReadUserRequest) (*ReadUserResponse, error)

	// UpdateUser update an existing user
	// ctx: Mandatory The reference to the context
	// request: Mandatory. The request to update an existing user
	// Returns either the result of updateing an existing user or error if something goes wrong.
	UpdateUser(
		ctx context.Context,
		request *UpdateUserRequest) (*UpdateUserResponse, error)

	// DeleteUser delete an existing user
	// ctx: Mandatory The reference to the context
	// request: Mandatory. The request to delete an existing user
	// Returns either the result of deleting an existing user or error if something goes wrong.
	DeleteUser(
		ctx context.Context,
		request *DeleteUserRequest) (*DeleteUserResponse, error)
}

BusinessContract declares the service that can create new user, read, update and delete existing users.

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 user related data Returns the new service or error if something goes wrong

type CreateUserRequest

type CreateUserRequest struct {
	Email string
	User  models.User
}

CreateUserRequest contains the request to create a new user

func (CreateUserRequest) Validate

func (val CreateUserRequest) Validate() error

Validate validates the CreateUserRequest model and return error if the validation failes Returns error if validation failes

type CreateUserResponse

type CreateUserResponse struct {
	Err    error
	User   models.User
	Cursor string
}

CreateUserResponse contains the result of creating a new user

type DeleteUserRequest

type DeleteUserRequest struct {
	Email string
}

DeleteUserRequest contains the request to delete an existing user

func (DeleteUserRequest) Validate

func (val DeleteUserRequest) Validate() error

Validate validates the DeleteUserRequest model and return error if the validation failes Returns error if validation failes

type DeleteUserResponse

type DeleteUserResponse struct {
	Err error
}

DeleteUserResponse contains the result of deleting an existing user

type ReadUserRequest

type ReadUserRequest struct {
	Email string
}

ReadUserRequest contains the request to read an existing user

func (ReadUserRequest) Validate

func (val ReadUserRequest) Validate() error

Validate validates the ReadUserRequest model and return error if the validation failes Returns error if validation failes

type ReadUserResponse

type ReadUserResponse struct {
	Err  error
	User models.User
}

ReadUserResponse contains the result of reading an existing user

type UpdateUserRequest

type UpdateUserRequest struct {
	Email string
	User  models.User
}

UpdateUserRequest contains the request to update an existing user

func (UpdateUserRequest) Validate

func (val UpdateUserRequest) Validate() error

Validate validates the UpdateUserRequest model and return error if the validation failes Returns error if validation failes

type UpdateUserResponse

type UpdateUserResponse struct {
	Err    error
	User   models.User
	Cursor string
}

UpdateUserResponse contains the result of updating an existing user

Directories

Path Synopsis
Package mock_business is a generated GoMock package.
Package mock_business is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL