server

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSONSchemaTypeObject = JSONSchemaType("object")
	JSONSchemaTypeArray  = JSONSchemaType("array")
	JSONSchemaTypeString = JSONSchemaType("string")
	JSONSchemaTypeNumber = JSONSchemaType("number")
)

JSON object types.

Variables

This section is empty.

Functions

func RequestIDLogger

func RequestIDLogger(
	logger log.Logger,
	debugOnlyRoutes []string,
) echo.MiddlewareFunc

RequestIDLogger inject logger to request context and extract or generate request ID.

Types

type EchoRouter

type EchoRouter struct {
	*echo.Echo
	// contains filtered or unexported fields
}

EchoRouter implement router with echo.

func NewEchoRouter

func NewEchoRouter(
	handlers HandlersInterface,
	logger log.Logger,
	tracerProvider trace.TracerProvider,
	staticDirConfig StaticDirConfig,
) (*EchoRouter, error)

NewEchoRouter constructor.

type FSDebugger

type FSDebugger struct {
	// contains filtered or unexported fields
}

FSDebugger log static file system calls.

func (*FSDebugger) Open

func (fsDebugger *FSDebugger) Open(path string) (http.File, error)

Open implements http.FS.

type HTTPServer

type HTTPServer struct {
	// contains filtered or unexported fields
}

HTTPServer wrapper on http.Server.

func ProvideHTTPServer

func ProvideHTTPServer(
	ctx context.Context,
	router Router,
	config HTTPServerConfig,
	tracerProvider trace.TracerProvider,
	propagator propagation.TextMapPropagator,
) (*HTTPServer, func(), error)

ProvideHTTPServer create and start HTTP server.

func (*HTTPServer) Close

func (httpServer *HTTPServer) Close(ctx context.Context)

Close HTTP server.

type HTTPServerConfig

type HTTPServerConfig struct {
	Addr        string
	StopTimeout time.Duration
	ReuseAddr   bool
	Static      StaticDirConfig
}

HTTPServerConfig for NewHTTPServer.

func NewHTTPServerConfig

func NewHTTPServerConfig() HTTPServerConfig

NewHTTPServerConfig return config with default values.

type Handlers

type Handlers struct {
	// contains filtered or unexported fields
}

Handlers render template to PDF.

func NewHandlers

func NewHandlers(
	pdfRenderService services.PDFRenderService,
	statsService services.StatsService,
	specService services.SpecService,
) *Handlers

NewHandlers constructor.

func (*Handlers) GetExamplesData added in v0.9.0

func (handlers *Handlers) GetExamplesData(c echo.Context) error

GetExamplesData return examples data.

func (*Handlers) GetSchema

func (handlers *Handlers) GetSchema(c echo.Context) error

GetSchema return schema of template if exists.

func (*Handlers) GetSwagger20Spec

func (handlers *Handlers) GetSwagger20Spec(c echo.Context) error

GetSwagger20Spec return Swagger 2.0 specification.

func (*Handlers) Metadata added in v0.8.0

func (*Handlers) Metadata(c echo.Context) error

Metadata collect and return server metadata.

func (*Handlers) PreviewRenderPlan added in v0.11.3

func (handlers *Handlers) PreviewRenderPlan(c echo.Context) error

PreviewRenderPlan accept template name and data and return render tasks.

func (*Handlers) RenderData

func (handlers *Handlers) RenderData(c echo.Context) error

RenderData handler.

func (*Handlers) RenderExample

func (handlers *Handlers) RenderExample(c echo.Context) error

RenderExample handler.

func (*Handlers) Status

func (handlers *Handlers) Status(c echo.Context) error

Status of services.

func (*Handlers) StatusSchema added in v0.7.2

func (*Handlers) StatusSchema(c echo.Context) error

StatusSchema return schema for Status type.

type HandlersInterface

type HandlersInterface interface {
	RenderData(echo.Context) error
	RenderExample(echo.Context) error
	PreviewRenderPlan(c echo.Context) error
	GetSwagger20Spec(echo.Context) error
	GetSchema(echo.Context) error
	GetExamplesData(echo.Context) error
	Status(echo.Context) error
	StatusSchema(echo.Context) error
	Metadata(echo.Context) error
}

HandlersInterface define Handlers interface.

type JSONRef

type JSONRef struct {
	Ref string `json:"$ref"`
}

JSONRef define JSON reference object.

func (JSONRef) IsJSONSchema added in v0.9.0

func (JSONRef) IsJSONSchema()

