libs

package
v0.0.0-...-46f008b Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TemplateHelpers template.FuncMap

TemplateHelpers - Template helper functions

Functions

func GetField

func GetField(config interface{}, key string, value string) string

GetField - Get field and apply the default value(if any)

params -- config {interface{}} The structure -- key {string} The field with the default set -- value {string} The value of that field

returns -- {string} The real value

func GetLink(routeName string, fields ...string) string

GetLink - Template helper function to get named router links

params -- routeName {string} Router name to craft the link for -- fields {...string} A flat map of all fields and values to pass to the router

returns -- {string} The url

func GetRouter

func GetRouter(newInstance ...bool) *mux.Router

GetRouter - Get a router instance (singleton)

params -- newInstance {bool} Optional parameter to force a new instance

returns -- {*mux.Router} Router instance

func GzipString

func GzipString(content string) ([]byte, error)

GzipString - Compress a string with gzip

params -- content {string} The string to compress

returns -- {[]bytes} Compressed data -- {error}

func ParseAllTemplates

func ParseAllTemplates() *template.Template

ParseAllTemplates - Parses all templates

returns -- {*template.Template}

Types

This section is empty.

Jump to

Keyboard shortcuts

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