msdb

package
v0.0.0-...-52c4d39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2016 License: Apache-2.0 Imports: 2 Imported by: 5

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

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) Demo

func (t *BaseTable) Demo()

Demo demos

func (*BaseTable) GetColIndex

func (t *BaseTable) GetColIndex(colName string) (colIndex int)

GetColIndex return col name index

func (*BaseTable) GetColNames

func (t *BaseTable) GetColNames() []string

GetColNames return table col names

func (*BaseTable) GetCols

func (t *BaseTable) GetCols() int

GetCols return table cols

func (*BaseTable) GetFloat

func (t *BaseTable) GetFloat(colName string) float64

GetFloat returns column float value

func (*BaseTable) GetInt

func (t *BaseTable) GetInt(colName string) int

GetInt returns column int value

func (*BaseTable) GetRowColString

func (t *BaseTable) GetRowColString(row int, col int) (result string)

GetRowColString Random Access TODO not implement yet.

func (*BaseTable) GetRowIndex

func (t *BaseTable) GetRowIndex() int

GetRowIndex returns row cursor

func (*BaseTable) GetRows

func (t *BaseTable) GetRows() int

GetRows returns table rows

func (*BaseTable) GetString

func (t *BaseTable) GetString(colName string) (value string)

GetStringByColName returns col name value.

func (*BaseTable) IsHasColumn

func (t *BaseTable) IsHasColumn(columnName string) bool

IsHasColumn checks columnName exists

func (*BaseTable) Next

func (t *BaseTable) Next() bool

Next for loop rows

type Cusor

type Cusor struct {
	MaxIndex int
	RowIndex int
}

func (*Cusor) First

func (c *Cusor) First()

func (*Cusor) Last

func (c *Cusor) Last()

func (*Cusor) Move

func (c *Cusor) Move(rowIndex int)

func (*Cusor) Next

func (c *Cusor) Next() bool

ideas from jdbc

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

type StringGetter interface {
	GetStringByIndex(col int) string //default by col index
}

StringGetter define GetString API

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL