Documentation
¶
Index ¶
- Constants
- Variables
- func AlignXlsxFile(file *xlsx.File, fileName string, start int)
- func ArrayFieldIndex(s string) (prefix string, index int)
- func CellInfo(sheet *xlsx.Sheet, row int, col int) string
- func ColS(col int) string
- func FileExist(filePath string) bool
- func InitAliasConfig(file string, excels ...*xlsx.File) error
- func InitConfig(file string, excels ...*xlsx.File) error
- func IsFirstArrayField(s string) bool
- func IsSerialArrayField(pre string, cur string) bool
- func OpenXlsxFile(start int, shouldSort bool, fname string, excels []*xlsx.File) (file *xlsx.File, err error)
- func RegisterFormatter(typeName string, formatter AliasTypeFormatter, objectType, objectName string, ...)
- func RegisterPrinter(s string, p Printer)
- func RowS(row int) string
- func SerialStringLess(s1 string, s2 string) bool
- func SetTimeZone(v string)
- type AliasConfig
- type AliasInfo
- type AliasTypeFloatFormatter
- type AliasTypeFormatter
- type AliasTypeInt32Formatter
- type AliasTypeStringFormatter
- type Config
- type CustomTypeInfo
- type FieldType
- func (this *FieldType) GetDefault() string
- func (this *FieldType) GetKind() string
- func (this *FieldType) GetTag() string
- func (this *FieldType) GetType() (reflect.Type, error)
- func (this *FieldType) GetValue(val string) (reflect.Value, error)
- func (this *FieldType) Ignore(mode string) bool
- func (this *FieldType) ParseMetadata(meta string)
- func (this *FieldType) SetArray()
- func (this *FieldType) SetCombine(index int)
- type Parser
- type Printer
- type SheetInfo
- type Stream
- type TableConfig
- type TypeInfo
Constants ¶
View Source
const ( SheetHead_FieldName = 0 SheetHead_FieldKind = 1 SheetHead_FieldMeta = 2 SheetHead_FieldComment = 3 SheetHead_FieldData = 4 )
View Source
const (
SheetHead_SubSheetType = "SubSheetType"
)
Variables ¶
View Source
var ( MetaModeS = "s" MetaModeC = "c" MetaIgnore = "ignore" MetaTag = "tag" MetaCombine = "combine" MetaDefault = "default" SerialSplitKey = "_" SerialSplitSheet = "-" SerialSplitFile = "-" )
View Source
var Timezone = time.Local
Functions ¶
func ArrayFieldIndex ¶
func IsFirstArrayField ¶
func IsSerialArrayField ¶
func OpenXlsxFile ¶
func RegisterFormatter ¶
func RegisterFormatter(typeName string, formatter AliasTypeFormatter, objectType, objectName string, imports []string, notref bool)
func RegisterPrinter ¶
func SerialStringLess ¶
func SetTimeZone ¶ added in v1.0.2
func SetTimeZone(v string)
Types ¶
type AliasConfig ¶
type AliasConfig struct { IndexByAlias map[string]*AliasInfo IndexByObjectType map[string]*AliasInfo }
func GetAliasConfig ¶
func GetAliasConfig() *AliasConfig
func (*AliasConfig) GetKind ¶
func (this *AliasConfig) GetKind(kind string) string
type AliasTypeFloatFormatter ¶
type AliasTypeFloatFormatter struct{}
float32
type AliasTypeFormatter ¶
type AliasTypeFormatter interface { GetType(*AliasInfo) reflect.Type GetValue(string, *AliasInfo, bool) (reflect.Value, error) }
func GetFormatter ¶ added in v1.0.7
func GetFormatter(typeName string) AliasTypeFormatter
type AliasTypeInt32Formatter ¶
type AliasTypeInt32Formatter struct{}
int32
type AliasTypeStringFormatter ¶
type AliasTypeStringFormatter struct{}
string
type CustomTypeInfo ¶
type CustomTypeInfo struct { Name string Imports []string // true means Struct, false means *Struct NotRef bool }
func GetCustomTypeInfo ¶ added in v1.0.1
func GetCustomTypeInfo(typ string) (*CustomTypeInfo, error)
type FieldType ¶
type FieldType struct { Name string Kind string Type int Repeated bool Index int Prefix string Array bool Combine bool CombineName string CombineType string CombineIndex int Metadata map[string]string Comment string }
func NewFieldType ¶
func (*FieldType) GetDefault ¶
func (*FieldType) ParseMetadata ¶ added in v1.0.7
func (*FieldType) SetCombine ¶ added in v1.2.0
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func NewParser ¶
func NewParser(conf *TableConfig) *Parser
type Printer ¶
func GetPrinter ¶
type SheetInfo ¶
type SheetInfo struct { Config *TableConfig Sheet *xlsx.Sheet Fields []*FieldType TypeInfoS *TypeInfo ValueS reflect.Value TypeInfoC *TypeInfo ValueC reflect.Value SubSheetInfo map[string]*SheetInfo LastSubSheetRowIndex int }
func NewSheetInfo ¶
func NewSheetInfo(c *TableConfig) *SheetInfo
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) WriteBytes ¶
type TableConfig ¶
type TableConfig struct { Xlsx string Sheet string Name string GenName string GenClassName string Package string COutput []string SOutput []string Vertical bool Excel *xlsx.File }
func NewTableConfig ¶
func NewTableConfig() *TableConfig
func (*TableConfig) ParseGenName ¶ added in v1.3.0
func (this *TableConfig) ParseGenName(content string)
func (*TableConfig) ParseOutput ¶
func (this *TableConfig) ParseOutput(content string)
func (*TableConfig) ParseVertical ¶
func (this *TableConfig) ParseVertical(content string)
func (*TableConfig) String ¶
func (this *TableConfig) String() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.