jsons

package
v0.0.0-...-ae1ba64 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Indent

func Indent(obj any, opts ...Opt) string

Indent 使用两个空格缩进

func ToBytes

func ToBytes(obj any, opts ...Opt) []byte

ToBytes return []byte. return nil if error

func ToBytesE

func ToBytesE(data any, opts ...Opt) ([]byte, error)

func ToJSON

func ToJSON(obj any, opts ...Opt) string

ToJSON 将参数转为 JSON, 如果出现错误则返回空字符串

Types

type Opt

type Opt func(*opt)

func UseIndent

func UseIndent(prefix, indent string) Opt

func UseMarshal

func UseMarshal(marshal func(v any) ([]byte, error)) Opt

func UseMarshalIndent

func UseMarshalIndent(marshalIndent func(v any, prefix string, indent string) ([]byte, error)) Opt

Jump to

Keyboard shortcuts

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