fast

package
v0.0.0-...-d2ad1d7 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2016 License: MIT Imports: 6 Imported by: 0

README

fast rendering

demo and attempt to render those components much more fastly.

benchmarks

preliminary results

$ go test -bench=.
BenchmarkRenderWithTemplate-4   	   30000	     56485 ns/op
BenchmarkRenderWithFast-4       	 2000000	       968 ns/op
PASS
ok  	command-line-arguments	4.989s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ButtonRenderer

type ButtonRenderer struct {
	Block string
}

func NewButtonRenderer

func NewButtonRenderer() *ButtonRenderer

func (*ButtonRenderer) GetBlock

func (b *ButtonRenderer) GetBlock() string

func (*ButtonRenderer) RenderComponent

func (b *ButtonRenderer) RenderComponent(wr io.Writer, view mgc.ViewComponentRenderer, args ...interface{}) (string, error)

type ComponentRenderer

type ComponentRenderer interface {
	GetBlock() string
	RenderComponent(wr io.Writer, view mgc.ViewComponentRenderer, args ...interface{}) (string, error)
}

type RenderContext

type RenderContext struct {
	*mgc.RenderContext
	// contains filtered or unexported fields
}

func NewRenderContext

func NewRenderContext(t mgc.Templater, wr io.Writer) *RenderContext

func (*RenderContext) AttachTo

func (ctx *RenderContext) AttachTo(view mgc.ViewComponentContextSetter)

func (*RenderContext) GetRenderer

func (r *RenderContext) GetRenderer(block string) ComponentRenderer

func (*RenderContext) Register

func (r *RenderContext) Register(c ComponentRenderer)

func (*RenderContext) RenderComponent

func (ctx *RenderContext) RenderComponent(view mgc.ViewComponentRenderer, args ...interface{}) (string, error)

func (*RenderContext) SetDefaultTo

func (ctx *RenderContext) SetDefaultTo(view mgc.ViewComponentContextSetter)

Jump to

Keyboard shortcuts

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