repository

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package repository implements different repository services required by the tenant service

Package repository implements different repository services required by the tenant service

Package repository implements different repository services required by the tenant service

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTenantAlreadyExistsError

func IsTenantAlreadyExistsError(err error) bool

IsTenantAlreadyExistsError indicates whether the error is of type TenantAlreadyExistsError

func IsTenantNotFoundError

func IsTenantNotFoundError(err error) bool

IsTenantNotFoundError indicates whether the error is of type TenantNotFoundError

func IsUnknownError

func IsUnknownError(err error) bool

IsUnknownError indicates whether the error is of type UnknownError

func NewTenantAlreadyExistsError

func NewTenantAlreadyExistsError() error

NewTenantAlreadyExistsError creates a new TenantAlreadyExistsError error

func NewTenantAlreadyExistsErrorWithError

func NewTenantAlreadyExistsErrorWithError(err error) error

NewTenantAlreadyExistsErrorWithError creates a new TenantAlreadyExistsError error

func NewTenantNotFoundError

func NewTenantNotFoundError(tenantID string) error

NewTenantNotFoundError creates a new TenantNotFoundError error tenantID: Mandatory. The tenantID that did not match any existing tenant

func NewTenantNotFoundErrorWithError

func NewTenantNotFoundErrorWithError(tenantID string, err error) error

NewTenantNotFoundErrorWithError creates a new TenantNotFoundError error tenantID: Mandatory. The tenantID that did not match any existing tenant

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 CreateTenantRequest

type CreateTenantRequest struct {
	Tenant models.Tenant
}

CreateTenantRequest contains the request to create a new tenant

type CreateTenantResponse

type CreateTenantResponse struct {
	TenantID string
	Tenant   models.Tenant
	Cursor   string
}

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

type DeleteTenantResponse

type DeleteTenantResponse struct {
}

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

type ReadTenantResponse

type ReadTenantResponse struct {
	Tenant models.Tenant
}

ReadTenantResponse contains the result of reading an existing tenant

type RepositoryContract

type RepositoryContract interface {
	// CreateTenant creates a new tenant.
	// ctx: 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
	// ctx: Mandatory The reference to the context
	// request: Mandatory. The request to read an esiting 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
	// ctx: Mandatory The reference to the context
	// request: Mandatory. The request to update an esiting 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
	// ctx: Mandatory The reference to the context
	// request: Mandatory. The request to delete an esiting tenant
	// Returns either the result of deleting an exiting tenant or error if something goes wrong.
	DeleteTenant(
		ctx context.Context,
		request *DeleteTenantRequest) (*DeleteTenantResponse, error)

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

RepositoryContract declares the repository service that can create new tenant, read, update and delete existing tenants.

type SearchRequest added in v0.0.13

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

SearchRequest contains the filter criteria to look for existing tenants

type SearchResponse added in v0.0.13

type SearchResponse struct {
	HasPreviousPage bool
	HasNextPage     bool
	TotalCount      int64
	Tenants         []models.TenantWithCursor
}

SearchResponse contains the list of the tenants that matched the result

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

type TenantNotFoundError struct {
	TenantID string
	Err      error
}

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

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 UpdateTenantRequest

type UpdateTenantRequest struct {
	TenantID string
	Tenant   models.Tenant
}

UpdateTenantRequest contains the request to update an existing tenant

type UpdateTenantResponse

type UpdateTenantResponse struct {
	Tenant models.Tenant
	Cursor string
}

UpdateTenantResponse contains the result of updating an existing tenant

Directories

Path Synopsis
Package mock_repository is a generated GoMock package.
Package mock_repository is a generated GoMock package.
Package mongodb implements MongoDB repository services
Package mongodb implements MongoDB repository services

Jump to

Keyboard shortcuts

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