webpage

package
v0.0.0-...-0c93acb Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoLayout

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

GoLayout is a layout using Go templates

func (*GoLayout) LoadLayoutFile

func (l *GoLayout) LoadLayoutFile(fileName string) error

LoadLayoutFile loads a layout from a file

func (*GoLayout) LoadLayoutString

func (l *GoLayout) LoadLayoutString(contents []byte) error

LoadLayoutString loads a layout from a passed-in byte array

func (*GoLayout) RenderViewFile

func (l *GoLayout) RenderViewFile(fileName string, context interface{}) (string, error)

RenderViewFile renders a view from a file into this layout

func (*GoLayout) RenderViewFilef

func (l *GoLayout) RenderViewFilef(writer http.ResponseWriter, fileName string, context interface{}) error

RenderViewFilef renders a view from a file into this layout, then writes it out to the provider writer. Useful for HTTP responses

func (*GoLayout) RenderViewString

func (l *GoLayout) RenderViewString(contents []byte, context interface{}) (string, error)

RenderViewString renders a view from byte array content into this layout

func (*GoLayout) RenderViewStringf

func (l *GoLayout) RenderViewStringf(writer http.ResponseWriter, contents []byte, context interface{}) error

RenderViewStringf renders a view from byte array content into this layout, and writes it out to the provided writer. Useful for HTTP responses

type ILayout

type ILayout interface {
	LoadLayoutFile(fileName string) error
	LoadLayoutString(contents []byte) error
	RenderViewFile(fileName string, context interface{}) (string, error)
	RenderViewFilef(writer http.ResponseWriter, fileName string, context interface{}) error
	RenderViewString(contents []byte, context interface{}) (string, error)
	RenderViewStringf(writer http.ResponseWriter, contents []byte, context interface{}) error
}

ILayout defines an interface for layouts to adhere to

func NewGoLayoutFromFile

func NewGoLayoutFromFile(fileName string) (ILayout, error)

NewGoLayoutFromFile creates a new Mustache-based layout from a file

func NewGoLayoutFromString

func NewGoLayoutFromString(layout []byte) (ILayout, error)

NewGoLayoutFromString creates a new Mustache-based layout from a byte array

func NewMustacheLayoutFromFile

func NewMustacheLayoutFromFile(fileName string) (ILayout, error)

NewMustacheLayoutFromFile creates a new Mustache-based layout from a file

func NewMustacheLayoutFromString

func NewMustacheLayoutFromString(layout []byte) (ILayout, error)

NewMustacheLayoutFromString creates a new Mustache-based layout from a byte array

type MustacheLayout

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

MustacheLayout is a layout using Mustache templates

func (*MustacheLayout) LoadLayoutFile

func (l *MustacheLayout) LoadLayoutFile(fileName string) error

LoadLayoutFile loads a layout from a file

func (*MustacheLayout) LoadLayoutString

func (l *MustacheLayout) LoadLayoutString(contents []byte) error

LoadLayoutString loads a layout from a passed-in byte array

func (*MustacheLayout) RenderViewFile

func (l *MustacheLayout) RenderViewFile(fileName string, context interface{}) (string, error)

RenderViewFile renders a view from a file into this layout

func (*MustacheLayout) RenderViewFilef

func (l *MustacheLayout) RenderViewFilef(writer http.ResponseWriter, fileName string, context interface{}) error

RenderViewFilef renders a view from a file into this layout, then writes it out to the provider writer. Useful for HTTP responses

func (*MustacheLayout) RenderViewString

func (l *MustacheLayout) RenderViewString(contents []byte, context interface{}) (string, error)

RenderViewString renders a view from byte array content into this layout

func (*MustacheLayout) RenderViewStringf

func (l *MustacheLayout) RenderViewStringf(writer http.ResponseWriter, contents []byte, context interface{}) error

RenderViewStringf renders a view from byte array content into this layout, and writes it out to the provided writer. Useful for HTTP responses

Jump to

Keyboard shortcuts

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