Documentation
¶
Index ¶
- Variables
- func NewContentWorkflowTransitionHandler(contentService *Service, cfg config.ConfigCache, publicPath string) http.HandlerFunc
- func NewEditContentFormHandler(contentService *Service, cfg config.ConfigCache, publicPath string) http.HandlerFunc
- func NewEditUploadFormHandler(uploadsService *UploadService) dashboard.Handler
- func NewGetReferenceHandler(service *Service, mapper *Mapper) http.HandlerFunc
- func NewListReferencesHandler(service *Service, mapper *Mapper) http.HandlerFunc
- func NewSaveContentHandler(contentService *Service, publicPath string) http.HandlerFunc
- func NewSaveUploadHandler(uploadService *UploadService, publicPath string) http.HandlerFunc
- func RegisterRoutes(r router.Router, dashboardHandler dashboard.LayoutRouteHandler) error
- type EditContentFormViewModel
- type EditUploadFormViewModel
- type GetReferenceInputResource
- type ListReferencesInputResource
- type ListReferencesOutputResource
- type Mapper
- func (m *Mapper) MapEntityToReference(entity interface{}) (*Reference, error)
- func (m *Mapper) MapReferenceMatchesToReferencesResourceOutput(matches []interface{}, size int) (*ListReferencesOutputResource, error)
- func (m *Mapper) MapReqToListReferencesInputResource(req *http.Request) (*ListReferencesInputResource, error)
- func (m *Mapper) MapRequestToGetReferenceInputResource(req *http.Request) (*GetReferenceInputResource, error)
- type Metadata
- type Query
- type Reference
- type ReferenceLoader
- type ReferenceLoaderInterface
- type Service
- func (s *Service) ContentTypes() map[string]content.Builder
- func (s *Service) CreateContent(entityType string, entity interface{}) (string, error)
- func (s *Service) DeleteContent(entityType string, entityIds ...string) error
- func (s *Service) Export(entityName, exportType string) (datasource.Datasource, error)
- func (s *Service) GetAll(entityType string) ([]interface{}, error)
- func (s *Service) GetAllWithOptions(entityType string, search *search.Search) ([]interface{}, int, error)
- func (s *Service) GetContent(entityType, entityId string) (interface{}, error)
- func (s *Service) GetContentByIds(entityType string, entityIds ...string) ([]interface{}, error)
- func (s *Service) GetContentBySlug(slug string) (interface{}, error)
- func (s *Service) GetNumberOfRows(entityType string) (int, error)
- func (s *Service) GetReference(entityName, entityId string) (interface{}, error)
- func (s *Service) GetReferences(entityName string, entityIds ...string) ([]interface{}, error)
- func (s *Service) GetSlug(entityType, entityId string) (*entities.Slug, error)
- func (s *Service) ListReferences(typeName string, searchQuery *search.Search) ([]interface{}, int, error)
- func (s *Service) TransitionWorkflowState(entityType, entityId string, targetState workflow.State) (interface{}, error)
- func (s *Service) Type(name string) (interface{}, error)
- func (s *Service) UpdateContent(entityType, entityId string, update interface{}) (interface{}, error)
- type TransitionInput
- type UploadService
- func (s *UploadService) DeleteUpload(entityIds ...string) error
- func (s *UploadService) GetAllWithOptions(search *search.Search) ([]interface{}, int, error)
- func (s *UploadService) GetUpload(entityId string) (*contentEntities.Upload, error)
- func (s *UploadService) GetUploads(entityIds ...string) ([]*contentEntities.Upload, error)
- func (s *UploadService) Open(name string) (http.File, error)
- func (s *UploadService) UploadFiles(files map[string]*multipart.FileHeader) ([]*entities.Upload, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWorkflowIncorrectlyConfigured = errors.New("workflow is incorrectly configured") ErrInvalidWorkflowState = errors.New("invalid workflow state") ErrWorkflowUnsupported = errors.New("workflow not supported for selected content type") ErrWorkflowTransitionFailed = errors.New("workflow transition failed") )
View Source
var ErrInternalServerError = errors.New("internal server error")
View Source
var (
ErrInvalidContentType = errors.New("invalid content type")
)
View Source
var ErrUnsupportedMethod = errors.New("http method unsupported")
View Source
var ReferenceLoaderChunkSize = 20
View Source
var UploadType = "Upload"
Functions ¶
func NewContentWorkflowTransitionHandler ¶
func NewContentWorkflowTransitionHandler(contentService *Service, cfg config.ConfigCache, publicPath string) http.HandlerFunc
func NewEditContentFormHandler ¶
func NewEditContentFormHandler(contentService *Service, cfg config.ConfigCache, publicPath string) http.HandlerFunc
func NewEditUploadFormHandler ¶
func NewEditUploadFormHandler(uploadsService *UploadService) dashboard.Handler
func NewGetReferenceHandler ¶
func NewGetReferenceHandler(service *Service, mapper *Mapper) http.HandlerFunc
func NewListReferencesHandler ¶
func NewListReferencesHandler(service *Service, mapper *Mapper) http.HandlerFunc
func NewSaveContentHandler ¶
func NewSaveContentHandler(contentService *Service, publicPath string) http.HandlerFunc
func NewSaveUploadHandler ¶
func NewSaveUploadHandler(uploadService *UploadService, publicPath string) http.HandlerFunc
func RegisterRoutes ¶
func RegisterRoutes(r router.Router, dashboardHandler dashboard.LayoutRouteHandler) error
Types ¶
type EditContentFormViewModel ¶
type EditContentFormViewModel struct { dashboard.RootViewModel Metadata Form template.HTML Error error }
func NewEditContentFormViewModel ¶
func NewEditContentFormViewModel( entity interface{}, cfg config.ConfigCache, publicPath string, contentTypes map[string]content.Builder, exception error, ) (*EditContentFormViewModel, error)
type EditUploadFormViewModel ¶
type EditUploadFormViewModel struct { dashboard.RootViewModel ID string EntityName string Slug string Form template.HTML }
func NewEditUploadFormViewModel ¶
func NewEditUploadFormViewModel( upload *entities.Upload, rootViewModel *dashboard.RootViewModel, ) (*EditUploadFormViewModel, error)
type ListReferencesOutputResource ¶
type ListReferencesOutputResource struct { References []interface{} `json:"references"` Size int `json:"size"` }
type Mapper ¶
type Mapper struct{}
func (*Mapper) MapEntityToReference ¶
func (*Mapper) MapReferenceMatchesToReferencesResourceOutput ¶
func (m *Mapper) MapReferenceMatchesToReferencesResourceOutput( matches []interface{}, size int, ) (*ListReferencesOutputResource, error)
func (*Mapper) MapReqToListReferencesInputResource ¶
func (m *Mapper) MapReqToListReferencesInputResource(req *http.Request) (*ListReferencesInputResource, error)
func (*Mapper) MapRequestToGetReferenceInputResource ¶
func (m *Mapper) MapRequestToGetReferenceInputResource(req *http.Request) (*GetReferenceInputResource, error)
type ReferenceLoader ¶
type ReferenceLoader struct {
// contains filtered or unexported fields
}
func (*ReferenceLoader) GetEntity ¶
func (l *ReferenceLoader) GetEntity(entityName, entityId string) (interface{}, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New( db database.Database, types map[string]content.Builder, searchClient search.SearchInterface, dataExporter dataexporter.DataExporter, uploadService *UploadService, ) (*Service, error)
func (*Service) CreateContent ¶
func (*Service) DeleteContent ¶
func (*Service) Export ¶
func (s *Service) Export(entityName, exportType string) (datasource.Datasource, error)
func (*Service) GetAllWithOptions ¶
func (*Service) GetContent ¶
func (*Service) GetContentByIds ¶
func (*Service) GetContentBySlug ¶
func (*Service) GetReference ¶
func (*Service) GetReferences ¶
func (*Service) ListReferences ¶
func (*Service) TransitionWorkflowState ¶
func (*Service) UpdateContent ¶
func (s *Service) UpdateContent(entityType, entityId string, update interface{}) (interface{}, error)
UpdateContent supports only full updates. The entire structure will be overwritten.
type TransitionInput ¶
func MapContentTransitionInputFromRequest ¶
func MapContentTransitionInputFromRequest(r *http.Request) (*TransitionInput, error)
type UploadService ¶
type UploadService struct {
// contains filtered or unexported fields
}
func NewUploadService ¶
func NewUploadService( db database.Database, searchClient search.SearchInterface, client storage.Client) (*UploadService, error)
func (*UploadService) DeleteUpload ¶
func (s *UploadService) DeleteUpload(entityIds ...string) error
func (*UploadService) GetAllWithOptions ¶
func (s *UploadService) GetAllWithOptions(search *search.Search) ([]interface{}, int, error)
func (*UploadService) GetUpload ¶
func (s *UploadService) GetUpload(entityId string) (*contentEntities.Upload, error)
func (*UploadService) GetUploads ¶
func (s *UploadService) GetUploads(entityIds ...string) ([]*contentEntities.Upload, error)
func (*UploadService) UploadFiles ¶
func (s *UploadService) UploadFiles(files map[string]*multipart.FileHeader) ([]*entities.Upload, error)
UploadFiles stores file uploads at paths like /YYYY/MM/filename.ext
Source Files
¶
Click to show internal directories.
Click to hide internal directories.