Documentation
¶
Index ¶
- func FmtJson(v any) string
- func JsonFmt(jsonStr string) string
- func TabColorfulPrint(titles []string, data any)
- func TabColorfulPrint4Struct(obj any)
- func TabPrint(titles []string, data any)
- func TabPrint4Struct(obj any)
- type TabFormatter
- type TabFormatterType
- type TableFmt
- func (my *TableFmt) CustomizeTabFormatter(formatter TabFormatter) *TableFmt
- func (my *TableFmt) Format(titles []string, data any) string
- func (my *TableFmt) FormatStruct(obj any) string
- func (my *TableFmt) Println(titles []string, data any)
- func (my *TableFmt) Println4Struct(obj any)
- func (my *TableFmt) SetTabFormatter(tabFormatterType TabFormatterType) *TableFmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TabColorfulPrint4Struct ¶
func TabColorfulPrint4Struct(obj any)
TabColorfulPrint4Struct 表格美化炫彩输出(针对结构体切片)
Types ¶
type TabFormatter ¶
type TabFormatter struct { LeftMargin int // 左边距设置 Padding int // 内边距设置 Vertex string // 设置表格中各个顶点的字符串 TitleTopBorder byte // 设置表格中表头顶部边框字符 TitleBottomBorder byte // 设置表格中表头底部边框字符 DataBorder byte // 设置表格中数据边框字符 DataSegment string // 设置表格中数据分隔符字符串 GlobalColor color.Color // 全局颜色设置 TitleColorFun func(title string) color.Color // 表头颜色设置 CellColorFun func(title, cellVal string) color.Color // 表数据颜色设置 }
TabFormatter 表格格式化配置
type TabFormatterType ¶
type TabFormatterType string
TabFormatterType 表格格式化配置名称
const ( Gird TabFormatterType = "grid" // 网格 SnowFlake TabFormatterType = "snowFlake" // 雪花 GirdSnow TabFormatterType = "gridSnow" // 雪花网格 Colorful TabFormatterType = "colorful" // 炫彩 RedTitleSnow TabFormatterType = "redTitleSnow" // 红色表头雪花 GlobalYellow TabFormatterType = "globalYellow" // 全黄表格 )
type TableFmt ¶
type TableFmt struct {
// contains filtered or unexported fields
}
TableFmt 表格格式化输出对象
func NewTableFmt ¶
func NewTableFmt() *TableFmt
func (*TableFmt) CustomizeTabFormatter ¶
func (my *TableFmt) CustomizeTabFormatter(formatter TabFormatter) *TableFmt
CustomizeTabFormatter 自定义表格格式化配置
func (*TableFmt) FormatStruct ¶
FormatStruct 根据数据传入的结构体类型,自动解析表头并格式化数据输出
func (*TableFmt) Println4Struct ¶
func (*TableFmt) SetTabFormatter ¶
func (my *TableFmt) SetTabFormatter(tabFormatterType TabFormatterType) *TableFmt
SetTabFormatter 设置表格格式化配置
Click to show internal directories.
Click to hide internal directories.