rule

package
v1.11.7 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SystemProvide uint8 = 1
	WechatProvide uint8 = 2
)

Variables

This section is empty.

Functions

func GenerateAutoTitle added in v1.9.0

func GenerateAutoTitle(displayName string, templateName string) string

func GenerateCCTitle added in v1.8.0

func GenerateCCTitle(displayName string, templateName string) string

func GenerateTitle

func GenerateTitle(displayName string, templateName string) string

Types

type Data

type Data struct {
	Provide   uint8                  `json:"provide"`
	OrderData map[string]interface{} `json:"order_data"`
}

type Field added in v1.10.0

type Field struct {
	IsShort bool   `json:"is_short"`
	Tag     string `json:"tag"`
	Content string `json:"content"`
}

func AddRowSpacers added in v1.11.0

func AddRowSpacers(fields []Field) []Field

AddRowSpacers 为飞书双列排版自适应换行占位(每两个短元素插入一个空 spacer)

func GetFields

func GetFields(rules []Rule, provide uint8, data map[string]interface{}) []Field

GetFields 根据表单规则格式化消息通知卡片字段(只读无副作用)

type Options added in v1.9.0

type Options struct {
	Label string      `json:"label"`
	Value interface{} `json:"value"`
}

type Rule

type Rule struct {
	Type         string                 `json:"type"`
	Field        string                 `json:"field"`
	Title        string                 `json:"title"`
	Style        map[string]interface{} `json:"style"`
	NotifyHidden bool                   `json:"notify_hidden"`
	Children     []Rule                 `json:"children"`
	Options      []Options              `json:"options"`
}

func FlattenRules added in v1.9.0

func FlattenRules(rules []Rule) []Rule

FlattenRules 扁平化处理函数,排除 type 为 "col" 和 "fcRow" 的规则本身,但递归保留它们的子规则

func ParseRules

func ParseRules(ruleData interface{}) ([]Rule, error)

ParseRules 解析模版字段(兼顾兼容 string, []byte, map 或切片输入)

func (Rule) IsHidden added in v1.11.6

func (r Rule) IsHidden() bool

IsHidden 统一判断该规则是否属于无需通知展示的隐藏字段

type Rules

type Rules []Rule

Jump to

Keyboard shortcuts

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