Documentation ¶
Overview ¶
*
- Copyright 2013 @ 56x.net.
- name :
- author : jarryliu
- date : 2013-02-04 20:13
- description :
- history :
*
- Copyright 2013 @ 56x.net.
- name :
- author : jarryliu
- date : 2013-02-04 20:13
- description :
- history :
Index ¶
- func CheckInject(s string) bool
- func SqlFormat(sql string, ht map[string]interface{}) (formatted string)
- type ColumnMapping
- type CsvProvider
- type ExcelProvider
- type ExportItem
- func (e *ExportItem) Export(parameters *ExportParams, provider IExportProvider, formatter IExportFormatter) []byte
- func (e *ExportItem) GetColumnMapping() []ColumnMapping
- func (e *ExportItem) GetExportColumnNames(exportColumns []string) (names []string)
- func (e *ExportItem) GetJsonData(ht map[string]string) string
- func (e *ExportItem) GetSchemaAndData(p Params) ([]map[string]interface{}, int, error)
- func (e *ExportItem) GetSchemaData(p Params) ([]map[string]interface{}, error)
- func (e *ExportItem) GetTotalCount(p Params) (int, error)
- func (e *ExportItem) GetTotalView(ht map[string]string) (row map[string]interface{})
- type ExportParams
- type IDataExportPortal
- type IDbProvider
- type IExportFormatter
- type IExportProvider
- type ItemConfig
- type ItemManager
- type Params
- type TextProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CsvProvider ¶
type CsvProvider struct {
// contains filtered or unexported fields
}
func (*CsvProvider) Export ¶
func (c *CsvProvider) Export(rows []map[string]interface{}, fields []string, names []string, formatter []IExportFormatter) (binary []byte)
type ExcelProvider ¶
type ExcelProvider struct {
// contains filtered or unexported fields
}
func (*ExcelProvider) Export ¶
func (e *ExcelProvider) Export(rows []map[string]interface{}, fields []string, names []string, formatter []IExportFormatter) (binary []byte)
type ExportItem ¶
type ExportItem struct { PortalKey string // contains filtered or unexported fields }
ExportItem 导出项目
func (*ExportItem) Export ¶
func (e *ExportItem) Export(parameters *ExportParams, provider IExportProvider, formatter IExportFormatter) []byte
Export 导出数据
func (*ExportItem) GetColumnMapping ¶
func (e *ExportItem) GetColumnMapping() []ColumnMapping
GetColumnMapping 导出的列名(比如:数据表是因为列,这里我需要列出中文列)
func (*ExportItem) GetExportColumnNames ¶
func (e *ExportItem) GetExportColumnNames( exportColumns []string) (names []string)
func (*ExportItem) GetJsonData ¶
func (e *ExportItem) GetJsonData(ht map[string]string) string
GetJsonData 获取要导出的数据Json格式
func (*ExportItem) GetSchemaAndData ¶
func (e *ExportItem) GetSchemaAndData(p Params) ([]map[string]interface{}, int, error)
func (*ExportItem) GetSchemaData ¶ added in v1.11.8
func (e *ExportItem) GetSchemaData(p Params) ([]map[string]interface{}, error)
func (*ExportItem) GetTotalCount ¶ added in v1.11.8
func (e *ExportItem) GetTotalCount(p Params) (int, error)
func (*ExportItem) GetTotalView ¶
func (e *ExportItem) GetTotalView(ht map[string]string) (row map[string]interface{})
GetTotalView 获取统计数据
type ExportParams ¶
导出参数
type IDataExportPortal ¶
type IDataExportPortal interface { //导出的列名(比如:数据表是因为列,这里我需要列出中文列) GetColumnMapping() []ColumnMapping // GetTotalCount 查询总条数 GetTotalCount(p Params) (int, error) // GetSchemaData 查询数据 GetSchemaData(p Params) ([]map[string]interface{}, error) // GetSchemaAndData 获取要导出的数据及表结构,仅在第一页时查询分页数据 GetSchemaAndData(p Params) (rows []map[string]interface{}, total int, err error) //获取要导出的数据Json格式 GetJsonData(ht map[string]string) string //获取统计数据 GetTotalView(ht map[string]string) (row map[string]interface{}) //根据导出的列名获取列的索引及对应键 GetExportColumnNames(exportColumnNames []string) (fields []string) //导出数据 Export(ep *ExportParams, p IExportProvider, f IExportFormatter) []byte }
数据导出入口
type IExportFormatter ¶
type IExportFormatter interface { // 格式化字段 Format(field, name string, rowNum int, data interface{}) interface{} }
数据格式化器
type IExportProvider ¶
type IExportProvider interface { //导出 Export(rows []map[string]interface{}, fields []string, names []string, formatter []IExportFormatter) (binary []byte) }
导出
func NewCsvProvider ¶
func NewCsvProvider() IExportProvider
func NewExcelProvider ¶
func NewExcelProvider() IExportProvider
func NewTextProvider ¶
func NewTextProvider() IExportProvider
type ItemConfig ¶
导入导出项目配置
type ItemManager ¶
type ItemManager struct {
// contains filtered or unexported fields
}
ItemManager 导出项工厂
func NewItemManager ¶
func NewItemManager(db IDbProvider, rootPath string, cacheFiles bool) *ItemManager
NewItemManager 新建导出项目管理器
func (*ItemManager) GetExportData ¶
func (f *ItemManager) GetExportData(portal string, p Params, page int, rows int) (data []map[string]interface{}, total int, err error)
GetExportData 获取导出数据
func (*ItemManager) GetItem ¶
func (f *ItemManager) GetItem(portalKey string) IDataExportPortal
GetItem 获取导出项
func (*ItemManager) GetWebExportCheckOptions ¶
func (f *ItemManager) GetWebExportCheckOptions(portal string, token string) (string, error)
GetWebExportCheckOptions 获取导出列勾选项
type TextProvider ¶
type TextProvider struct {
// contains filtered or unexported fields
}
func (*TextProvider) Export ¶
func (t *TextProvider) Export(rows []map[string]interface{}, fields []string, names []string, formatter []IExportFormatter) (binary []byte)
Click to show internal directories.
Click to hide internal directories.