utils

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FuncMap = template.FuncMap{

	"date": php.Date,

	"strstr": php.Strstr,

	"substr": php.Substr,

	"mb_substr": php.Mb_substr,

	"strlen": php.Strlen,

	"mb_strlen": php.Mb_strlen,

	"strrev": php.Strrev,

	"str_replace": php.Str_replace,

	"url": URL,

	"url_append": UrlAppend,

	"url_delete": UrlDelete,
	"range_int":  RangeInt,
	"trim":       php.Trim,

	"parseHtml": ParseHtml,
	"parseJS":   ParseJS,

	"split": php.Split,

	"deep_equal":    DeepEqual,
	"deep_notequal": DeepNotEqual,

	"int2str":    Int2Str,
	"md5":        php.Md5,
	"strip_tags": php.Strip_tags,
	"plus_int":   PlusInt,
	"ptr_value":  PtrValue,
}

传给模板的函数

Functions

func DeepEqual added in v0.1.2

func DeepEqual(val, val2 interface{}) bool

判断指针是否相等

func DeepNotEqual added in v0.1.2

func DeepNotEqual(val, val2 interface{}) bool

func Int2Str

func Int2Str(i interface{}) string

int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float32 float64转字符串

func ParseHtml

func ParseHtml(str string) template.HTML

func ParseJS added in v0.1.2

func ParseJS(str string) template.JS

func PlusInt added in v0.1.2

func PlusInt(v, i int) int

func PtrValue added in v0.1.5

func PtrValue(v interface{}) interface{}

获取指针地址保存的值

func RangeInt

func RangeInt(start, end int) []int

生成int数组

func Str2Int

func Str2Int(str string) int

字符串转int

func Struct2Map

func Struct2Map(v interface{}) map[string]interface{}

func URL

func URL(route string, params ...interface{}) string

生成带query的url

func UrlAppend added in v0.1.2

func UrlAppend(k string, v interface{}, currentUrl string) string

当前url添加参数

func UrlDelete added in v0.1.2

func UrlDelete(k, currentUrl string) string

当前url删除参数

func Widget added in v0.1.1

func Widget(name string, data ...interface{}) template.HTML

可填参数data,只取第一个

Types

This section is empty.

Directories

Path Synopsis
常用工具类
常用工具类

Jump to

Keyboard shortcuts

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