Skip to content

Latest commit

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

GoStruct2Table

format your struct like a table.

Installing

$ go get -u -v github.com/runningzyp/GoStruct2Table

Simple Example

import"github.com/runningzyp/GoStruct2Table/parser"varp=struct {
NamestringAgeintAddressstring
}{
Name: "xiangcai",
Age: 18,
Address: "shanghai",
}
parser.Parse(p)
+----------+--------------------+---------------------------+
|ROOT |KEY |VALUE |
+----------+--------------------+---------------------------+
| |Name |xiangcai |
| |Age |18 |
| |Address |shanghai |
+----------+--------------------+---------------------------+

Nested:

typeNestedstruct {
Coreint
}
varp=struct {
NamestringAgeintAddressstringNestedNested
}{
Name: "xiangcai",
Age: 18,
Address: "shanghai",
Nested: Nested{Core: 1},
}
+----------+--------------------+---------------------------+
|ROOT |KEY |VALUE |
+----------+--------------------+---------------------------+
| |Name |xiangcai |
| |Age |18 |
| |Address |shanghai |
+----------+--------------------+---------------------------+
|Nested |Core |1 |
+----------+--------------------+---------------------------+

About

format your struct like a table.

Topics

Resources

Stars

10 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages