services

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	Qrunner *qrunner.Qrunner

	// Web stores the web framework
	Web *gin.Engine

	// Config stores the application configuration
	Config *config.Config

	// TemplateRenderer stores a service to easily render and cache templates
	TemplateRenderer *TemplateRenderer

	// Query is sql entered in textarea
	Query string
}

Container keep the state of application

func NewContainer

func NewContainer() *Container

NewContainer initializes web, templates etc.

func (*Container) Shutdown

func (c *Container) Shutdown() error

Shutdown shuts the Container down and disconnects all connections

type TemplateParsed

type TemplateParsed struct {
	// Template is the parsed template
	Template *template.Template
	// contains filtered or unexported fields
}

TemplateParsed is a wrapper around parsed templates which are stored in the TemplateRenderer cache

func (*TemplateParsed) Execute

func (t *TemplateParsed) Execute(data interface{}) (*bytes.Buffer, error)

Execute executes a template with the given data and provides the output

type TemplateRenderer

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

TemplateRenderer provides a flexible and easy to use method of rendering simple templates or complex sets of templates while also providing caching and/or hot-reloading depending on your current environment

func NewTemplateRenderer

func NewTemplateRenderer(cfg *config.Config) *TemplateRenderer

NewTemplateRenderer creates a new TemplateRenderer

func (*TemplateRenderer) Load

func (t *TemplateRenderer) Load(group, key string) (*TemplateParsed, error)

Load loads a template from the cache

func (*TemplateRenderer) Parse

func (t *TemplateRenderer) Parse() *templateBuilder

Parse creates a template build operation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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