utils

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

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.

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