Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Wrong format for an integer with more than 3 digits #7

Open
SebiBurchi opened this issue Mar 23, 2021 · 1 comment
Open

Wrong format for an integer with more than 3 digits #7

SebiBurchi opened this issue Mar 23, 2021 · 1 comment

Comments

@SebiBurchi
Copy link

Hello,

Using ParseRow method from tableprinter.StructParser, i got an issue related to an integer with more than 3 digits. So, having an integer like 8081 is parsed to 8.8K into the row result.

@DiscoRiver
Copy link

DiscoRiver commented Apr 16, 2021

I was coming across this too. Wanted to stop by and let you know that you can include additional options in the header tag to specify how to display certain elements in your struct. Tags are listed in this file, but I linked directly to the tag you'll want;

ForceTextHeaderTag = "text"

For number types in your struct, you'll want to do something like this;

type User struct {
	UserID int `json:"userId" header:"userId,text"`
}

Adding the text option to the header tag forces it to display as-is, and won't do any rounding.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants