Documentation
¶
Index ¶
- Constants
- func DumpCols(item interface{}) column.Cols
- func DumpStruct(item interface{}, omitReadOnly bool) map[string]string
- func DumpUID(item interface{}) string
- func DumpUIDCol(item interface{}) string
- func LoadIntoStruct(data map[string]string, item interface{}) error
- type BoolRepresentation
- type Tag
Constants ¶
const ( SheetTag = "sheet" SheetTagOptionUID = "uid" SheetTagOptionReadOnly = "readonly" SheetTagOptionTrueRepr = "true=" SheetTagOptionFalseRepr = "false=" SheetTagOptionUnknownIsTrue = "utrue" )
Variables ¶
This section is empty.
Functions ¶
func DumpCols ¶
DumpCols returns column.Cols that are used for this type (regardless if the column has a valid value or not)
func DumpStruct ¶
DumpStruct dumps the structure into a rowData map based on the sheet:"..." struct tag. It can omit fields marked as read-only The uid field is not read-only by default, so if you want to omit it from the dump, you must mark it as read-only in the struct tag.
func DumpUID ¶
func DumpUID(item interface{}) string
DumpUID extracts the UID value from the struct, if it is not configured it will use the left-most value, it dumps the value even if the uid col is marked read-only
func DumpUIDCol ¶
func DumpUIDCol(item interface{}) string
DumpUIDCol is the same as DumpUID but with the column itself
func LoadIntoStruct ¶
LoadIntoStruct returns an error only if the supplied data (coming from sheets) is not valid for the type in the struct. If the struct itself has issues, it will panic as ususal.
Types ¶
type BoolRepresentation ¶
type BoolRepresentation struct {
True string
False string
// Unknown represents the default value to be used, when it can not be decided
Unknown bool
}
func (BoolRepresentation) Represent ¶
func (br BoolRepresentation) Represent(val bool) string
func (BoolRepresentation) UnRepresent ¶
func (br BoolRepresentation) UnRepresent(val string) bool
type Tag ¶
type Tag struct {
Column string
IsUID bool
// IsReadOnly is in the context of the sheet, in other words, if this is set to true, the value will be read from the sheet, but never written to the sheet
IsReadOnly bool
BoolRepresentation BoolRepresentation
}
func NewDefaultTag ¶
func NewDefaultTag() Tag