example

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 7 more Imports: 25 Imported by: 0

Documentation

Overview

Package example contains a FlightSQL Server implementation using sqlite as the backing engine.

In order to ensure portability we'll use modernc.org/sqlite instead of github.com/mattn/go-sqlite3 because modernc is a translation of the SQLite source into Go, such that it doesn't require CGO to run and doesn't need to link against the actual libsqlite3 libraries. This way we don't require CGO or libsqlite3 to run this example or the tests.

That said, since both implement in terms of Go's standard database/sql package, it's easy to swap them out if desired as the modernc.org/sqlite package is slower than go-sqlite3.

One other important note is that modernc.org/sqlite only works correctly (specifically pragma_table_info) in go 1.18+ so this entire package is given the build constraint to only build when using go1.18 or higher

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDB

func CreateDB() (*sql.DB, error)

func GetFilteredTypeInfoResult

func GetFilteredTypeInfoResult(mem memory.Allocator, filter int32) arrow.Record

func GetTypeInfoResult

func GetTypeInfoResult(mem memory.Allocator) arrow.Record

func SqlInfoResultMap

func SqlInfoResultMap() flightsql.SqlInfoResultMap

Types

type SQLiteFlightSQLServer

type SQLiteFlightSQLServer struct {
	flightsql.BaseServer
	// contains filtered or unexported fields
}

func NewSQLiteFlightSQLServer

func NewSQLiteFlightSQLServer(db *sql.DB) (*SQLiteFlightSQLServer, error)

func (*SQLiteFlightSQLServer) BeginTransaction

func (s *SQLiteFlightSQLServer) BeginTransaction(_ context.Context, req flightsql.ActionBeginTransactionRequest) (id []byte, err error)

func (*SQLiteFlightSQLServer) ClosePreparedStatement

func (*SQLiteFlightSQLServer) DoGetCatalogs

func (s *SQLiteFlightSQLServer) DoGetCatalogs(context.Context) (*arrow.Schema, <-chan flight.StreamChunk, error)

func (*SQLiteFlightSQLServer) DoGetCrossReference

func (s *SQLiteFlightSQLServer) DoGetCrossReference(ctx context.Context, cmd flightsql.CrossTableRef) (*arrow.Schema, <-chan flight.StreamChunk, error)

func (*SQLiteFlightSQLServer) DoGetDBSchemas

func (*SQLiteFlightSQLServer) DoGetExportedKeys

func (s *SQLiteFlightSQLServer) DoGetExportedKeys(ctx context.Context, ref flightsql.TableRef) (*arrow.Schema, <-chan flight.StreamChunk, error)

func (*SQLiteFlightSQLServer) DoGetImportedKeys

func (s *SQLiteFlightSQLServer) DoGetImportedKeys(ctx context.Context, ref flightsql.TableRef) (*arrow.Schema, <-chan flight.StreamChunk, error)

func (*SQLiteFlightSQLServer) DoGetPreparedStatement

func (s *SQLiteFlightSQLServer) DoGetPreparedStatement(ctx context.Context, cmd flightsql.PreparedStatementQuery) (schema *arrow.Schema, out <-chan flight.StreamChunk, err error)

func (*SQLiteFlightSQLServer) DoGetPrimaryKeys

func (s *SQLiteFlightSQLServer) DoGetPrimaryKeys(ctx context.Context, cmd flightsql.TableRef) (*arrow.Schema, <-chan flight.StreamChunk, error)

func (*SQLiteFlightSQLServer) DoGetStatement

func (*SQLiteFlightSQLServer) DoGetTableTypes

func (s *SQLiteFlightSQLServer) DoGetTableTypes(ctx context.Context) (*arrow.Schema, <-chan flight.StreamChunk, error)

func (*SQLiteFlightSQLServer) DoGetTables

func (*SQLiteFlightSQLServer) DoGetXdbcTypeInfo

func (*SQLiteFlightSQLServer) DoPutCommandStatementUpdate

func (s *SQLiteFlightSQLServer) DoPutCommandStatementUpdate(ctx context.Context, cmd flightsql.StatementUpdate) (int64, error)

func (*SQLiteFlightSQLServer) DoPutPreparedStatementQuery

func (*SQLiteFlightSQLServer) DoPutPreparedStatementUpdate

func (s *SQLiteFlightSQLServer) DoPutPreparedStatementUpdate(ctx context.Context, cmd flightsql.PreparedStatementUpdate, rdr flight.MessageReader) (int64, error)

func (*SQLiteFlightSQLServer) EndTransaction

func (*SQLiteFlightSQLServer) GetFlightInfoCatalogs

func (s *SQLiteFlightSQLServer) GetFlightInfoCatalogs(_ context.Context, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)

func (*SQLiteFlightSQLServer) GetFlightInfoCrossReference

func (*SQLiteFlightSQLServer) GetFlightInfoExportedKeys

func (s *SQLiteFlightSQLServer) GetFlightInfoExportedKeys(_ context.Context, _ flightsql.TableRef, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)

func (*SQLiteFlightSQLServer) GetFlightInfoImportedKeys

func (s *SQLiteFlightSQLServer) GetFlightInfoImportedKeys(_ context.Context, _ flightsql.TableRef, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)

func (*SQLiteFlightSQLServer) GetFlightInfoPreparedStatement

func (*SQLiteFlightSQLServer) GetFlightInfoPrimaryKeys

func (s *SQLiteFlightSQLServer) GetFlightInfoPrimaryKeys(_ context.Context, cmd flightsql.TableRef, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)

func (*SQLiteFlightSQLServer) GetFlightInfoSchemas

func (*SQLiteFlightSQLServer) GetFlightInfoStatement

func (*SQLiteFlightSQLServer) GetFlightInfoTableTypes

func (s *SQLiteFlightSQLServer) GetFlightInfoTableTypes(_ context.Context, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)

func (*SQLiteFlightSQLServer) GetFlightInfoTables

func (*SQLiteFlightSQLServer) GetFlightInfoXdbcTypeInfo

type SqlBatchReader

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

func NewSqlBatchReader

func NewSqlBatchReader(mem memory.Allocator, rows *sql.Rows) (*SqlBatchReader, error)

func NewSqlBatchReaderWithSchema

func NewSqlBatchReaderWithSchema(mem memory.Allocator, schema *arrow.Schema, rows *sql.Rows) (*SqlBatchReader, error)

func (*SqlBatchReader) Err

func (r *SqlBatchReader) Err() error

func (*SqlBatchReader) Next

func (r *SqlBatchReader) Next() bool

func (*SqlBatchReader) Record

func (r *SqlBatchReader) Record() arrow.Record

func (*SqlBatchReader) Release

func (r *SqlBatchReader) Release()

func (*SqlBatchReader) Retain

func (r *SqlBatchReader) Retain()

func (*SqlBatchReader) Schema

func (r *SqlBatchReader) Schema() *arrow.Schema

type SqliteTablesSchemaBatchReader

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

func NewSqliteTablesSchemaBatchReader

func NewSqliteTablesSchemaBatchReader(ctx context.Context, mem memory.Allocator, rdr array.RecordReader, db *sql.DB, mainQuery string) (*SqliteTablesSchemaBatchReader, error)

func (*SqliteTablesSchemaBatchReader) Err

func (*SqliteTablesSchemaBatchReader) Next

func (*SqliteTablesSchemaBatchReader) Record

func (*SqliteTablesSchemaBatchReader) Release

func (s *SqliteTablesSchemaBatchReader) Release()

func (*SqliteTablesSchemaBatchReader) Retain

func (s *SqliteTablesSchemaBatchReader) Retain()

func (*SqliteTablesSchemaBatchReader) Schema

type Statement

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

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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