dump

package module
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: MIT Imports: 6 Imported by: 0

README

Dump

Dump

GoDev codecov Go Report Card Sourcegraph

Dumps information about a variable . The Same as PHP:var_dump

Getting Started

Installing

go get -v github.com/relunctance/dump

Usage

Example:Dump()


import (
    "github.com/relunctance/dump"
)

func main(){
	dump.Dump(
		[]string{"a", "b", "c"},
		"abc",
		1,
		1.68,
		[]int{1, 2, 3, 4, 5},
		[]int32{1, 2, 3, 4, 5},
		map[string]string{
			"a": "1",
			"b": "2",
			"c": "3",
		},
		map[string]int{
			"a": 1,
			"b": 2,
			"c": 3,
		},
	)
}

/* returns:
[
   "a",
   "b",
   "c"
]
"abc"
1
1.68
[
   1,
   2,
   3,
   4,
   5
]
[
   1,
   2,
   3,
   4,
   5
]
{
   "a": "1",
   "b": "2",
   "c": "3"
}
{
   "a": 1,
   "b": 2,
   "c": 3
}
*/

Example:ColorDump()

import (
    "github.com/relunctance/dump"
    "github.com/fatih/color"
)

func main(){
	dump.ColorDump(
		color.New(color.FgRed).Add(color.BgHiWhite),    // with color
		[]string{"a", "b", "c"},
		"abc",
		1,
		1.68,
		[]int{1, 2, 3, 4, 5},
		[]int32{1, 2, 3, 4, 5},
		map[string]string{ "a": "1", "b": "2", "c": "3", },
		map[string]int{ "a": 1, "b": 2, "c": 3, },
	)
}

Example:P()


import (
    "github.com/relunctance/dump"
)

func main(){
	dump.P(
		[]string{"a", "b", "c"},
		"abc",
		1,
		1.68,
		[]int{1, 2, 3, 4, 5},
		[]int32{1, 2, 3, 4, 5},
		map[string]string{ "a": "1", "b": "2", "c": "3", },
		map[string]int{ "a": 1, "b": 2, "c": 3, },
	)
}

Thanks

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorDump

func ColorDump(c *color.Color, vals ...interface{})

ColorDump c := color.New(color.FgCyan).Add(color.Underline) c := color.New(color.FgCyan, color.Bold) https://github.com/fatih/color

func Dump

func Dump(vals ...interface{})

Dump The same as PHP:var_dump() https://www.php.net/var_dump

func JsonDump

func JsonDump(v interface{}) string

JsonDump

func P

func P(vals ...interface{})

P alias VarDump()

func Printf added in v0.1.16

func Printf(format string, a ...interface{})

func Println added in v0.1.13

func Println(vals ...interface{})

Println alias Dump()

func Traces added in v0.1.12

func Traces() []string

func VarDump

func VarDump(vals ...interface{})

Types

type F

type F func(...interface{}) (int, error)

Jump to

Keyboard shortcuts

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