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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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