...
1 package table
2
3 import (
4 "reflect"
5 )
6
7
8
9
10 func AutoIndexColumnID(colIdx int) string {
11 charIdx := colIdx % 26
12 out := string(rune(65 + charIdx))
13 colIdx = colIdx / 26
14 if colIdx > 0 {
15 return AutoIndexColumnID(colIdx-1) + out
16 }
17 return out
18 }
19
20
21 func isNumber(x interface{}) bool {
22 if x == nil {
23 return false
24 }
25
26 switch reflect.TypeOf(x).Kind() {
27 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
28 reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
29 reflect.Float32, reflect.Float64:
30 return true
31 }
32 return false
33 }
34
35
36 type WidthEnforcer func(col string, maxLen int) string
37
38
39 func widthEnforcerNone(col string, maxLen int) string {
40 return col
41 }
42
View as plain text