feat: Add bucket schema management commands (#52)

* feat: update generated client to include schema-management APIs
* feat: implement interfaces to decode flags and CSV
* feat: implement decoders for different measurement schema column formats
* feat: extend bucket CLI commands to support schema type property
* feat: add CLI commands to manage measurement schema
* test: add unit tests for bucket schema create, update and list commands
This commit is contained in:
Stuart Carnie
2021-05-06 00:12:11 +10:00
committed by GitHub
parent 4a1e6223f0
commit 7eca7c0bb9
39 changed files with 4014 additions and 11 deletions

View File

@ -0,0 +1,39 @@
package api
import (
"fmt"
"strings"
)
// UnmarshalCSV implements the gocsv.TypeUnmarshaller interface
// for decoding CSV.
func (v *ColumnSemanticType) UnmarshalCSV(s string) error {
types := []string{string(COLUMNSEMANTICTYPE_TIMESTAMP), string(COLUMNSEMANTICTYPE_TAG), string(COLUMNSEMANTICTYPE_FIELD)}
for _, t := range types {
if s == t {
*v = ColumnSemanticType(t)
return nil
}
}
return fmt.Errorf("%q is not a valid column type. Valid values are [%s]", s, strings.Join(types, ", "))
}
// UnmarshalCSV implements the gocsv.TypeUnmarshaller interface
// for decoding CSV.
func (v *ColumnDataType) UnmarshalCSV(s string) error {
types := []string{
string(COLUMNDATATYPE_INTEGER),
string(COLUMNDATATYPE_FLOAT),
string(COLUMNDATATYPE_BOOLEAN),
string(COLUMNDATATYPE_STRING),
string(COLUMNDATATYPE_UNSIGNED),
}
for _, t := range types {
if s == t {
*v = ColumnDataType(t)
return nil
}
}
return fmt.Errorf("%q is not a valid column data type. Valid values are [%s]", s, strings.Join(types, ", "))
}