Help us shape the future of Go! Take the 2026 Go Developer Survey

helper

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind added in v0.10.3

func Bind(v interface{}, data map[string]interface{}, vars ...*regexp.Regexp) interface{}

Bind 绑定数据

func Dump added in v1.0.0

func Dump(values ...interface{})

Dump The Dump function dumps the given variables:

func DumpError added in v1.0.0

func DumpError(values ...interface{})

DumpError dumps the given variables in red color

func DumpInfo added in v1.0.0

func DumpInfo(values ...interface{})

DumpInfo dumps the given variables in blue color

func DumpWarn added in v1.0.0

func DumpWarn(values ...interface{})

DumpWarn dumps the given variables in yellow color

func EnvInt added in v0.10.2

func EnvInt(key interface{}, defaults ...int) int

EnvInt replace $ENV.xxx with the env and cast to the integer

func EnvString added in v0.10.2

func EnvString(key interface{}, defaults ...string) string

EnvString replace $ENV.xxx with the env

func GetDevWriter added in v1.0.0

func GetDevWriter() io.Writer

GetDevWriter returns the current development mode output target.

func Marshal added in v1.0.0

func Marshal(jsonObj interface{}) ([]byte, error)

Marshal JSON data with default options

func ReadFile

func ReadFile(file io.Reader) ([]byte, error)

ReadFile 读取文件内容

func ReadFileString

func ReadFileString(file io.Reader) (string, error)

ReadFileString 读取文件内容, 返回String

func SetDevWriter added in v1.0.0

func SetDevWriter(w io.Writer)

SetDevWriter replaces the development mode output target. Called by TUI initialization to redirect output into the TUI-managed area.

func ToString added in v1.0.0

func ToString(values ...interface{}) string

ToString returns a formatted string representation of the given variables

func UnmarshalFile

func UnmarshalFile(file io.Reader, v interface{}) error

UnmarshalFile JSON Unmarshal

Types

type Formatter added in v1.0.0

type Formatter struct {
	KeyColor        *color.Color
	StringColor     *color.Color
	BoolColor       *color.Color
	NumberColor     *color.Color
	NullColor       *color.Color
	StringMaxLength int
	Indent          int
	DisabledColor   bool
	RawStrings      bool
}

Formatter is a colorized JSON formatter

func NewFormatter added in v1.0.0

func NewFormatter() *Formatter

NewFormatter create a new Formatter

func (*Formatter) Marshal added in v1.0.0

func (f *Formatter) Marshal(jsonObj interface{}) ([]byte, error)

Marshal JSON data

Jump to

Keyboard shortcuts

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