template

package
v0.0.0-...-a2946bf Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildUserMetasFunc

func BuildUserMetasFunc(cc SimpleContainer) func(queryK, queryV string, field string) []string

BuildUserMetasFunc 构建查询用户元信息的函数

func CreateParser

func CreateParser(cc SimpleContainer, templateStr string) (*template.Template, error)

CreateParser create a template parser

func CutOffLine

func CutOffLine(maxLine int, val string) string

CutOffLine 字符串截取指定行数

func DOMFilterHTML

func DOMFilterHTML(selector string, original string) []string

DOMFilterHTML 从 HTML DOM 对象中查询所有匹配 selector 的元素

func DOMFilterHTMLIndex

func DOMFilterHTMLIndex(selector string, index int, html string) string

DOMFilterHTMLIndex 从 HTML DOM 对象中查询第 index 个匹配 selector 的元素内容

func FormatHTML

func FormatHTML(html string) string

FormatHTML 格式化 HTML 内容

func HTML2Markdown

func HTML2Markdown(ht string) string

HTML2Markdown 将 HTML 转换为 Markdown 格式

func Implode

func Implode(elems interface{}, sep string) string

func JSONBeauty

func JSONBeauty(content string) string

JSONBeauty format content as json beauty

func JSONCutOffFields

func JSONCutOffFields(length int, body string) map[string]interface{}

JSONCutOffFields 对 JSON 字符串扁平化,然后对每个 KV 截取指定长度

func JSONCutOffFieldsStr

func JSONCutOffFieldsStr(length int, body string) string

JSONCutOffFieldsStr 对 JSON 字符串扁平化,然后对每个 KV 截取指定长度,输出字符串

func LineFilterExclude

func LineFilterExclude(excludeStr string, val string) string

func LineFilterExcludes

func LineFilterExcludes(val string, excludeStrs ...string) string

func LineFilterInclude

func LineFilterInclude(includeStr string, val string) string

func LineFilterIncludes

func LineFilterIncludes(val string, includeStrs ...string) string

func MapFieldsCutoff

func MapFieldsCutoff(length int, source map[string]interface{}) map[string]interface{}

MapFieldsCutoff 对 Map 的每个 KV 截取指定长度

func Markdown2Confluence

func Markdown2Confluence(md string) string

Markdown2Confluence 将 Markdown 转换为 confluence 富文本格式

func Markdown2html

func Markdown2html(mc string) string

Markdown2html 将 Markdown 转换为 HTML

func MetaFilter

func MetaFilter(meta map[string]interface{}, allowKeys ...string) map[string]interface{}

MetaFilter 过滤 Meta,只保留允许的key

func MetaFilterExclude

func MetaFilterExclude(meta map[string]interface{}, excludeKeys ...string) map[string]interface{}

MetaFilterExclude 过滤 Meta,排除不允许的key

func MetaFilterPrefix

func MetaFilterPrefix(meta map[string]interface{}, allowKeyPrefix ...string) map[string]interface{}

MetaFilterPrefix 过滤 Meta,只保留以 allowKeyPrefix 开头的项

func MetaFilterPrefixExclude

func MetaFilterPrefixExclude(meta map[string]interface{}, disableKeyPrefixes ...string) map[string]interface{}

MetaFilterPrefixExclude 过滤 Meta,排除以 disableKeyPrefix 开头的项

func NumberBeauty

func NumberBeauty(number interface{}) string

NumberBeauty 字符串数字格式化

func Parse

func Parse(cc SimpleContainer, templateStr string, data interface{}) (string, error)

Parse template with data to html

func RemoveEmptyLine

func RemoveEmptyLine(content string) string

RemoveEmptyLine 从字符串中移除空行

func Serialize

func Serialize(data interface{}) string

Serialize 对象序列化为字符串,用于展示

func SlackRequestBody

func SlackRequestBody(channelName string, username string, emoji string, text string) string

SlackRequestBody 构建 Slack 请求体

func StrConcat

func StrConcat(str ...string) string

StrConcat 字符串拼接

func StringMask

func StringMask(content string, left int) string

StringMask create a mask for string

func StringTags

func StringTags(tags string, sep string) []string

StringTags split tags string to array

func TrimPrefixMapK

func TrimPrefixMapK(prefix string, source map[string]interface{}) map[string]interface{}

TrimPrefixMapK 移除 Map 中所有 Key 的前缀

Types

type EventSummaryItem

type EventSummaryItem struct {
	Meta      repository.EventMeta `json:"meta,omitempty" yaml:"meta,omitempty"`
	Content   string               `json:"content,omitempty" yaml:"content,omitempty"`
	CreatedAt string               `json:"created_at,omitempty" yaml:"created_at,omitempty"`
}

type KVPair

type KVPair struct {
	Key   string
	Value interface{}
}

func SortMapByKeyHuman

func SortMapByKeyHuman(data map[string]interface{}) []KVPair

type Keys

type Keys []string

func (Keys) Len

func (ks Keys) Len() int

func (Keys) Less

func (ks Keys) Less(i, j int) bool

func (Keys) Swap

func (ks Keys) Swap(i, j int)

type KvPairs

type KvPairs []pkgJSON.KvPair

func (KvPairs) Len

func (k KvPairs) Len() int

func (KvPairs) Less

func (k KvPairs) Less(i, j int) bool

func (KvPairs) Swap

func (k KvPairs) Swap(i, j int)

type OpenFalconIM

type OpenFalconIM struct {
	Priority    int
	Status      string
	Endpoint    string
	Body        string
	CurrentStep int
	FormatTime  string
}

type SimpleContainer

type SimpleContainer interface {
	Get(key interface{}) (interface{}, error)
}

Jump to

Keyboard shortcuts

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