pkg.re/essentialkaos/ek.10@v12.41.0+incompatible/fmtutil/table/example_test.go (about) 1 package table 2 3 // ////////////////////////////////////////////////////////////////////////////////// // 4 // // 5 // Copyright (c) 2022 ESSENTIAL KAOS // 6 // Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> // 7 // // 8 // ////////////////////////////////////////////////////////////////////////////////// // 9 10 func ExampleNewTable() { 11 t := NewTable() 12 13 t.SetHeaders("id", "user", "balance") 14 t.SetSizes(4, 12) 15 t.SetAlignments(ALIGN_RIGHT, ALIGN_RIGHT, ALIGN_LEFT) 16 17 t.Add(1, "{g}Bob{!}", 1.42) 18 t.Add(2, "John", 73.1) 19 t.Add(3, "Mary", 2.29) 20 21 t.Render() 22 }