Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenCSVBookFilenamePattern ¶ added in v0.10.6
func ParseCSVFilenamePattern ¶ added in v0.9.7
Types ¶
type CSVImporter ¶
CSVImporter recognizes pattern: "<BookName>#<SheetName>.csv"
func NewCSVImporter ¶
func NewCSVImporter(filename string, sheetNames []string, parser book.SheetParser) (*CSVImporter, error)
type ExcelImporter ¶
func NewExcelImporter ¶
func NewExcelImporter(filename string, sheetNames []string, parser book.SheetParser, topN uint) (*ExcelImporter, error)
topN: 0 means read all rows
type Importer ¶
type Importer interface { // Filename returns the parsed filename of the original inputed filename. // - Excel: same as the inputed filename. // - CSV: recognizes pattern: "<BookName>#<SheetName>.csv", and returns Glob name "<BookName>#*.csv". // - XML: same as the inputed filename. Filename() string // Bookname returns the book name after parsing the original inputed filename. // - Excel: the base filename without file extension. // - CSV: recognizes pattern: "<BookName>#<SheetName>.csv", and returns "<BookName>". // - XML: the base filename without file extension. BookName() string // Metabook returns the metadata of the book. Metabook() *tableaupb.Metabook // GetSheets returns all sheets in order of the book. GetSheets() []*book.Sheet // GetSheet returns a Sheet of the specified sheet name. GetSheet(name string) *book.Sheet }
func GetMergerImporters ¶ added in v0.10.6
GetMergerImporters gathers all merger importers.
- support Glob pattern, refer https://pkg.go.dev/path/filepath#Glob
- exclude self
type ImporterMode ¶ added in v0.10.6
type ImporterMode int
const ( UnknownMode ImporterMode = 0 Protogen ImporterMode = 1 Confgen ImporterMode = 2 )
Importer mode
type Option ¶
type Option func(*Options)
Option is the functional option type.
func Mode ¶ added in v0.10.6
func Mode(m ImporterMode) Option
func Parser ¶
func Parser(parser book.SheetParser) Option
type Options ¶
type Options struct { Sheets []string // sheet names to import Parser book.SheetParser // parser to parse the worksheet TopN uint // read top N rows, 0 means read all rows Mode ImporterMode // importer mode }
type XMLImporter ¶
func NewXMLImporter ¶
func NewXMLImporter(filename string, sheets []string, parser book.SheetParser, mode ImporterMode) (*XMLImporter, error)
TODO: options
Click to show internal directories.
Click to hide internal directories.