web

package
v0.0.0-...-685ea2a Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// beego template caching map and supported template file extensions.
	BeeTemplates   map[string]*template.Template
	BeeTemplateExt []string

	TemplateLeft  string
	TemplateRight string
)
View Source
var FormType = map[string]bool{
	"text":     true,
	"textarea": true,
	"hidden":   true,
	"password": true,
}

form types for RenderForm function

View Source
var (
	Templates map[string]*template.Template
)

Functions

func AddFuncMap

func AddFuncMap(key string, funname interface{}) error

AddFuncMap let user to register a func in the template.

func AddTemplateExt

func AddTemplateExt(ext string)

add new extension for template.

func AssetsCss

func AssetsCss(src string) template.HTML

returns stylesheet link tag with src string.

func AssetsJs

func AssetsJs(src string) template.HTML

returns script tag with src string.

func BuildTemplate

func BuildTemplate(dir string) error

build all template files in a directory. it makes beego can render any template file in view directory.

func Compare

func Compare(a, b interface{}) (equal bool)

Compare is a quick and dirty comparison function. It will convert whatever you give it to strings and see if the two values are equal. Whitespace is trimmed. Used by the template parser as "eq".

func Date

func Date(t time.Time, format string) string

Date takes a PHP like date func to Go's time format.

func DateFormat

func DateFormat(t time.Time, layout string) (datestring string)

DateFormat takes a time and a layout string and returns a string with the formatted date. Used by the template parser as "dateformat"

func DateParse

func DateParse(dateString, format string) (time.Time, error)

Parse Date use PHP time format.

func HasTemplateExt

func HasTemplateExt(paths string) bool

return this path contains supported template extension of beego or not.

func HomeHandler

func HomeHandler(rw http.ResponseWriter, req *http.Request, conf *core.Config)

func Html2str

func Html2str(html string) string

Html2str returns escaping text convert from html.

func Htmlquote

func Htmlquote(src string) string

Htmlquote returns quoted html string.

func Htmlunquote

func Htmlunquote(src string) string

Htmlunquote returns unquoted html string.

func MakeHandler

func MakeHandler(fn webHandler, conf *core.Config) http.HandlerFunc

func ParseForm

func ParseForm(form url.Values, obj interface{}) error

parse form values to struct via tag.

func RenderForm

func RenderForm(obj interface{}) template.HTML

render object to form html. obj must be a struct pointer.

func Str2html

func Str2html(raw string) template.HTML

Convert string to template.HTML type.

func Substr

func Substr(s string, start, length int) string

Substr returns the substr from start to length.

func TimeStampFormat

func TimeStampFormat(t int64, layout string) (datestring string)

TimeStampFormat is a wrapper that convert int64 timestampt to *time.Time and call DateFormat

func TransactionsHandler

func TransactionsHandler(rw http.ResponseWriter, req *http.Request, conf *core.Config)

func UnderscoreSpace

func UnderscoreSpace(s string) string

func UrlEncode

func UrlEncode(s string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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