Documentation ¶
Index ¶
- Constants
- func GetTags(s interface{}) map[string]bool
- func Marshal(ss ...interface{}) ([]byte, error)
- func Unmarshal(body []byte, ss ...interface{}) error
- func UnmarshalFromFile(filePath string, ss ...interface{}) error
- type EmptySheetError
- type InvalidMarshalError
- type InvalidUnmarshalError
- type LackColError
- type LackHeaderError
- type OpenFileError
- type SheetAndSLiceMismatched
- type TagInfo
- type TagInfoMap
- type TypeMismatchedError
Constants ¶
const ( XS_TAG = "xs" NULL_TAG = "" IGNORE_TAG = "-" OMITEMPTY = "omitempty" TAG_SEPERATER = "," TAG_FORMATE_SEPERATER = ":" HYPERLINK_FORMATE = "hyperlink" )
Variables ¶
This section is empty.
Functions ¶
func GetTags ¶
parse tags. return map[string]bool, which key is tag and value is if the tag is necessary
func Marshal ¶
Marshal read the data from the slice of struct and write it into xlsx file. Every slice of struct will be written in a sheet
func Unmarshal ¶
Unmarshal parses the xlsx data and stores the result in the value pointed to by v. If v is nil or not a pointer, Unmarshal returns an InvalidUnmarshalError.
func UnmarshalFromFile ¶
UnmarshalFromFile read the xlsx file and parses the data and stores the result in the value pointed to by v. If v is nil or not a pointer, Unmarshal returns an InvalidUnmarshalError.
Types ¶
type EmptySheetError ¶
type EmptySheetError struct { }
the sheet need to contains more than one row
func (*EmptySheetError) Error ¶
func (e *EmptySheetError) Error() string
type InvalidMarshalError ¶
the parameter s is in a invalid type
func (*InvalidMarshalError) Error ¶
func (e *InvalidMarshalError) Error() string
type InvalidUnmarshalError ¶
the parameter s is in a invalid type
func (*InvalidUnmarshalError) Error ¶
func (e *InvalidUnmarshalError) Error() string
type LackColError ¶
In some rows, the value of some required fields is null
func (*LackColError) Error ¶
func (e *LackColError) Error() string
type LackHeaderError ¶
type LackHeaderError struct {
Header string
}
lack of required header
func (*LackHeaderError) Error ¶
func (e *LackHeaderError) Error() string
type OpenFileError ¶
xlsx file can't be opened without error
func (*OpenFileError) Error ¶
func (e *OpenFileError) Error() string
type SheetAndSLiceMismatched ¶
func (*SheetAndSLiceMismatched) Error ¶
func (e *SheetAndSLiceMismatched) Error() string
type TagInfoMap ¶
store the information of all tags. Headers is a array of tag M map the tag and tag's TagInfo