samplemeta

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package samplemeta implements sample type Meta which holds template metadata

Index

Constants

This section is empty.

Variables

View Source
var Data = TodoPageData{
	PageTitle: "My TODO list",
	Todos: []Todo{
		{Title: "Task 1", Done: false},
		{Title: "Task 2", Done: true},
		{Title: "Task 3", Done: true},
	},
}

Data holds a sample of some static external data

View Source
var ErrRedirect = errors.New("Abort with redirect")

ErrRedirect is an error returned when page needs to be redirected

Functions

This section is empty.

Types

type Meta

type Meta struct {
	base.Meta
	// contains filtered or unexported fields
}

Meta holds template metadata

func NewMeta

func NewMeta(status int, ctype string) *Meta

NewMeta returns new initialised Meta struct

func (Meta) ErrorMessage

func (p Meta) ErrorMessage() string

ErrorMessage returns internal or template error message

func (Meta) Location

func (p Meta) Location() string

Location returns redirect location

func (*Meta) Raise

func (p *Meta) Raise(status int, abort bool, message string) (string, error)

Raise interrupts template processing (if given) and raise error

func (*Meta) RedirectFound

func (p *Meta) RedirectFound(uri string) (string, error)

RedirectFound interrupts template processing and return redirect with StatusFound status

type Todo

type Todo struct {
	Title string
	Done  bool
}

Todo holds single todo item attrs

type TodoPageData

type TodoPageData struct {
	PageTitle string
	Todos     []Todo
}

TodoPageData holds todo page attrs

Jump to

Keyboard shortcuts

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