jsonify

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const IgnoreTag string = "jignore"
View Source
const MaskTag string = "masker"
View Source
const MaskTagFirstLast string = "fl"

Variables

This section is empty.

Functions

func AddIgnoreTag

func AddIgnoreTag(tagName string, checkFunc CheckIgnoreTagFunc)

func AddMarchallerByExample

func AddMarchallerByExample(val any, marchaller JsonifyMarchaller)

func AddMarchallerByExamplePartType

func AddMarchallerByExamplePartType(val any, marchaller JsonifyMarchaller)

func AddMarchallerByInterface

func AddMarchallerByInterface(t reflect.Type, marchaller JsonifyMarchaller)

func AddMarchallerByName

func AddMarchallerByName(typeName string, marchaller JsonifyMarchaller)

func AddMaskTag

func AddMaskTag(tagName string, maskFunc MaskTagFunc)

func GetSpecMarchaller

func GetSpecMarchaller() map[string]JsonifyMarchaller

func Jsonify

func Jsonify(val any, indent string, nextRow string) []byte

Jsonify - makes json from val. Includes privat fields. use `jignore:""` tag for ignore field use `masker:""` tag for masking field with * (len will be same) use `masker:"fl"` tag for masking field exepting first and last value there is no cyclomatic protection

func JsonifyM

func JsonifyM(val any) json.RawMessage

JsonifyM - makes json from val. Includes privat fields. use `jignore:""` tag for ignore field use `masker:""` tag for masking field with * (len will be same) use `masker:"fl"` tag for masking field exepting first and last value there is no cyclomatic protection

func JsonifyS

func JsonifyS(val any, indent string, nextRow string) string

JsonifyS - makes json from val. Includes privat fields. use `jignore:""` tag for ignore field use `masker:""` tag for masking field with * (len will be same) use `masker:"fl"` tag for masking field exepting first and last value there is no cyclomatic protection

func JsonifySLn

func JsonifySLn(val any) string

JsonifySLn - makes json from val. Includes privat fields. use `jignore:""` tag for ignore field use `masker:""` tag for masking field with * (len will be same) use `masker:"fl"` tag for masking field exepting first and last value there is no cyclomatic protection

func JsonifySM added in v1.0.0

func JsonifySM(val any) string

JsonifySM - (single line) makes json from val. Includes privat fields. use `jignore:""` tag for ignore field use `masker:""` tag for masking field with * (len will be same) use `masker:"fl"` tag for masking field exepting first and last value there is no cyclomatic protection

Types

type CheckIgnoreTagFunc

type CheckIgnoreTagFunc func(tag string) bool

type Jsonifable

type Jsonifable interface {
	Jsonify() []byte
}

type JsonifyMarchaller

type JsonifyMarchaller func(r reflect.Value, indentNow string, typeNow string, indent string, nextRow string) (res []byte, ok bool)
var SpecialMarchaller JsonifyMarchaller

type MaskTagFunc

type MaskTagFunc func(tag string, r reflect.Value, indentNow string, typeNow string, indent string, nextRow string) (res []byte, ok bool)

Jump to

Keyboard shortcuts

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