Documentation ¶
Overview ¶
Package application contains the application logic of the document management system.
Index ¶
- type DocumentListItem
- type DocumentRepository
- type DocumentService
- func (ps DocumentService) Add(p domain.Document, parentID string, spaceID string) (domain.Document, error)
- func (ps DocumentService) Delete(id string) error
- func (ps DocumentService) Get(ctx context.Context, id string) (domain.Document, error)
- func (ps DocumentService) List(ctx context.Context, spaceID string) ([]domain.DocumentTreeItem, error)
- func (ps DocumentService) Update(id string, p domain.Document) error
- type ErrorCannotFinddocument
- type ErrorIDFormat
- type ErrorParsePayload
- type ErrorPayloadMissing
- type ErrorReadPayload
- type HealthRepository
- type HealthService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DocumentListItem ¶
DocumentListItem represents the list of hierarchical documents by rows
type DocumentRepository ¶
type DocumentRepository interface { List(ctx context.Context, spaceID string) ([]DocumentListItem, error) Add(document domain.Document, parentID string, spaceID string) (string, error) Get(documentID string) (domain.Document, error) Update(documentID string, document domain.Document) error Delete(documentID string) error }
DocumentRepository is the interface that we expect to be fulfilled to be used as a backend for Document Service
type DocumentService ¶
type DocumentService struct {
// contains filtered or unexported fields
}
DocumentService represents the struct which contains a DocumentRepository and exports methods to access the data
func NewDocumentService ¶
func NewDocumentService(dr DocumentRepository) DocumentService
NewDocumentService creates a new DocumentService instance and sets its repository
func (DocumentService) Add ¶
func (ps DocumentService) Add(p domain.Document, parentID string, spaceID string) (domain.Document, error)
Add adds a new document to the included repository, and returns it Returns an error if the repository returns one
func (DocumentService) Delete ¶
func (ps DocumentService) Delete(id string) error
Delete deletes the document from the included repository with the given unique identifier Returns an error if the repository returns one
func (DocumentService) Get ¶
Get selects the document from the included repository with the given unique identifier, and returns it Returns an error if the repository returns one
func (DocumentService) List ¶
func (ps DocumentService) List(ctx context.Context, spaceID string) ([]domain.DocumentTreeItem, error)
List loads all the data from the included repository from the given space and returns them Returns an error if the repository returns one
type ErrorCannotFinddocument ¶
type ErrorCannotFinddocument struct {
ID string
}
ErrorCannotFinddocument is used when the document with the given ID cannot be found on the underlying data source
func (*ErrorCannotFinddocument) Error ¶
func (e *ErrorCannotFinddocument) Error() string
type ErrorIDFormat ¶
type ErrorIDFormat struct {
ID string
}
ErrorIDFormat is used when the data repository cannot use the document's ID is not in an acceptable format the the underlying provider
func (*ErrorIDFormat) Error ¶
func (e *ErrorIDFormat) Error() string
type ErrorParsePayload ¶
type ErrorParsePayload struct{}
ErrorParsePayload is used when the payload is cannot be parsed by the communications package
func (*ErrorParsePayload) Error ¶
func (e *ErrorParsePayload) Error() string
type ErrorPayloadMissing ¶
type ErrorPayloadMissing struct{}
ErrorPayloadMissing is used when the communication package expects a payload and there is none
func (*ErrorPayloadMissing) Error ¶
func (e *ErrorPayloadMissing) Error() string
type ErrorReadPayload ¶
type ErrorReadPayload struct{}
ErrorReadPayload is used when the payload is cannot be read by the communications package
func (*ErrorReadPayload) Error ¶
func (e *ErrorReadPayload) Error() string
type HealthRepository ¶
type HealthRepository interface {
Ready() bool
}
HealthRepository is the interface to interact with database
type HealthService ¶
type HealthService struct {
HealthRepository HealthRepository
}
HealthService is the struct to let outer layers to interact to the health applicatopn
func NewHealthService ¶
func NewHealthService(hr HealthRepository) HealthService
NewHealthService creates a new HealthService instance and sets its repository
func (HealthService) Ready ¶
func (hs HealthService) Ready() bool
Ready returns true if underlying reposiroty and its connection is up and running, false otherwise