business

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package business implements different business services required by the project service

Package business implements different business services required by the project service

Package business implements different business services required by the project service

Package business implements different business services required by the project service

Package business implements different business services required by the project service

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsProjectAlreadyExistsError

func IsProjectAlreadyExistsError(err error) bool

IsProjectAlreadyExistsError indicates whether the error is of type ProjectAlreadyExistsError

func IsProjectNotFoundError

func IsProjectNotFoundError(err error) bool

IsProjectNotFoundError indicates whether the error is of type ProjectNotFoundError

func IsUnknownError

func IsUnknownError(err error) bool

IsUnknownError indicates whether the error is of type UnknownError

func NewProjectAlreadyExistsError

func NewProjectAlreadyExistsError() error

NewProjectAlreadyExistsError creates a new ProjectAlreadyExistsError error

func NewProjectAlreadyExistsErrorWithError

func NewProjectAlreadyExistsErrorWithError(err error) error

NewProjectAlreadyExistsErrorWithError creates a new ProjectAlreadyExistsError error

func NewProjectNotFoundError

func NewProjectNotFoundError(projectID string) error

NewProjectNotFoundError creates a new ProjectNotFoundError error projectID: Mandatory. The projectID that did not match any existing project

func NewProjectNotFoundErrorWithError

func NewProjectNotFoundErrorWithError(projectID string, err error) error

NewProjectNotFoundErrorWithError creates a new ProjectNotFoundError error projectID: Mandatory. The projectID that did not match any existing project

func NewUnknownError

func NewUnknownError(message string) error

NewUnknownError creates a new UnknownError error

func NewUnknownErrorWithError

func NewUnknownErrorWithError(message string, err error) error

NewUnknownErrorWithError creates a new UnknownError error

Types

type BusinessContract

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

	// ReadProject read an existing project
	// ctx: Mandatory The reference to the context
	// request: Mandatory. The request to read an existing project
	// Returns either the result of reading an exiting project or error if something goes wrong.
	ReadProject(
		ctx context.Context,
		request *ReadProjectRequest) (*ReadProjectResponse, error)

	// UpdateProject update an existing project
	// ctx: Mandatory The reference to the context
	// request: Mandatory. The request to update an existing project
	// Returns either the result of updateing an exiting project or error if something goes wrong.
	UpdateProject(
		ctx context.Context,
		request *UpdateProjectRequest) (*UpdateProjectResponse, error)

	// DeleteProject delete an existing project
	// ctx: Mandatory The reference to the context
	// request: Mandatory. The request to delete an existing project
	// Returns either the result of deleting an exiting project or error if something goes wrong.
	DeleteProject(
		ctx context.Context,
		request *DeleteProjectRequest) (*DeleteProjectResponse, error)

	// Search returns the list of projects that matched the criteria
	// ctx: Mandatory The reference to the context
	// request: Mandatory. The request contains the search criteria
	// Returns the list of projects that matched the criteria
	Search(
		ctx context.Context,
		request *SearchRequest) (*SearchResponse, error)
}

BusinessContract declares the service that can create new project, read, update and delete existing projects.

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

type CreateProjectRequest

type CreateProjectRequest struct {
	Project models.Project
}

CreateProjectRequest contains the request to create a new project

func (CreateProjectRequest) Validate

func (val CreateProjectRequest) Validate() error

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

type CreateProjectResponse

type CreateProjectResponse struct {
	Err       error
	ProjectID string
	Project   models.Project
	Cursor    string
}

CreateProjectResponse contains the result of creating a new project

type DeleteProjectRequest

type DeleteProjectRequest struct {
	ProjectID string
}

DeleteProjectRequest contains the request to delete an existing project

func (DeleteProjectRequest) Validate

func (val DeleteProjectRequest) Validate() error

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

type DeleteProjectResponse

type DeleteProjectResponse struct {
	Err error
}

DeleteProjectResponse contains the result of deleting an existing project

type ProjectAlreadyExistsError

type ProjectAlreadyExistsError struct {
	Err error
}

ProjectAlreadyExistsError indicates that the project with the given information already exists

func (ProjectAlreadyExistsError) Error

Error returns message for the ProjectAlreadyExistsError error type Returns the error nessage

func (ProjectAlreadyExistsError) Unwrap

func (e ProjectAlreadyExistsError) Unwrap() error

Unwrap returns the err if provided through NewProjectAlreadyExistsErrorWithError function, otherwise returns nil

type ProjectNotFoundError

type ProjectNotFoundError struct {
	ProjectID string
	Err       error
}

ProjectNotFoundError indicates that the project with the given projectID does not exist

func (ProjectNotFoundError) Error

func (e ProjectNotFoundError) Error() string

Error returns message for the ProjectNotFoundError error type Returns the error nessage

func (ProjectNotFoundError) Unwrap

func (e ProjectNotFoundError) Unwrap() error

Unwrap returns the err if provided through NewProjectNotFoundErrorWithError function, otherwise returns nil

type ReadProjectRequest

type ReadProjectRequest struct {
	ProjectID string
}

ReadProjectRequest contains the request to read an existing project

func (ReadProjectRequest) Validate

func (val ReadProjectRequest) Validate() error

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

type ReadProjectResponse

type ReadProjectResponse struct {
	Err     error
	Project models.Project
}

ReadProjectResponse contains the result of reading an existing project

type SearchRequest

type SearchRequest struct {
	Pagination     common.Pagination
	SortingOptions []common.SortingOptionPair
	ProjectIDs     []string
}

SearchRequest contains the filter criteria to look for existing projects

func (SearchRequest) Validate

func (val SearchRequest) Validate() error

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

type SearchResponse

type SearchResponse struct {
	Err             error
	HasPreviousPage bool
	HasNextPage     bool
	TotalCount      int64
	Projects        []models.ProjectWithCursor
}

SearchResponse contains the list of the projects that matched the result

type UnknownError

type UnknownError struct {
	Message string
	Err     error
}

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 UpdateProjectRequest

type UpdateProjectRequest struct {
	ProjectID string
	Project   models.Project
}

UpdateProjectRequest contains the request to update an existing project

func (UpdateProjectRequest) Validate

func (val UpdateProjectRequest) Validate() error

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

type UpdateProjectResponse

type UpdateProjectResponse struct {
	Err     error
	Project models.Project
	Cursor  string
}

UpdateProjectResponse contains the result of updating an existing project

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