Categorygithub.com/go-zoox/fmt
modulepackage
1.0.0
Repository: https://github.com/go-zoox/fmt.git
Documentation: pkg.go.dev

# 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.

# Functions

Printf prints the data, like fmt.Printf.
PrintINI prints the INI encoding of the data.
PrintJSON prints the JSON encoding of the data.
Println prints the data, like fmt.Println.
PrintTOML prints the TOML encoding of the data.
PrintYAML prints the YAML encoding of the data.

# Variables

Version is the current version of the package.