Documentation
¶
Overview ¶
antlabs, guonaihong 2023 apache 2.0
Index ¶
- type Option
- type OptionFunc
- func WithGetRawValue(getValue map[string]any) OptionFunc
- func WithGetValue(getValue map[string]string) OptionFunc
- func WithNotInline() OptionFunc
- func WithOutputFmtBefore(w io.Writer) OptionFunc
- func WithProtobuf() OptionFunc
- func WithSpecifyType(typeMap map[string]string) OptionFunc
- func WithStructName(name string) OptionFunc
- func WithTagName(name string) OptionFunc
- func WithTagNameFromKey() OptionFunc
- func WithUsePtrType(fieldList []string) OptionFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OptionFunc ¶
type OptionFunc func(c *Option)
func WithGetRawValue ¶ added in v0.0.5
func WithGetRawValue(getValue map[string]any) OptionFunc
目前支持json/yaml/http header/query string
func WithGetValue ¶ added in v0.0.4
func WithGetValue(getValue map[string]string) OptionFunc
目前只支持json/yaml
func WithOutputFmtBefore ¶ added in v0.0.4
func WithOutputFmtBefore(w io.Writer) OptionFunc
WithOutputFmtBefore(nil) 日志数据打印到控制台 WithOutputFmtBefore(w) 日志数据打印到w里
func WithSpecifyType ¶ added in v0.0.2
func WithSpecifyType(typeMap map[string]string) OptionFunc
指定类型, datal默认转成struct, 这里直接指定生成map[string]string类型 {
"data" : { "user1": "111" } } WithSpecifyType(map[string]string{ ".data": "map[string]string" })
目前只支持json/yaml
func WithStructName ¶
func WithStructName(name string) OptionFunc
设置最外层结构体的名字,WithStructName("Third")
type Third struct { B1 string `json:"b1"` B2 string `json:"b2"` }
func WithTagName ¶
func WithTagName(name string) OptionFunc
设置tag名, 修改third里面的json字段
type Third struct { B1 string `json:"b1"` B2 string `json:"b2"` }
func WithTagNameFromKey ¶ added in v0.0.3
func WithTagNameFromKey() OptionFunc
tag使用变量名, http header特殊一点 目前仅仅支持http header marshal
func WithUsePtrType ¶ added in v0.0.9
func WithUsePtrType(fieldList []string) OptionFunc
传入的字段使用指针类型 入参[]string{".字段名1", ".字段名2"} json/yaml有效
Click to show internal directories.
Click to hide internal directories.