marshal

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	NameTransform func(path []string, field string) string
	Exclude       func(path []string, field string) bool
	// contains filtered or unexported fields
}

Engine marshals values with transform/exclusion hooks.

func New

func New(nameTransform func(path []string, field string) string, exclude func(path []string, field string) bool, omitEmpty bool, nilSliceNull bool, timeLayout string, caseKey string, compileName func(string) string) *Engine

func (*Engine) Marshal

func (e *Engine) Marshal(value interface{}) ([]byte, error)

func (*Engine) MarshalPtr

func (e *Engine) MarshalPtr(value interface{}) ([]byte, error)

MarshalPtr marshals pointer roots on the fast pointer path.

func (*Engine) MarshalPtrTo

func (e *Engine) MarshalPtrTo(dst []byte, value interface{}) ([]byte, error)

MarshalPtrTo appends pointer-root marshaled JSON to dst.

func (*Engine) MarshalTo

func (e *Engine) MarshalTo(dst []byte, value interface{}) ([]byte, error)

MarshalTo appends marshaled JSON to dst and returns the resulting slice.

func (*Engine) MarshalTypedPtr

func (e *Engine) MarshalTypedPtr(dst []byte, elemType reflect.Type, ptr unsafe.Pointer) ([]byte, error)

MarshalTypedPtr appends a typed pointer-root value to dst. This is intended for internal fast paths where caller already has root type and pointer.

Jump to

Keyboard shortcuts

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