Documentation ¶
Index ¶
- func LoadTemplateFS(_fs fs.FS, baseDir string, patterns ...string) (*template.Template, error)
- func NewGinHandlerFromParkaHandlers(cmd cmds.Command, handlers []ParkaHandlerFunc, pdHandler ParkaHandlerFunc, ...) gin.HandlerFunc
- func RenderMarkdownTemplateToHTML(t *template.Template, data interface{}) (string, error)
- func RenderMarkdownToHTML(rendered string) (string, error)
- func SetupProcessor() (*formatters.JSONOutputFormatter, *cmds.GlazeProcessor, error)
- type EmbedFileSystem
- type JSONMarshaler
- type ParkaContext
- type ParkaHandlerFunc
- func HandleParsedLayersFromForm(layers_ []layers.ParameterLayer, onlyDefined bool) ParkaHandlerFunc
- func HandleParsedLayersFromQuery(layers_ []layers.ParameterLayer, onlyDefined bool) ParkaHandlerFunc
- func HandleParsedParametersFromForm(ps map[string]*parameters.ParameterDefinition, onlyDefined bool) ParkaHandlerFunc
- func HandleParsedParametersFromQuery(ps map[string]*parameters.ParameterDefinition, onlyDefined bool) ParkaHandlerFunc
- func HandlePrepopulatedParameters(ps map[string]interface{}) ParkaHandlerFunc
- func HandlePrepopulatedParsedLayers(layers_ map[string]*layers.ParsedParameterLayer) ParkaHandlerFunc
- type Server
- func (s *Server) HandleSimpleFormCommand(cmd cmds.Command, handlers ...ParkaHandlerFunc) gin.HandlerFunc
- func (s *Server) HandleSimpleQueryCommand(cmd cmds.Command, handlers ...ParkaHandlerFunc) gin.HandlerFunc
- func (s *Server) LookupTemplate(name ...string) (*template.Template, error)
- func (s *Server) Run() error
- type ServerOption
- type StaticPath
- type TemplateLookup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadTemplateFS ¶
func NewGinHandlerFromParkaHandlers ¶ added in v0.2.4
func NewGinHandlerFromParkaHandlers( cmd cmds.Command, handlers []ParkaHandlerFunc, pdHandler ParkaHandlerFunc, layersHandler ParkaHandlerFunc, ) gin.HandlerFunc
func RenderMarkdownToHTML ¶
func SetupProcessor ¶
func SetupProcessor() (*formatters.JSONOutputFormatter, *cmds.GlazeProcessor, error)
Types ¶
type EmbedFileSystem ¶
type EmbedFileSystem struct {
// contains filtered or unexported fields
}
EmbedFileSystem is a helper to make an embed FS work as a http.FS, which allows us to serve embed.FS using gin's `Static` middleware.
func NewEmbedFileSystem ¶
func NewEmbedFileSystem(f fs.FS, stripPrefix string) *EmbedFileSystem
type JSONMarshaler ¶
type ParkaContext ¶ added in v0.2.4
type ParkaContext struct { // Cmd is the command that will be executed Cmd cmds.Command // ParsedLayers contains the map of parsed layers parsed so far ParsedLayers map[string]*layers.ParsedParameterLayer // ParsedParameters contains the map of parsed parameters parsed so far ParsedParameters map[string]interface{} }
ParkaContext keeps the context for execution of a parka command, and can be worked upon by ParkaHandlerFuncs.
func NewParkaContext ¶ added in v0.2.4
func NewParkaContext(cmd cmds.Command) *ParkaContext
type ParkaHandlerFunc ¶ added in v0.2.4
type ParkaHandlerFunc func(*gin.Context, *ParkaContext) error
func HandleParsedLayersFromForm ¶ added in v0.2.4
func HandleParsedLayersFromForm( layers_ []layers.ParameterLayer, onlyDefined bool, ) ParkaHandlerFunc
func HandleParsedLayersFromQuery ¶ added in v0.2.4
func HandleParsedLayersFromQuery( layers_ []layers.ParameterLayer, onlyDefined bool, ) ParkaHandlerFunc
func HandleParsedParametersFromForm ¶ added in v0.2.4
func HandleParsedParametersFromForm( ps map[string]*parameters.ParameterDefinition, onlyDefined bool, ) ParkaHandlerFunc
func HandleParsedParametersFromQuery ¶ added in v0.2.4
func HandleParsedParametersFromQuery( ps map[string]*parameters.ParameterDefinition, onlyDefined bool, ) ParkaHandlerFunc
func HandlePrepopulatedParameters ¶ added in v0.2.4
func HandlePrepopulatedParameters(ps map[string]interface{}) ParkaHandlerFunc
func HandlePrepopulatedParsedLayers ¶ added in v0.2.4
func HandlePrepopulatedParsedLayers(layers_ map[string]*layers.ParsedParameterLayer) ParkaHandlerFunc
type Server ¶
type Server struct { Router *gin.Engine StaticPaths []StaticPath TemplateLookups []TemplateLookup }
func NewServer ¶
func NewServer(options ...ServerOption) (*Server, error)
func (*Server) HandleSimpleFormCommand ¶ added in v0.2.4
func (s *Server) HandleSimpleFormCommand( cmd cmds.Command, handlers ...ParkaHandlerFunc, ) gin.HandlerFunc
func (*Server) HandleSimpleQueryCommand ¶ added in v0.2.4
func (s *Server) HandleSimpleQueryCommand( cmd cmds.Command, handlers ...ParkaHandlerFunc, ) gin.HandlerFunc
func (*Server) LookupTemplate ¶
LookupTemplate will iterate through the template lookups until it finds one of the templates given in name.
type ServerOption ¶
type ServerOption = func(*Server)
func WithStaticPaths ¶
func WithStaticPaths(paths ...StaticPath) ServerOption
func WithTemplateLookups ¶
func WithTemplateLookups(lookups ...TemplateLookup) ServerOption
type StaticPath ¶
type StaticPath struct {
// contains filtered or unexported fields
}
func NewStaticPath ¶
func NewStaticPath(fs http.FileSystem, urlPath string) StaticPath
type TemplateLookup ¶
func LookupTemplateFromDirectory ¶
func LookupTemplateFromDirectory(dir string) TemplateLookup
LookupTemplateFromDirectory will load a template at runtime. This is useful for testing local changes to templates without having to recompile the app.
func LookupTemplateFromFS ¶
Click to show internal directories.
Click to hide internal directories.