config

package
v1.8.1-0...-ed8303a Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Templates []Template
	Pages     map[string]Page   // map key is a page code
	Formats   map[string]Format // map key is a format name
}

Config is a main (exportable) config struct.

func FromYaml

func FromYaml(in []byte) (_ *Config, err error)

FromYaml creates new Config instance using YAML-structured content.

func FromYamlFile

func FromYamlFile(filepath string) (*Config, error)

FromYamlFile creates new Config instance using YAML file.

func (*Config) JSONFormat

func (c *Config) JSONFormat() (*Format, bool)

func (*Config) Template

func (c *Config) Template(name string) (*Template, bool)

Template returns a Template with the passes name.

func (*Config) TemplateNames

func (c *Config) TemplateNames() []string

TemplateNames returns all template names.

func (*Config) XMLFormat

func (c *Config) XMLFormat() (*Format, bool)

type Format

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

Format describes different response formats.

func (Format) Content

func (f Format) Content() []byte

Content returns the format content.

func (Format) Name

func (f Format) Name() string

Name returns the name of the format.

type Page

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

Page describes error page.

func (Page) Code

func (p Page) Code() string

Code returns the code of the Page.

func (Page) Description

func (p Page) Description() string

Description returns the description of the Page.

func (Page) Message

func (p Page) Message() string

Message returns the message of the Page.

type Template

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

Template describes HTTP error page template.

func (Template) Content

func (t Template) Content() []byte

Content returns the template content.

func (Template) Name

func (t Template) Name() string

Name returns the name of the template.

Jump to

Keyboard shortcuts

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