Documentation ¶
Index ¶
- func BuildUserMetasFunc(cc SimpleContainer) func(queryK, queryV string, field string) []string
- func CreateParser(cc SimpleContainer, templateStr string) (*template.Template, error)
- func CutOffLine(maxLine int, val string) string
- func DOMFilterHTML(selector string, original string) []string
- func DOMFilterHTMLIndex(selector string, index int, html string) string
- func FormatHTML(html string) string
- func HTML2Markdown(ht string) string
- func Implode(elems interface{}, sep string) string
- func JSONBeauty(content string) string
- func JSONCutOffFields(length int, body string) map[string]interface{}
- func JSONCutOffFieldsStr(length int, body string) string
- func LineFilterExclude(excludeStr string, val string) string
- func LineFilterExcludes(val string, excludeStrs ...string) string
- func LineFilterInclude(includeStr string, val string) string
- func LineFilterIncludes(val string, includeStrs ...string) string
- func MapFieldsCutoff(length int, source map[string]interface{}) map[string]interface{}
- func Markdown2Confluence(md string) string
- func Markdown2html(mc string) string
- func MetaFilter(meta map[string]interface{}, allowKeys ...string) map[string]interface{}
- func MetaFilterExclude(meta map[string]interface{}, excludeKeys ...string) map[string]interface{}
- func MetaFilterPrefix(meta map[string]interface{}, allowKeyPrefix ...string) map[string]interface{}
- func MetaFilterPrefixExclude(meta map[string]interface{}, disableKeyPrefixes ...string) map[string]interface{}
- func NumberBeauty(number interface{}) string
- func Parse(cc SimpleContainer, templateStr string, data interface{}) (string, error)
- func RemoveEmptyLine(content string) string
- func Serialize(data interface{}) string
- func SlackRequestBody(channelName string, username string, emoji string, text string) string
- func StrConcat(str ...string) string
- func StringMask(content string, left int) string
- func StringTags(tags string, sep string) []string
- func TrimPrefixMapK(prefix string, source map[string]interface{}) map[string]interface{}
- type EventSummaryItem
- type KVPair
- type Keys
- type KvPairs
- type OpenFalconIM
- type SimpleContainer
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 DOMFilterHTML ¶
DOMFilterHTML 从 HTML DOM 对象中查询所有匹配 selector 的元素
func DOMFilterHTMLIndex ¶
DOMFilterHTMLIndex 从 HTML DOM 对象中查询第 index 个匹配 selector 的元素内容
func JSONCutOffFields ¶
JSONCutOffFields 对 JSON 字符串扁平化,然后对每个 KV 截取指定长度
func JSONCutOffFieldsStr ¶
JSONCutOffFieldsStr 对 JSON 字符串扁平化,然后对每个 KV 截取指定长度,输出字符串
func LineFilterExclude ¶
func LineFilterExcludes ¶
func LineFilterInclude ¶
func LineFilterIncludes ¶
func MapFieldsCutoff ¶
MapFieldsCutoff 对 Map 的每个 KV 截取指定长度
func Markdown2Confluence ¶
Markdown2Confluence 将 Markdown 转换为 confluence 富文本格式
func MetaFilter ¶
MetaFilter 过滤 Meta,只保留允许的key
func MetaFilterExclude ¶
MetaFilterExclude 过滤 Meta,排除不允许的key
func MetaFilterPrefix ¶
MetaFilterPrefix 过滤 Meta,只保留以 allowKeyPrefix 开头的项
func MetaFilterPrefixExclude ¶
func MetaFilterPrefixExclude(meta map[string]interface{}, disableKeyPrefixes ...string) map[string]interface{}
MetaFilterPrefixExclude 过滤 Meta,排除以 disableKeyPrefix 开头的项
func Parse ¶
func Parse(cc SimpleContainer, templateStr string, data interface{}) (string, error)
Parse template with data to html
func SlackRequestBody ¶
SlackRequestBody 构建 Slack 请求体
func StringMask ¶
StringMask create a mask for string
func StringTags ¶
StringTags split tags string to array
func TrimPrefixMapK ¶
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 OpenFalconIM ¶
type OpenFalconIM struct { Priority int Status string Endpoint string Body string CurrentStep int FormatTime string }
func ParseOpenFalconImMessage ¶
func ParseOpenFalconImMessage(msg string) OpenFalconIM
ParseOpenFalconImMessage 解析 Open-Falcon IM 消息 https://github.com/open-falcon/falcon-plus/blob/2648553f82dd3986a91239d590461c0d795f63a4/modules/alarm/cron/builder.go#L43:6
type SimpleContainer ¶
type SimpleContainer interface {
Get(key interface{}) (interface{}, error)
}