Documentation ¶
Overview ¶
sdb define some APIs
SimpleTable a csv(or tsv), sheet, database table can abstract to SimpleTable the ideas from jdbc API Next() for loop, and holder a rowIndex
RandomAccessTable There is no rowIndex concept, but you can walk rows too with loop. its very convinient for access sheet when you know its struct. for example: import values from a fix format sheet.
Index ¶
- func DemoRandomAccessTable(table RandomAccessTable)
- func DemoSimpleTable(table SimpleTable)
- type BaseTable
- func (t *BaseTable) Demo()
- func (t *BaseTable) GetColIndex(colName string) (colIndex int)
- func (t *BaseTable) GetColNames() []string
- func (t *BaseTable) GetCols() int
- func (t *BaseTable) GetFloat(colName string) float64
- func (t *BaseTable) GetInt(colName string) int
- func (t *BaseTable) GetRowColString(row int, col int) (result string)
- func (t *BaseTable) GetRowIndex() int
- func (t *BaseTable) GetRows() int
- func (t *BaseTable) GetString(colName string) (value string)
- func (t *BaseTable) IsHasColumn(columnName string) bool
- func (t *BaseTable) Next() bool
- type Cusor
- type RandomAccessTable
- type SimpleDB
- type SimpleTable
- type StringGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DemoRandomAccessTable ¶
func DemoRandomAccessTable(table RandomAccessTable)
func DemoSimpleTable ¶
func DemoSimpleTable(table SimpleTable)
Types ¶
type BaseTable ¶
type BaseTable struct { *Cusor StringGetter Header []string }
BaseTable SmipleTable base
func (*BaseTable) GetColIndex ¶
GetColIndex return col name index
func (*BaseTable) GetColNames ¶
GetColNames return table col names
func (*BaseTable) GetRowColString ¶
GetRowColString Random Access TODO not implement yet.
func (*BaseTable) GetRowIndex ¶
GetRowIndex returns row cursor
func (*BaseTable) IsHasColumn ¶
IsHasColumn checks columnName exists
type RandomAccessTable ¶
type RandomAccessTable interface { GetColNames() []string GetRows() int GetCols() int GetRowColString(row int, col int) string }
RandomAccessTable Can GetString by Row and Col index
type SimpleDB ¶
type SimpleDB interface {
GetSchemas() []string
}
simple db should return all schemas
type SimpleTable ¶
type SimpleTable interface { GetColNames() []string GetRows() int GetRowIndex() int GetCols() int Next() bool StringGetter GetString(colName string) string GetInt(colName string) int GetFloat(colName string) float64 IsHasColumn(columName string) bool }
SimpleTable defines SimpleTable API
type StringGetter ¶
StringGetter define GetString API