sqlutil

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoltKeyAndMappingFromSqlRow

func DoltKeyAndMappingFromSqlRow(ctx context.Context, vrw types.ValueReadWriter, r sql.Row, doltSchema schema.Schema) (types.Tuple, map[uint64]types.Value, error)

DoltKeyAndMappingFromSqlRow converts a sql.Row to key tuple and keeps a mapping from tag to value that can be used to speed up index key generation for foreign key checks.

func DoltKeyValueAndMappingFromSqlRow

func DoltKeyValueAndMappingFromSqlRow(ctx context.Context, vrw types.ValueReadWriter, r sql.Row, doltSchema schema.Schema) (types.Tuple, types.Tuple, map[uint64]types.Value, error)

DoltKeyValueAndMappingFromSqlRow converts a sql.Row to key and value tuples and keeps a mapping from tag to value that can be used to speed up index key generation for foreign key checks.

func DoltRowToSqlRow

func DoltRowToSqlRow(doltRow row.Row, sch schema.Schema) (sql.Row, error)

DoltRowToSqlRow constructs a go-mysql-server sql.Row from a Dolt row.Row.

func FromDoltSchema

func FromDoltSchema(tableName string, sch schema.Schema) (sql.PrimaryKeySchema, error)

func GetColNamesFromSqlSchema

func GetColNamesFromSqlSchema(sqlSch sql.Schema) []string

func MapToSqlIter

func MapToSqlIter(ctx context.Context, sch schema.Schema, data types.Map) (sql.RowIter, error)

MapToSqlIter returns a map reader that converts all rows to sql rows, creating a sql row iterator.

func NewStaticErrorRowIter

func NewStaticErrorRowIter(err error) sql.RowIter

func NewStaticErrorTable

func NewStaticErrorTable(orig sql.Table, err error) sql.Table

func ParseCreateTableStatement

func ParseCreateTableStatement(ctx context.Context, root *doltdb.RootValue, query string) (string, schema.Schema, error)

ParseCreateTableStatement will parse a CREATE TABLE ddl statement and use it to create a Dolt Schema. A RootValue is used to generate unique tags for the Schema

func SqlColToStr

func SqlColToStr(ctx context.Context, col interface{}) string

SqlColToStr is a utility function for converting a sql column of type interface{} to a string

func SqlRowToDoltRow

func SqlRowToDoltRow(ctx context.Context, vrw types.ValueReadWriter, r sql.Row, doltSchema schema.Schema) (row.Row, error)

SqlRowToDoltRow constructs a Dolt row.Row from a go-mysql-server sql.Row.

func ToDoltCol

func ToDoltCol(tag uint64, col *sql.Column) (schema.Column, error)

ToDoltCol returns the dolt column corresponding to the SQL column given

func ToDoltSchema

func ToDoltSchema(
	ctx context.Context,
	root *doltdb.RootValue,
	tableName string,
	sqlSchema sql.PrimaryKeySchema,
	headRoot *doltdb.RootValue,
) (schema.Schema, error)

ToDoltSchema returns a dolt Schema from the sql schema given, suitable for use in creating a table. For result set schemas, see ToDoltResultSchema.

func WriteEWKBHeader

func WriteEWKBHeader(v interface{}, buf []byte)

WriteEWKBHeader writes the SRID, endianness, and type to the byte buffer This function assumes v is a valid spatial type

func WriteEWKBLineData

func WriteEWKBLineData(l sql.Linestring, buf []byte)

WriteEWKBLineData converts a Line into a byte array in EWKB format

func WriteEWKBPointData

func WriteEWKBPointData(p sql.Point, buf []byte)

WriteEWKBPointData converts a Point into a byte array in EWKB format Very similar to function in GMS

func WriteEWKBPolyData

func WriteEWKBPolyData(p sql.Polygon, buf []byte)

WriteEWKBPolyData converts a Polygon into a byte array in EWKB format

Types

type StaticErrorEditor

type StaticErrorEditor struct {
	// contains filtered or unexported fields
}

func NewStaticErrorEditor

func NewStaticErrorEditor(err error) *StaticErrorEditor

func (*StaticErrorEditor) Close

func (e *StaticErrorEditor) Close(*sql.Context) error

func (*StaticErrorEditor) Delete

func (e *StaticErrorEditor) Delete(*sql.Context, sql.Row) error

func (*StaticErrorEditor) DiscardChanges

func (e *StaticErrorEditor) DiscardChanges(ctx *sql.Context, errorEncountered error) error

func (*StaticErrorEditor) Insert

func (e *StaticErrorEditor) Insert(*sql.Context, sql.Row) error

func (*StaticErrorEditor) SetAutoIncrementValue

func (e *StaticErrorEditor) SetAutoIncrementValue(*sql.Context, uint64) error

func (*StaticErrorEditor) StatementBegin

func (e *StaticErrorEditor) StatementBegin(ctx *sql.Context)

func (*StaticErrorEditor) StatementComplete

func (e *StaticErrorEditor) StatementComplete(ctx *sql.Context) error

func (*StaticErrorEditor) Update

func (e *StaticErrorEditor) Update(*sql.Context, sql.Row, sql.Row) error

func (*StaticErrorEditor) WithIndexLookup

func (e *StaticErrorEditor) WithIndexLookup(lookup sql.IndexLookup) sql.Table

type StaticErrorRowIter

type StaticErrorRowIter struct {
	// contains filtered or unexported fields
}

func (*StaticErrorRowIter) Close

func (i *StaticErrorRowIter) Close(*sql.Context) error

func (*StaticErrorRowIter) Next

func (i *StaticErrorRowIter) Next(*sql.Context) (sql.Row, error)

type StaticErrorTable

type StaticErrorTable struct {
	sql.Table
	// contains filtered or unexported fields
}

func (*StaticErrorTable) PartitionRows

func (t *StaticErrorTable) PartitionRows(ctx *sql.Context, p sql.Partition) (sql.RowIter, error)

func (*StaticErrorTable) Partitions

func (t *StaticErrorTable) Partitions(ctx *sql.Context) (sql.PartitionIter, error)

Jump to

Keyboard shortcuts

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