container

package
v0.0.0-...-2840294 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

This package implements a simple mechanism, that provides an consistent datamodel, that helps, to glue a template together with a content-provider. In that turn, it offers the Element object, which enables the leverage of concurrency for the site creation with asynchronously generated content.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

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

func NewContainer

func NewContainer(t *template.Template, pg PageGen) *Container

func NewContainerWithAdditional

func NewContainerWithAdditional(t *template.Template, pg PageGen, a interface{}) *Container

func (*Container) Additional

func (b *Container) Additional(a interface{})

func (*Container) ServeHTTP

func (b *Container) ServeHTTP(resp http.ResponseWriter, req *http.Request)

type Element

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

This object models a Future, that contains a string. It is suitable for the use in conjunktion with the template engine.

func DefaultElement

func DefaultElement() *Element

func NewElement

func NewElement() *Element

func (*Element) Get

func (e *Element) Get() string

Returns the string that is contained within the Element object. This function will block until the content is offered using the Offer() method.

func (*Element) Offer

func (e *Element) Offer(s string) *Element

Sets the content within the Element, so every consumer being blocked at Get() will unblock. This method may only called once. Otherwise a deadlock occurs.

type Page

type Page struct {
	Title   *Element
	Main    *Element
	SideBar []*Element
	SiteID  string
}

func (*Page) SiteActive

func (p *Page) SiteActive(s string) bool

type PageGen

type PageGen interface {
	GetPage(*http.Request) *Page
}

Jump to

Keyboard shortcuts

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