Releases: urban-wombat/gotables
Remove *gotables.Table as an alias of *Table
Remove *gotables.Table as an alias of *Table
It was becoming too complicated handling the alias.
Add parser_test.go with an external package name for black-box testing.
Add a random table generator in func TestNewTableFromString_random()
It uncovered some bugs as well as exposing the unnecessary complication
of having an alias of *Table.
Fix and test subtle table cell literal parsing bug
v0.16.1 Fix and test subtle table cell literal parsing bug.
Added column type constants
The 20 gotables column type constants.
const (
ByteSlice = "[]byte"
Uint8Slice = "[]uint8"
Bool = "bool"
Byte = "byte"
Float32 = "float32"
Float64 = "float64"
Int = "int"
Int16 = "int16"
Int32 = "int32"
Int64 = "int64"
Int8 = "int8"
Rune = "rune"
String = "string"
Uint = "uint"
Uint16 = "uint16"
Uint32 = "uint32"
Uint64 = "uint64"
Uint8 = "uint8"
GotablesTable = "*gotables.Table" // "*Table" is also an alias of "*gotables.Table (hence 21 nominal types and 20 constants)."
TimeTime = "time.Time"
)
Fix: AppendRows(-1) cannot append -1 rows (must be -1 or more)
v0.15.4 Fix: AppendRows(-1) cannot append -1 rows (must be -1 or more)
Fix parsing bug with malformed subsequent struct lines.
v0.15.3 Fixed bug parsing invalid subsequent struct lines
Add diagnostic for debugging
v0.15.2.1 Update parser.go
Another attempt to get modules working
v0.15.2 Getting go mod working ...
This release is purely for implementing modules
v0.15.0 More Set nil testing. Tidy up error messages.
time.Time is now supported as a column type
(1) gotables now supports time.Time as a column type
RFC 3339 time literals are accepted as cell values and produced as string output.
[TimeTable]
t0 time.Time = 2020-03-15T14:22:30Z
t1 time.Time = 2020-03-15T14:22:30+17:00
t2 time.Time = 2020-03-15T14:22:30-17:00
t3 time.Time = 2020-03-15T14:22:30.12345Z
t4 time.Time = 2020-03-15T14:22:30.12345+17:00
t5 time.Time = 2020-03-15T14:22:30.12345-17:00
gotables.MinTime and gotables.MaxTime are the earliest and latest times that
a time.Time variable can represent.
(2) JSON now supports nested tables and time.Time column types.
A check is done during JSON marshalling to prevent circular references.
table.IsValidTableNesting() checks for potential circular references.
(3) GOB support has been reimplemented. But for some reason bench tests
indicate this implementation is slow. Table nesting and time.Time are not
supported.
(4) A *gotables.TableSet string literal can now include a TableSet name in the form:
[[MyTableSetName]]
The [[...]] syntax can occur before any table in the TableSet, but ideally before the
first table.
Tree-Tables: Added *Table as a table cell type: tables within tables
Tree-Tables
This is what I am calling tree-tables: recursively nested tables with tables in cells in tables.
Tables all the way down.
The string representation of a table has been extended to allow:-
*Table
or*gotables.Table
as a column type (it's the same type)[MyTableName]
syntax as a cell entry[]
syntax as a Gonil
entry (when a table is printed)[]
syntax as aNilTable
entry (when a table is printed)[]
syntax will be interpreted byNewTableFromString()
as aNilTable
, and not as Gonil
Note: there is no nested string representation of nested tables. Tables as strings will retain
only the names of the nested tables, and none of their content. The nested tables need to
be printed separately. This should be no problem in practice.
NilTable
NilTable
is a strange one. It's intended to act as a kind of zero-value *Table
value.
It has no name and cannot be mutated, except for giving it a name: table.SetName("MyName")
Giving it a name sets its state to not-NilTable which can then be mutated.
A NilTable
is constructed with: NewNilTable()
which takes no table name argument (it doesn't have a name
until it is de-Nilled) and does not return an error
. It is a single-context return function.
Util
I have become fed up with keeping urban-wombat/gotables
and urban-wombat/util
consistent with each other.
I have incorporated all the util
functions and methods into gotables
, giving them the prefix Util
to help
visually separate them from the other functions and methods. I hope this doesn't bother anyone. The
existing util
package remains unchanged, so nothing should break.
The latest gotables
godoc
https://godoc.org/github.com/urban-wombat/gotables
Here are some links from the godoc with Example code:-