IsJSONSchema implement JSONSchema interface.

type JSONSchema added in v0.9.0

type JSONSchema interface {
	IsJSONSchema()
}

JSONSchema define JSON schema object subset.

type JSONSchemaObject added in v0.9.0

type JSONSchemaObject struct {
	Type       JSONSchemaType        `json:"type"`
	Properties map[string]JSONSchema `json:"properties,omitempty"`
	Items      JSONSchema            `json:"items,omitempty"`
	Required   []string              `json:"required,omitempty"`
	Additional JSONSchema            `json:"additionalProperties,omitempty"`
}

JSONSchemaObject define JSON schema object.

func (JSONSchemaObject) IsJSONSchema added in v0.9.0

func (JSONSchemaObject) IsJSONSchema()

IsJSONSchema implement JSONSchema interface.

type JSONSchemaType added in v0.9.0

type JSONSchemaType string

JSONSchemaType define JSON object type.

type Metadata added in v0.8.0

type Metadata struct {
	VersionInfo version.Info `json:"versionInfo"`
}

Metadata describe server metadata.

type PoolStats

type PoolStats struct {
	Active      int `json:"active"`
	Idle        int `json:"idle"`
	Destroyed   int `json:"destroyed"`
	Invalidated int `json:"invalidated"`
}

PoolStats of internal render pool.

type Router

type Router interface {
	http.Handler
}

Router is routed handler.

type StaticDirConfig added in v0.7.2

type StaticDirConfig struct {
	Path    string
	Enabled bool
}

StaticDirConfig define path and enabling to static dir.

func DefaultStaticDirConfig added in v0.7.2

func DefaultStaticDirConfig() StaticDirConfig

DefaultStaticDirConfig provider.

func (*StaticDirConfig) Flags added in v0.7.2

func (config *StaticDirConfig) Flags() []cliV2.Flag

Flags return config bindings for cli.

type Status

type Status struct {
	PoolStats      PoolStats         `json:"pool_stats"`
	RenderPoolType string            `json:"render_pool_type"`
	Metadata       map[string]string `json:"metadata"`
}

Status response structure.

type SwaggerSpecification

type SwaggerSpecification struct {
	Swagger string                              `json:"swagger"`
	Info    SwaggerSpecificationInfo            `json:"info"`
	Paths   map[string]SwaggerSpecificationPath `json:"paths"`
}

SwaggerSpecification define swagger 2.0 specification subset.

func BuildSwaggerSpecification

func BuildSwaggerSpecification(
	templateMetadataList []services.TemplateSpec,
) SwaggerSpecification

BuildSwaggerSpecification v2.0 from internal entities.

type SwaggerSpecificationInfo

type SwaggerSpecificationInfo struct {
	Title   string `json:"title"`
	Version string `json:"version"`
}

SwaggerSpecificationInfo define info object subset of swagger 2.0 specification.

type SwaggerSpecificationOperation

type SwaggerSpecificationOperation struct {
	Consumes   []string                        `json:"consumes,omitempty"`
	Produces   []string                        `json:"produces,omitempty"`
	Tags       []string                        `json:"tags"`
	Responses  SwaggerSpecificationResponses   `json:"responses"`
	Parameters []SwaggerSpecificationParameter `json:"parameters,omitempty"`
}

SwaggerSpecificationOperation define operation object subset of swagger 2.0 specification.

type SwaggerSpecificationParameter

type SwaggerSpecificationParameter struct {
	Name     string     `json:"name"`
	In       string     `json:"in"`
	Required bool       `json:"required"`
	Schema   JSONSchema `json:"schema,omitempty"`
}

SwaggerSpecificationParameter define parameter object subset of swagger 2.0 specification.

type SwaggerSpecificationPath

type SwaggerSpecificationPath struct {
	Get  *SwaggerSpecificationOperation `json:"get,omitempty"`
	Post *SwaggerSpecificationOperation `json:"post,omitempty"`
}

SwaggerSpecificationPath define path object subset of swagger 2.0 specification.

type SwaggerSpecificationResponse

type SwaggerSpecificationResponse struct {
	Description string     `json:"description"`
	Schema      JSONSchema `json:"schema,omitempty"`
}

SwaggerSpecificationResponse define response object subset of swagger 2.0 specification.

type SwaggerSpecificationResponses

type SwaggerSpecificationResponses map[int]SwaggerSpecificationResponse

SwaggerSpecificationResponses define responses object subset of swagger 2.0 specification.

Jump to

Keyboard shortcuts

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