templatex

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFuncs

func AddFuncs(funcer Funcer)

AddFuncs 添加模板方法

func DateFormat

func DateFormat(v ...interface{}) string

DateFormat 格式化日期,第一个参数为日期数据,第二个参数为格式化字符串(如果有),第三个参数为默认值(如果有)

func DatetimeFormat

func DatetimeFormat(v ...interface{}) string

DatetimeFormat 日期时间格式化 // arg: 可包含三个参数 1、时间格式(time.Time或*time.Time) 2、格式化字符串(string) 3、空值时返回值字符串(string)

func DatetimePretty

func DatetimePretty(v ...interface{}) string

DatetimePretty 日期时间友好格式化 arg: 可包含三个参数 1、时间格式(time.Time或*time.Time) 2、超过友好格式化范围的格式化字符串(string) 3、空值时返回值字符串(string)

func Day

func Day() string

Day 获取当前日

func FormBegin

func FormBegin(action string, method string, opts ...string) template.HTML

FormBegin 表单开始

func FormEnd

func FormEnd() template.HTML

FormEnd 表单结束

func Lengh

func Lengh(value interface{}) int

Length 数据长度

func Month

func Month() string

Month 获取当前月份

func Now

func Now() time.Time

Now 当前时间

func Raw

func Raw(s string) template.HTML

Raw 原始HTML

func Select

func Select(v interface{}, name string, selectOptions []tag.Option, attrs ...interface{}) template.HTML

Select 下拉列表

func SelectOption

func SelectOption(opt tag.Option) template.HTML

SelectOption 下拉列表项HTML文本

func SelectWith

func SelectWith(v interface{}, name string, selectOptions []tag.Option, selectText string, selectValue string, attrs ...interface{}) template.HTML

SelectWith 下拉列表,附带选择文本

func TimeFormat

func TimeFormat(v ...interface{}) string

TimeFormat 日期时间格式化 // arg: 可包含三个参数 1、时间格式(time.Time或*time.Time) 2、格式化字符串(string) 3、空值时返回值字符串(string)

func URL

func URL(url string) template.URL

URL 原始URL

func URLDecode

func URLDecode(uri string) string

URLDecode 解码

func URLEncode

func URLEncode(s string) string

URLEncode URL编码

func URLPager

func URLPager(url string, total int, pageIndex int, pageSize ...int) template.HTML

URLPager 分页器

func Year

func Year() string

Year 获取当前年度

Types

type Funcer

type Funcer interface {
	AddFunc(funcName string, funcBody interface{})
}

Funcer 模板函数接口

Jump to

Keyboard shortcuts

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