Documentation ¶
Index ¶
- Variables
- func FormatBool(b bool) string
- func LimitCheck(sheets []*XlsxSheet) (errs error)
- func LoadXlsx(fname string) (datas []*XlsxSheet, check []*XlsxCheckSheet, errs error)
- func LuaCheckFuncMax(L *lua.LState) int
- func LuaCheckFuncMin(L *lua.LState) int
- func LuaCheckFuncRange(L *lua.LState) int
- func LuaCheckFuncValues(L *lua.LState) int
- func LuaCheckTable(L *lua.LState, check *XlsxCheckSheet, innerErrors *[]error) (errs error)
- func LuaHelperGetCheckList(L *lua.LState) *[]ValueCheck
- func ParseBool(str string) (bool, error)
- func PrepareCheckTable(errs *[]error) *lua.LState
- func RegisterAutoType(check func(def string) Type)
- func RegisterCheck(name string, f lua.LGFunction)
- func RegisterDefaultChecker()
- func RegisterDefaultType()
- func RegisterType(typ Type)
- func SetLuaCheckTable(L *lua.LState, table *XlsxSheet) (err error)
- type Array
- type ArrayType
- type Boolean
- type ColumnType
- type ExportTags
- type Float
- type GoSupport
- type Int
- type Map
- type MapType
- type PBSupport
- type String
- type Type
- type Uint
- type ValueCheck
- type XlsxCell
- type XlsxCheckSheet
- type XlsxSheet
- func (sheet *XlsxSheet) ClientData() [][]*XlsxCell
- func (sheet *XlsxSheet) ClientType() []*ColumnType
- func (sheet *XlsxSheet) EnableExport(flag ExportTags) bool
- func (sheet *XlsxSheet) ExportData(tag ExportTags) [][]*XlsxCell
- func (sheet *XlsxSheet) ExportType(tag ExportTags) []*ColumnType
- func (sheet *XlsxSheet) IDTypes() []*ColumnType
- func (sheet *XlsxSheet) ServerData() [][]*XlsxCell
- func (sheet *XlsxSheet) ServerType() []*ColumnType
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrCheckTypeInvalid = errors.New("check type not support")
)
View Source
var (
ErrIgnoreColumn = errors.New("ingore this column")
)
Functions ¶
func FormatBool ¶
FormatBool returns "true" or "false" according to the value of b.
func LimitCheck ¶
func LoadXlsx ¶
func LoadXlsx(fname string) (datas []*XlsxSheet, check []*XlsxCheckSheet, errs error)
LoadXlsx 加载数据
func LuaCheckTable ¶
func LuaCheckTable(L *lua.LState, check *XlsxCheckSheet, innerErrors *[]error) (errs error)
func LuaHelperGetCheckList ¶
func LuaHelperGetCheckList(L *lua.LState) *[]ValueCheck
LuaHelperGetCheckList lua注册辅助,获取checklist指针
func PrepareCheckTable ¶
func RegisterAutoType ¶
RegisterAutoType 注册自动解析的类型
func RegisterCheck ¶
func RegisterCheck(name string, f lua.LGFunction)
func RegisterDefaultChecker ¶
func RegisterDefaultChecker()
func RegisterDefaultType ¶
func RegisterDefaultType()
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
Array 类型
func (*Array) GoTypeName ¶
func (*Array) PBTypeName ¶
type Boolean ¶
type Boolean struct{}
Boolean 布尔值类型
func (*Boolean) GoTypeName ¶
func (*Boolean) PBTypeName ¶
type ColumnType ¶
type ColumnType struct { Type Type // 字段类型 Name string // 字段名 Comment string // 注释信息 Flags ExportTags // 字段标记 // contains filtered or unexported fields }
func NewField ¶
func NewField(typ, name, commonts, filter string) (*ColumnType, error)
func (*ColumnType) EnableExport ¶
func (filed *ColumnType) EnableExport(flag ExportTags) bool
EnableExport 是否允许导出
type ExportTags ¶
type ExportTags uint32
ExportTags export flag
const ( ExportNone ExportTags = 0x00 ExportServer ExportTags = 0x01 ExportClient ExportTags = 0x02 ExportAll ExportTags = 0x03 ExportPM ExportTags = 0x04 ExportID ExportTags = 0x08 )
func SplitFlags ¶
func SplitFlags(raw string) (dst string, flags ExportTags, err error)
func (*ExportTags) All ¶
func (f *ExportTags) All() bool
func (*ExportTags) Client ¶
func (f *ExportTags) Client() bool
func (*ExportTags) ID ¶
func (f *ExportTags) ID() bool
func (*ExportTags) Server ¶
func (f *ExportTags) Server() bool
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
Float 数值类型
func NewFloat ¶
func NewFloat(name string, cheker ...ValueCheck) *Float
func (*Float) GoTypeName ¶
func (*Float) PBTypeName ¶
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int 数值类型
func NewInt ¶
func NewInt(name string, cheker ...ValueCheck) *Int
func (*Int) GoTypeName ¶
func (*Int) PBTypeName ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map 类型
func (*Map) GoTypeName ¶
func (*Map) PBTypeName ¶
type String ¶
type String struct{}
String 布尔值类型
func (*String) GoTypeName ¶
func (*String) PBTypeName ¶
type Type ¶
type Type interface { // 解析数据 Parse(src string) (replace string, val interface{}, err error) // 类型自带的检测 Checkers() []ValueCheck // 内置类型名 Name() string }
Type xlsx支持的类型接口
type Uint ¶
type Uint struct {
// contains filtered or unexported fields
}
Uint 数值类型
func NewUint ¶
func NewUint(name string, cheker ...ValueCheck) *Uint
func (*Uint) GoTypeName ¶
func (*Uint) PBTypeName ¶
type ValueCheck ¶
type ValueCheck func(val interface{}) (err error)
数据检测
func ParseCheker ¶
func ParseCheker(check string) (chekers []ValueCheck, err error)
type XlsxCheckSheet ¶
XlsxCheckSheet lua数据检测
func ParseCheckXlsx ¶
func ParseCheckXlsx(fromFile string, sheet *xlsx.Sheet) (data *XlsxCheckSheet, errs error)
ParseCheckXlsx 解析数据检测脚本表格(lua)
type XlsxSheet ¶
type XlsxSheet struct { // sheet 名 SheetName string // 生成结构体名称 StructName string // 来源文件 FromFile string // 字段及类型 AllType []*ColumnType // 数据 索引分别是 行,列 AllData [][]*XlsxCell // 单结构体标记 KVFlag bool // sheet级标记 Flag ExportTags // contains filtered or unexported fields }
func ParseDataXlsx ¶
func ParseDataXlsx(fromFile string, sheet *xlsx.Sheet, sheetName string, flags ExportTags) (data *XlsxSheet, errs error)
ParseDataXlsx 解析数据表格 数组或者map
func ParseKVXlsx ¶
func ParseKVXlsx(fromFile string, sheet *xlsx.Sheet, sheetName string, flags ExportTags) (data *XlsxSheet, errs error)
ParseKVXlsx 解析结构体表格
func (*XlsxSheet) ClientData ¶
func (*XlsxSheet) ClientType ¶
func (sheet *XlsxSheet) ClientType() []*ColumnType
func (*XlsxSheet) EnableExport ¶
func (sheet *XlsxSheet) EnableExport(flag ExportTags) bool
EnableExport 是否允许导出
func (*XlsxSheet) ExportData ¶
func (sheet *XlsxSheet) ExportData(tag ExportTags) [][]*XlsxCell
func (*XlsxSheet) ExportType ¶
func (sheet *XlsxSheet) ExportType(tag ExportTags) []*ColumnType
func (*XlsxSheet) IDTypes ¶
func (sheet *XlsxSheet) IDTypes() []*ColumnType
func (*XlsxSheet) ServerData ¶
func (*XlsxSheet) ServerType ¶
func (sheet *XlsxSheet) ServerType() []*ColumnType
Click to show internal directories.
Click to hide internal directories.