Documentation
¶
Index ¶
- func AssetsCSS(text string) template.HTML
- func AssetsJs(text string) template.HTML
- func BuildTemplate(dir string, funcMap template.FuncMap, delims Delims, files ...string) error
- func DateFormat(t time.Time) string
- func DateTimeFormat(t time.Time, format string) string
- func FileExists(name string) bool
- func HTML2str(html string) string
- func InSlice(v string, sl []string) bool
- func IntDate(val int64) (ret string)
- func IntDateTime(val int64) (ret string)
- func IntDateTimeFormat(val int64, format string) (ret string)
- func Str2html(str string) template.HTML
- func Substr(s string, start, length int) string
- type Delims
- type HTMLRender
- type Render
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTemplate ¶
BuildTemplate init template
func DateTimeFormat ¶
DateTimeFormat 格式化时间显示 format = "YYYY-MM-DD HH:mm:ss" or "YYYY年MM月DD日"
func FileExists ¶
FileExists reports whether the named file or directory exists.
func IntDateTime ¶
IntDateTime return datetime string format ="YYYY-MM-DD HH:mm:ss"
func IntDateTimeFormat ¶
DateTimeFormat return datetime string format ="YYYY-MM-DD HH:mm:ss" or format ="YYYY-MM-DD HH:mm"
Types ¶
type HTMLRender ¶
HTMLRender a simple html render
func (HTMLRender) Instance ¶
func (r HTMLRender) Instance(name string, data interface{}) Render
func (HTMLRender) Render ¶
func (r HTMLRender) Render(w http.ResponseWriter) error
Render (HTML) executes template and writes its result with custom ContentType for response.
func (HTMLRender) WriteContentType ¶
func (r HTMLRender) WriteContentType(w http.ResponseWriter)
WriteContentType (HTML) writes HTML ContentType.
type Render ¶
type Render interface {
// Render writes data with custom ContentType.
Render(http.ResponseWriter) error
// WriteContentType writes custom ContentType.
WriteContentType(w http.ResponseWriter)
Instance(name string, data interface{}) Render
}
Render interface is to be implemented by JSON, XML, HTML, YAML and so on.
Click to show internal directories.
Click to hide internal directories.