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 ¶
- func CreateDB() (*sql.DB, error)
- func GetFilteredTypeInfoResult(mem memory.Allocator, filter int32) arrow.Record
- func GetTypeInfoResult(mem memory.Allocator) arrow.Record
- func SqlInfoResultMap() flightsql.SqlInfoResultMap
- type SQLiteFlightSQLServer
- func (s *SQLiteFlightSQLServer) BeginTransaction(_ context.Context, req flightsql.ActionBeginTransactionRequest) (id []byte, err error)
- func (s *SQLiteFlightSQLServer) ClosePreparedStatement(ctx context.Context, request flightsql.ActionClosePreparedStatementRequest) error
- func (s *SQLiteFlightSQLServer) CreatePreparedStatement(ctx context.Context, req flightsql.ActionCreatePreparedStatementRequest) (result flightsql.ActionCreatePreparedStatementResult, err error)
- func (s *SQLiteFlightSQLServer) DoGetCatalogs(context.Context) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *SQLiteFlightSQLServer) DoGetCrossReference(ctx context.Context, cmd flightsql.CrossTableRef) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *SQLiteFlightSQLServer) DoGetDBSchemas(_ context.Context, cmd flightsql.GetDBSchemas) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *SQLiteFlightSQLServer) DoGetExportedKeys(ctx context.Context, ref flightsql.TableRef) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *SQLiteFlightSQLServer) DoGetImportedKeys(ctx context.Context, ref flightsql.TableRef) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *SQLiteFlightSQLServer) DoGetPreparedStatement(ctx context.Context, cmd flightsql.PreparedStatementQuery) (schema *arrow.Schema, out <-chan flight.StreamChunk, err error)
- func (s *SQLiteFlightSQLServer) DoGetPrimaryKeys(ctx context.Context, cmd flightsql.TableRef) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *SQLiteFlightSQLServer) DoGetStatement(ctx context.Context, cmd flightsql.StatementQueryTicket) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *SQLiteFlightSQLServer) DoGetTableTypes(ctx context.Context) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *SQLiteFlightSQLServer) DoGetTables(ctx context.Context, cmd flightsql.GetTables) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *SQLiteFlightSQLServer) DoGetXdbcTypeInfo(_ context.Context, cmd flightsql.GetXdbcTypeInfo) (*arrow.Schema, <-chan flight.StreamChunk, error)
- func (s *SQLiteFlightSQLServer) DoPutCommandStatementUpdate(ctx context.Context, cmd flightsql.StatementUpdate) (int64, error)
- func (s *SQLiteFlightSQLServer) DoPutPreparedStatementQuery(_ context.Context, cmd flightsql.PreparedStatementQuery, ...) ([]byte, error)
- func (s *SQLiteFlightSQLServer) DoPutPreparedStatementUpdate(ctx context.Context, cmd flightsql.PreparedStatementUpdate, ...) (int64, error)
- func (s *SQLiteFlightSQLServer) EndTransaction(_ context.Context, req flightsql.ActionEndTransactionRequest) error
- func (s *SQLiteFlightSQLServer) GetFlightInfoCatalogs(_ context.Context, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- func (s *SQLiteFlightSQLServer) GetFlightInfoCrossReference(_ context.Context, _ flightsql.CrossTableRef, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- func (s *SQLiteFlightSQLServer) GetFlightInfoExportedKeys(_ context.Context, _ flightsql.TableRef, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- func (s *SQLiteFlightSQLServer) GetFlightInfoImportedKeys(_ context.Context, _ flightsql.TableRef, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- func (s *SQLiteFlightSQLServer) GetFlightInfoPreparedStatement(_ context.Context, cmd flightsql.PreparedStatementQuery, ...) (*flight.FlightInfo, error)
- func (s *SQLiteFlightSQLServer) GetFlightInfoPrimaryKeys(_ context.Context, cmd flightsql.TableRef, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- func (s *SQLiteFlightSQLServer) GetFlightInfoSchemas(_ context.Context, cmd flightsql.GetDBSchemas, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- func (s *SQLiteFlightSQLServer) GetFlightInfoStatement(ctx context.Context, cmd flightsql.StatementQuery, ...) (*flight.FlightInfo, error)
- func (s *SQLiteFlightSQLServer) GetFlightInfoTableTypes(_ context.Context, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- func (s *SQLiteFlightSQLServer) GetFlightInfoTables(_ context.Context, cmd flightsql.GetTables, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- func (s *SQLiteFlightSQLServer) GetFlightInfoXdbcTypeInfo(_ context.Context, _ flightsql.GetXdbcTypeInfo, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
- type SqlBatchReader
- type SqliteTablesSchemaBatchReader
- func (s *SqliteTablesSchemaBatchReader) Err() error
- func (s *SqliteTablesSchemaBatchReader) Next() bool
- func (s *SqliteTablesSchemaBatchReader) Record() arrow.Record
- func (s *SqliteTablesSchemaBatchReader) Release()
- func (s *SqliteTablesSchemaBatchReader) Retain()
- func (s *SqliteTablesSchemaBatchReader) Schema() *arrow.Schema
- type Statement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 (s *SQLiteFlightSQLServer) ClosePreparedStatement(ctx context.Context, request flightsql.ActionClosePreparedStatementRequest) error
func (*SQLiteFlightSQLServer) CreatePreparedStatement ¶
func (s *SQLiteFlightSQLServer) CreatePreparedStatement(ctx context.Context, req flightsql.ActionCreatePreparedStatementRequest) (result flightsql.ActionCreatePreparedStatementResult, err error)
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 (s *SQLiteFlightSQLServer) DoGetDBSchemas(_ context.Context, cmd flightsql.GetDBSchemas) (*arrow.Schema, <-chan flight.StreamChunk, error)
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 (s *SQLiteFlightSQLServer) DoGetStatement(ctx context.Context, cmd flightsql.StatementQueryTicket) (*arrow.Schema, <-chan flight.StreamChunk, error)
func (*SQLiteFlightSQLServer) DoGetTableTypes ¶
func (s *SQLiteFlightSQLServer) DoGetTableTypes(ctx context.Context) (*arrow.Schema, <-chan flight.StreamChunk, error)
func (*SQLiteFlightSQLServer) DoGetTables ¶
func (s *SQLiteFlightSQLServer) DoGetTables(ctx context.Context, cmd flightsql.GetTables) (*arrow.Schema, <-chan flight.StreamChunk, error)
func (*SQLiteFlightSQLServer) DoGetXdbcTypeInfo ¶
func (s *SQLiteFlightSQLServer) DoGetXdbcTypeInfo(_ context.Context, cmd flightsql.GetXdbcTypeInfo) (*arrow.Schema, <-chan flight.StreamChunk, error)
func (*SQLiteFlightSQLServer) DoPutCommandStatementUpdate ¶
func (s *SQLiteFlightSQLServer) DoPutCommandStatementUpdate(ctx context.Context, cmd flightsql.StatementUpdate) (int64, error)
func (*SQLiteFlightSQLServer) DoPutPreparedStatementQuery ¶
func (s *SQLiteFlightSQLServer) DoPutPreparedStatementQuery(_ context.Context, cmd flightsql.PreparedStatementQuery, rdr flight.MessageReader, _ flight.MetadataWriter) ([]byte, error)
func (*SQLiteFlightSQLServer) DoPutPreparedStatementUpdate ¶
func (s *SQLiteFlightSQLServer) DoPutPreparedStatementUpdate(ctx context.Context, cmd flightsql.PreparedStatementUpdate, rdr flight.MessageReader) (int64, error)
func (*SQLiteFlightSQLServer) EndTransaction ¶
func (s *SQLiteFlightSQLServer) EndTransaction(_ context.Context, req flightsql.ActionEndTransactionRequest) error
func (*SQLiteFlightSQLServer) GetFlightInfoCatalogs ¶
func (s *SQLiteFlightSQLServer) GetFlightInfoCatalogs(_ context.Context, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
func (*SQLiteFlightSQLServer) GetFlightInfoCrossReference ¶
func (s *SQLiteFlightSQLServer) GetFlightInfoCrossReference(_ context.Context, _ flightsql.CrossTableRef, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
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 (s *SQLiteFlightSQLServer) GetFlightInfoPreparedStatement(_ context.Context, cmd flightsql.PreparedStatementQuery, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
func (*SQLiteFlightSQLServer) GetFlightInfoPrimaryKeys ¶
func (s *SQLiteFlightSQLServer) GetFlightInfoPrimaryKeys(_ context.Context, cmd flightsql.TableRef, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
func (*SQLiteFlightSQLServer) GetFlightInfoSchemas ¶
func (s *SQLiteFlightSQLServer) GetFlightInfoSchemas(_ context.Context, cmd flightsql.GetDBSchemas, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
func (*SQLiteFlightSQLServer) GetFlightInfoStatement ¶
func (s *SQLiteFlightSQLServer) GetFlightInfoStatement(ctx context.Context, cmd flightsql.StatementQuery, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
func (*SQLiteFlightSQLServer) GetFlightInfoTableTypes ¶
func (s *SQLiteFlightSQLServer) GetFlightInfoTableTypes(_ context.Context, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
func (*SQLiteFlightSQLServer) GetFlightInfoTables ¶
func (s *SQLiteFlightSQLServer) GetFlightInfoTables(_ context.Context, cmd flightsql.GetTables, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
func (*SQLiteFlightSQLServer) GetFlightInfoXdbcTypeInfo ¶
func (s *SQLiteFlightSQLServer) GetFlightInfoXdbcTypeInfo(_ context.Context, _ flightsql.GetXdbcTypeInfo, desc *flight.FlightDescriptor) (*flight.FlightInfo, error)
type SqlBatchReader ¶
type SqlBatchReader struct {
// contains filtered or unexported fields
}
func NewSqlBatchReader ¶
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 (*SqliteTablesSchemaBatchReader) Err ¶
func (s *SqliteTablesSchemaBatchReader) Err() error
func (*SqliteTablesSchemaBatchReader) Next ¶
func (s *SqliteTablesSchemaBatchReader) Next() bool
func (*SqliteTablesSchemaBatchReader) Record ¶
func (s *SqliteTablesSchemaBatchReader) Record() arrow.Record
func (*SqliteTablesSchemaBatchReader) Release ¶
func (s *SqliteTablesSchemaBatchReader) Release()
func (*SqliteTablesSchemaBatchReader) Retain ¶
func (s *SqliteTablesSchemaBatchReader) Retain()
func (*SqliteTablesSchemaBatchReader) Schema ¶
func (s *SqliteTablesSchemaBatchReader) Schema() *arrow.Schema