Documentation
¶
Index ¶
- func ConvertPluginTypeToSQLType(t pub.PropertyType) string
- func ConvertSQLTypeToPluginType(t string, maxLength int) pub.PropertyType
- type Column
- type Columns
- type RowKey
- type RowKeys
- type RowMap
- func (r RowMap) ExtractPrefixedRowKeys(s *Schema, prefix string) (RowKeys, error)
- func (r RowMap) ExtractPrefixedRowValues(s *Schema, prefix string) (RowValues, error)
- func (r RowMap) ExtractRowKeys(s *Schema) (RowKeys, error)
- func (r RowMap) ExtractRowValues(s *Schema) (RowValues, error)
- func (r RowMap) JSON() string
- type RowValue
- type RowValues
- type Schema
- func (s *Schema) AddColumn(c *Column) *Column
- func (s *Schema) Columns() Columns
- func (s *Schema) ColumnsKeysFirst() Columns
- func (s *Schema) GetColumn(id string) *Column
- func (s *Schema) GetColumnByOpaqueName(id string) (*Column, bool)
- func (s *Schema) KeyColumns() []*Column
- func (s *Schema) Keys() []string
- func (s *Schema) LookupColumn(id string) (*Column, bool)
- func (s *Schema) NonKeyColumns() Columns
- func (s *Schema) WithColumns(cols Columns) *Schema
- type SchemaID
- type SchemaRowKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertPluginTypeToSQLType ¶
func ConvertPluginTypeToSQLType(t pub.PropertyType) string
func ConvertSQLTypeToPluginType ¶
func ConvertSQLTypeToPluginType(t string, maxLength int) pub.PropertyType
Types ¶
type Column ¶
type Column struct { SchemaID string `json:"s"` ID string `json:"id"` IsKey bool `json:"-"` // If this is true, the additional properties below this line are valid IsDiscovered bool `json:"-"` // PropertyType pub.PropertyType `json:"-"` SQLType string `json:"-"` MaxLength int64 `json:"-"` IsNullable bool `json:"-"` // contains filtered or unexported fields }
func (Column) CastForSelect ¶
Cast returns expression (which must be a SQL expression representing a value from this column) wrapped in a cast which will make the value an appropriate type for a SELECT statement. If the type of this column is already appropriate, expression will be returned.
func (Column) OpaqueName ¶
OpaqueName is an encoded safe name which can be used to alias to this column in a script.
func (Column) RenderSQLValue ¶
RenderSQLValue emits a string which will be a valid representation of value v in a SQL query.
type Columns ¶
type Columns []*Column
func (Columns) MakeSQLColumnNameList ¶
MakeSQLValuesFromMap produces a string like `ID, Value, Other` from a map by extracting the column names in the order the columns are in.
func (Columns) MakeSQLValuesFromMap ¶
MakeSQLValuesFromMap produces a string like `'a', 7, null` from a map by extracting the values in the order the columns are in.
type RowKeys ¶
type RowKeys []RowKey
func UnmarshalRowKeys ¶
type RowMap ¶
type RowMap map[string]interface{}
RowMap is a map of column name to column value. It is created from a SQL result.
func (RowMap) ExtractPrefixedRowKeys ¶
ExtractPrefixedRowKeys returns a RowKeys with the values for entry in the RowMap which has a key which matches a column in the schema when the prefix is removed. Returns an error if data does not have an entry for each key column in the schema.
func (RowMap) ExtractPrefixedRowValues ¶
ExtractPrefixedRowValues returns a RowValues with the values for entry in the RowMap which has a key which matches a column in the schema when the prefix is removed. Returns an error if data does not have an entry for each column in the schema.
func (RowMap) ExtractRowKeys ¶
ExtractPrefixedRowKeys returns a RowKeys with the values for entry in the RowMap which has a key which matches a column in the schema. Returns an error if data does not have an entry for each key column in the schema.
func (RowMap) ExtractRowValues ¶
ExtractRowValues returns a RowValues with the values for entry in the RowMap which has a key which matches a column in the schema. Returns an error if data does not have an entry for each column in the schema.
type Schema ¶
type Schema struct { ID string IsTable bool IsChangeTracking bool // The query for this schema, if it's not a table or view. Query string // contains filtered or unexported fields }
func (*Schema) ColumnsKeysFirst ¶
ColumnsKeysFirst returns the columns with keys sorted to the beginning.
func (*Schema) GetColumnByOpaqueName ¶
func (*Schema) KeyColumns ¶
KeyColumns returns the key columns, in alphabetical order.
func (*Schema) NonKeyColumns ¶
func (*Schema) WithColumns ¶
type SchemaID ¶
type SchemaID string
func (SchemaID) SQLSchema ¶
SQLSchema returns the SQL schema from the schema ID (or "dbo" if there is no schema)
func (SchemaID) SQLSchemaEsc ¶
SQLSchemaEsc returns the SQL schema from the schema ID (or "dbo" if there is no schema), surrounded by escaping `[]`.
func (SchemaID) SQLTable ¶
SQLSchema returns the SQL table name (without escaping brackets) from the schema ID, without surrounding '[]'
func (SchemaID) SQLTableEsc ¶
SQLTableEsc returns the SQL table from the schema ID (or "dbo" if there is no schema), surrounded by escaping `[]`.
type SchemaRowKey ¶
Maps a string key to a value.