fmt

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: MIT Imports: 5 Imported by: 0

README

Fmt - Pretty Data Display, Inlcude JSON/YAML/TOML/INI ...

PkgGoDev Build Status Go Report Card Coverage Status GitHub issues Release

Installation

To install the package, run:

go get github.com/go-zoox/fmt

Getting Started

import (
  "testing"
  "github.com/go-zoox/fmt"
)

func main(t *testing.T) {
		type User struct {
		Name    string
		Age     int
		Address struct {
			City   string
			Street string
		}
		Hobbies []string
	}

	user := User{
		Name: "Zero",
		Age:  18,
		Address: struct {
			City   string
			Street string
		}{
			City:   "Shanghai",
			Street: "Nanjingxi Road Street",
		},
		Hobbies: []string{"sport", "music", "movies"},
	}

	fmt.Println("JSON Format:")
	fmt.PrintJSON(user)
	fmt.Println("\nYAML Format:")
	fmt.PrintYAML(user)
	fmt.Println("\nTOML Format:")
	fmt.PrintTOML(user)
	// Println("\nINI Format:")
	// PrintINI(user)
	fmt.Println("\nRaw Format:")
	fmt.Println(user)
}

License

GoZoox is released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "1.0.0"

Version is the current version of the package.

Functions

func PrintINI

func PrintINI(v any)

PrintINI prints the INI encoding of the data.

func PrintJSON

func PrintJSON(v any)

PrintJSON prints the JSON encoding of the data.

func PrintTOML

func PrintTOML(v any)

PrintTOML prints the TOML encoding of the data.

func PrintYAML

func PrintYAML(v any)

PrintYAML prints the YAML encoding of the data.

func Printf

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

Printf prints the data, like fmt.Printf.

func Println

func Println(v any)

Println prints the data, like fmt.Println.

Types

This section is empty.

Jump to

Keyboard shortcuts

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