Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SQLRowsToRows ¶
SQLRowsToRows return rows from sql.Rows
Types ¶
type ColData ¶
type ColData struct { Name string `json:"name"` Data interface{} `json:"data"` DataType string `json:"data_type"` }
ColData hold data of a column
type Filter ¶
type Filter struct { Operator string `json:"operator"` // "=" ColumnName string `json:"column_name"` Value interface{} `json:"value"` }
Filter containt filter
type Mapper ¶
type Mapper interface { Create(dbName, tableName string, d RowData) (RowData, error) Update(dbName, tableName string, d RowData) (RowData, error) Delete(dbName, tableName string, fields, data []interface{}) error Query(Query) ([]string, []interface{}, error) RawQuery(dbName string, sql string) ([]string, []database.Column, []interface{}, error) ColumnMetadata(Query) ([]database.Column, error) ColumnMetadataByRows(*sql.Rows) ([]database.Column, error) Explain(dbName string, sql string) (interface{}, error) }
Mapper interface for mapping query from sql to corresponding database engine
type Query ¶
type Query struct { SourceDatabase string `json:"-"` SourceTable string `json:"-"` Fields []string `json:"fields"` Filter Filter `json:"filter"` Offset int `json:"offset"` Limit int `json:"limit"` Order []string `json:"order"` // 2 elements: "columnName" and "asc" if ascending order, "desc" if descending order }
Query contain query data for a query request
func (*Query) ColumnMetadata ¶
ColumnMetadata convert query to column spec
func (*Query) ColumnNames ¶
ColumnNames return columns name in query
func (*Query) OrderSequence ¶
OrderSequence return order sequence of columns in query
type QueryPlan ¶
type QueryPlan struct { NodeType string `json:"Node Type"` ParallelAware bool `json:"Parallel Aware"` RelationName string `json:"Relation Name"` Alias string `json:"Alias"` }
QueryPlan .
type QueryResult ¶
type QueryResult RowData
QueryResult hold data of a query have result is 1 row
func RowToQueryResult ¶
RowToQueryResult rows to query result
func (QueryResult) MarshalJSON ¶
func (r QueryResult) MarshalJSON() ([]byte, error)
MarshalJSON encode json of a row
type RowData ¶
RowData hold data of a row
func MakeRowData ¶
MakeRowData make row_data from fields([]string) and data([]{}interface)
func (RowData) ColumnsAndData ¶
ColumnsAndData return columns and data of a row_data
func (RowData) MarshalJSON ¶
MarshalJSON encode json of a row
func (RowData) RelateData ¶
RelateData get all relate-data