gutil

package
v0.9.12 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(values ...interface{})

Dump prints variables `values` to stdout with more manually readable.

func DumpJson

func DumpJson(jsonContent string)

DumpJson pretty dumps json content to stdout.

func DumpTo

func DumpTo(writer io.Writer, value interface{}, option DumpOption)

DumpTo writes variables `values` as a string in to `writer` with more manually readable

func DumpWithOption

func DumpWithOption(value interface{}, option DumpOption)

DumpWithOption returns variables `values` as a string with more manually readable.

func DumpWithType

func DumpWithType(values ...interface{})

DumpWithType acts like Dump, but with type information. Also see Dump.

func SliceCopy added in v0.9.10

func SliceCopy[T any](slice []T) []T

SliceCopy does a shallow copy of slice `data` for most commonly used slice type []T.

func SliceDelete added in v0.9.10

func SliceDelete[T any](slice []T, index int) (newSlice []T)

SliceDelete deletes an element at `index` and returns the new slice. It does nothing if the given `index` is invalid.

func SliceInsertAfter added in v0.9.10

func SliceInsertAfter[T any](slice []T, index int, values ...T) (newSlice []T)

SliceInsertAfter inserts the `values` to the back of `index` and returns a new slice.

func SliceInsertBefore added in v0.9.10

func SliceInsertBefore[T any](slice []T, index int, values ...T) (newSlice []T)

SliceInsertBefore inserts the `values` to the front of `index` and returns a new slice.

Types

type DumpOption

type DumpOption struct {
	WithType     bool // WithType specifies dumping content with type information.
	ExportedOnly bool // Only dump Exported fields for structs.
}

DumpOption specifies the behavior of function Export.

Jump to

Keyboard shortcuts

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