Documentation
¶
Index ¶
- type BasePDFRenderService
- func (pdfRender *BasePDFRenderService) GetExamplesData(_ context.Context, templateName string) (map[string]Data, error)
- func (pdfRender *BasePDFRenderService) RenderPDFExample(ctx context.Context, templateName string, exampleName string) ([]byte, error)
- func (pdfRender *BasePDFRenderService) RenderPDFWithData(ctx context.Context, templateName string, data Data) ([]byte, error)
- type Data
- type DataValidationError
- type DirectStatsService
- type ExampleNotFoundError
- type ExampleSpec
- type JSONSchema
- type PDFRenderService
- type RenderInfo
- type RenderPoolInfo
- type RenderPoolStats
- type SimpleValidateService
- type SpecService
- type Stats
- type StatsService
- type TemplateNotFoundError
- type TemplateSpec
- type TemplateSpecService
- type ValidateService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasePDFRenderService ¶
type BasePDFRenderService struct {
// contains filtered or unexported fields
}
BasePDFRenderService base implementation of PDFRenderService.
func NewBasePDFRenderService ¶
func NewBasePDFRenderService( store templates.Store, tracerProvider trace.TracerProvider, ) *BasePDFRenderService
NewBasePDFRenderService constructor.
func (*BasePDFRenderService) GetExamplesData ¶ added in v0.9.0
func (pdfRender *BasePDFRenderService) GetExamplesData( _ context.Context, templateName string, ) (map[string]Data, error)
GetExamplesData return examples data for template.
func (*BasePDFRenderService) RenderPDFExample ¶
func (pdfRender *BasePDFRenderService) RenderPDFExample( ctx context.Context, templateName string, exampleName string, ) ([]byte, error)
RenderPDFExample find template and example by name and render it to PDF.
func (*BasePDFRenderService) RenderPDFWithData ¶
func (pdfRender *BasePDFRenderService) RenderPDFWithData( ctx context.Context, templateName string, data Data, ) ([]byte, error)
RenderPDFWithData find template by name and render it to PDF.
type DataValidationError ¶
type DataValidationError struct {
// contains filtered or unexported fields
}
DataValidationError returned by services when template return data validation error.
func NewDataValidationError ¶
func NewDataValidationError(err error) *DataValidationError
NewDataValidationError construct new DataValidationError.
func (*DataValidationError) Error ¶
func (err *DataValidationError) Error() string
func (*DataValidationError) Is ¶ added in v0.9.1
func (err *DataValidationError) Is(otherErr error) bool
Is cast error type and match inner errors.
func (*DataValidationError) Unwrap ¶
func (err *DataValidationError) Unwrap() error
Unwrap inner error.
type DirectStatsService ¶
type DirectStatsService struct {
// contains filtered or unexported fields
}
DirectStatsService return service stats.
func NewDirectStatsService ¶
func NewDirectStatsService( renderer pdfrender.PDFRenderer, ) *DirectStatsService
NewDirectStatsService constructor.
type ExampleNotFoundError ¶
type ExampleNotFoundError struct {
// contains filtered or unexported fields
}
ExampleNotFoundError wrap templates error.
func NewExampleNotFoundError ¶
func NewExampleNotFoundError(exampleName string) *ExampleNotFoundError
NewExampleNotFoundError construct new ExampleNotFoundError.
func (*ExampleNotFoundError) Error ¶
func (err *ExampleNotFoundError) Error() string
func (*ExampleNotFoundError) Is ¶
func (err *ExampleNotFoundError) Is(otherErr error) bool
Is change error type and call errors.Is on inner error.
type ExampleSpec ¶
type ExampleSpec struct {
Name string
}
ExampleSpec for building API specification.
type JSONSchema ¶
JSONSchema define marshalable JSON schema instance.
type PDFRenderService ¶
type PDFRenderService interface { RenderPDFWithData( ctx context.Context, templateName string, data Data, ) ([]byte, error) RenderPDFExample( ctx context.Context, templateName string, exampleName string, ) ([]byte, error) GetExamplesData( ctx context.Context, templateName string, ) (map[string]Data, error) }
PDFRenderService interface describe service when render PDF by template name and data.
type RenderInfo ¶
type RenderInfo struct { Pool RenderPoolInfo Metadata map[string]string }
RenderInfo contains pool info and metadata.
type RenderPoolInfo ¶
type RenderPoolInfo struct { Stats RenderPoolStats Type string }
RenderPoolInfo contains pool stats and type.
type RenderPoolStats ¶
RenderPoolStats container internal render pool stats.
type SimpleValidateService ¶
type SimpleValidateService struct {
// contains filtered or unexported fields
}
SimpleValidateService parse templates and render all examples.
func NewSimpleValidateService ¶
func NewSimpleValidateService( templatesStore templates.Store, ) *SimpleValidateService
NewSimpleValidateService constructor.
type SpecService ¶
type SpecService interface { GetSpec() ([]TemplateSpec, error) GetTemplateSchema(templateName string) (JSONSchema, error) }
SpecService build internal representation of API specification.
type StatsService ¶
StatsService collect service stats.
type TemplateNotFoundError ¶
type TemplateNotFoundError struct {
// contains filtered or unexported fields
}
TemplateNotFoundError wrap templates.TemplateNotExistsError.
func NewTemplateNotFound ¶
func NewTemplateNotFound(err error) *TemplateNotFoundError
NewTemplateNotFound construct new TemplateNotFoundError.
func (*TemplateNotFoundError) Error ¶
func (err *TemplateNotFoundError) Error() string
func (*TemplateNotFoundError) Is ¶
func (err *TemplateNotFoundError) Is(otherErr error) bool
Is cast error type and match inner errors.
func (*TemplateNotFoundError) Unwrap ¶
func (err *TemplateNotFoundError) Unwrap() error
Unwrap inner error.
type TemplateSpec ¶
type TemplateSpec struct { Name string Schema JSONSchema Examples []ExampleSpec }
TemplateSpec for building API specification.
type TemplateSpecService ¶
type TemplateSpecService struct {
// contains filtered or unexported fields
}
TemplateSpecService build API spec from templates.Store.
func NewTemplateSpecService ¶
func NewTemplateSpecService(templatesStore templates.Store) *TemplateSpecService
NewTemplateSpecService construct TemplateSpecService instance.
func (*TemplateSpecService) GetSpec ¶
func (service *TemplateSpecService) GetSpec() ([]TemplateSpec, error)
GetSpec return API specification from templates.Store.
func (*TemplateSpecService) GetTemplateSchema ¶
func (service *TemplateSpecService) GetTemplateSchema(templateName string) (JSONSchema, error)
GetTemplateSchema return template spec from templates.Store.