-
Notifications
You must be signed in to change notification settings - Fork 2
/
options.go
99 lines (84 loc) · 3.13 KB
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package tada
import (
"strings"
"time"
)
var optionLevelSeparator = "|"
var optionMaxRows = 50
var optionMaxColumns = 20
var optionMaxCellWidth = 30
var optionsNullPrinter = "(null)"
var optionMergeRepeats = true
var optionWrapLines = false
var optionWarnings = true
var optionNullStrings = map[string]bool{"": true, optionsNullPrinter: true}
var optionNaNIsNull = true
var optionPrefix = "*"
var optionDateTimeFormats = []string{
"2006-01-02", "01-02-2006", "01/02/2006", "1/2/06", "1/2/2006", "2006-01-02 15:04:05 -0700 MST",
time.Kitchen, strings.ToLower(time.Kitchen),
time.RFC3339, time.RFC3339Nano, time.RFC822}
var randSeed = time.Now().Unix()
// SetOptionDefaultSeparator changes the separator used in group names and multi-level column names to sep
// (default: "|").
func SetOptionDefaultSeparator(sep string) {
optionLevelSeparator = sep
}
// SetOptionAddTimeFormat adds format to the list of time formats that
// can be parsed when converting values from string to time.Time.
func SetOptionAddTimeFormat(format string) {
optionDateTimeFormats = append(optionDateTimeFormats, format)
}
// GetOptionDefaultNullStrings returns the default list of strings that tada considers null.
func GetOptionDefaultNullStrings() []string {
return []string{"", optionsNullPrinter}
}
// SetOptionNullStrings replaces the default list of strings that tada considers null with list.
func SetOptionNullStrings(list []string) {
newList := make(map[string]bool, 0)
for _, s := range list {
newList[s] = true
}
optionNullStrings = newList
}
// SetOptionNaNStatus sets whether math.NaN() is considered a null value or not (default: true).
func SetOptionNaNStatus(set bool) {
optionNaNIsNull = set
}
// PrintOptionMaxRows changes the max number of rows displayed when printing a Series or DataFrame to n
// (default: 50).
func PrintOptionMaxRows(n int) {
optionMaxRows = n
}
// PrintOptionMaxColumns changes the max number of columns displayed when printing a Series or DataFrame to n
// (default: 20).
func PrintOptionMaxColumns(n int) {
optionMaxColumns = n
}
// PrintOptionMaxCellWidth changes the max rune width of any cell displayed when printing a Series or DataFrame to n
// (default: 30).
func PrintOptionMaxCellWidth(n int) {
optionMaxCellWidth = n
}
// defaultMaxCellWidth returns the default max rune width of any cell displayed when printing a Series or DataFrame.
func defaultMaxCellWidth() int {
return 30
}
// PrintOptionMergeRepeats (if true) instructs the String() function to merge repeated non-header values
// when printing a Series or DataFrame (default: true).
func PrintOptionMergeRepeats(set bool) {
optionMergeRepeats = set
}
// PrintOptionWrapLines (if true) instructs the String() function to wrap overly-wide rows onto new lines instead of truncating them
// when printing a Series or DataFrame (default: truncate).
func PrintOptionWrapLines(set bool) {
optionWrapLines = set
}
// DisableWarnings prevents tada from writing warning messages to the default log writer.
func DisableWarnings() {
optionWarnings = false
}
// EnableWarnings allows tada to write warning messages to the default log writer.
func EnableWarnings() {
optionWarnings = true
}