Documentation
¶
Index ¶
- type DocumentRepository
- type DocumentService
- func (ps DocumentService) Add(p domain.Document, parentID string) (domain.Document, error)
- func (ps DocumentService) Delete(id string) error
- func (ps DocumentService) Get(id string) (domain.Document, error)
- func (ps DocumentService) List(currentFolder string) (domain.Folder, 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 DocumentRepository ¶
type DocumentRepository interface { List(string) (domain.Folder, error) AddDocument(document interface{}, parentID string) (string, error) Get(string) (domain.Document, error) Update(string, domain.Document) error Delete(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 ¶
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 ¶
func (ps DocumentService) Get(id string) (domain.Document, error)
Get selects the document from the included repository with the given unique identifier, and returns it 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