utils

package
v0.0.0-...-8fec888 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromJSON

func FromJSON[T any](source map[string]any, val *T) error

FromJSON updates val with the information from source, corresponding to a JSON encoding of a struct of type T. NOTE: absent slice and map fields are set to nil, not to empty slices or maps.

func ResolvePath

func ResolvePath(path string) (string, error)

ResolvePath replace ~/ prefix to produce an absolute path

func ValFromJSON

func ValFromJSON[T any](source map[string]any) (T, error)

ValFromJSON builds a struct from a map[string]any, corresponding to JSON encoding of the struct. NOTE: absent slice and map fields are set to nil, not to empty slices or maps.

func ValToJSON

func ValToJSON[T any](source T) (map[string]any, error)

ValToJSON builds a map[string]any from a struct, corresponding to JSON encoding

Types

This section is empty.

Jump to

Keyboard shortcuts

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