utils

package
v0.13.0-prerelease-test-3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 5 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

func ConvertInterfaceTo

func ConvertInterfaceTo[T any](v any) (T, error)

func JsonDeserialize

func JsonDeserialize(data []byte, v any) error

JsonDeserialize deserializes the given JSON data into the given value. Unlike json.Unmarshal, it does not automatically use a float64 type for numbers.

func JsonSerialize

func JsonSerialize(v any) ([]byte, error)

JsonSerialize serializes the given value to JSON. Unlike json.Marshal, it does not escape HTML characters. It also returns results without an extra newline at the end.

func ParseJsonNumberAs

func ParseJsonNumberAs[T any](n json.Number) (T, error)

Types

type RawJsonString

type RawJsonString string

func (RawJsonString) MarshalJSON

func (s RawJsonString) MarshalJSON() ([]byte, error)

func (*RawJsonString) UnmarshalJSON

func (s *RawJsonString) UnmarshalJSON(data []byte) error

type StringOrRawJson

type StringOrRawJson string

func (StringOrRawJson) MarshalJSON

func (s StringOrRawJson) MarshalJSON() ([]byte, error)

func (*StringOrRawJson) UnmarshalJSON

func (s *StringOrRawJson) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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