sql

package
v0.16.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

README

runtime/sql

This folder contains Go bindings for the SQL native library.

It relies on a platform-specific native library being present in runtime/sql/deps. For example, for macOS ARM, the library should be at runtime/sql/deps/darwin_arm64/librillsql.dylib. The library is not checked into Git, but you can generate (download) it by running (from the repo root):

go generate ./runtime/sql

The pbast package contains bindings for the native library's protobuf-based SQL AST (found in sql/src/main/java/com/rilldata/protobuf/SqlNodeProto.proto). You can re-generate these by running (from the repo root)

go generate ./runtime/sql/pbast

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIsolateClosed = errors.New("sql: isolate closed")

Functions

func Parse added in v0.15.0

func Parse(sql string, dialect rpc.Dialect, catalog []*drivers.CatalogEntry) (*ast.SqlNodeProto, error)

Parse parses and validates a Rill SQL statement

func Transpile added in v0.15.0

func Transpile(sql string, dialect rpc.Dialect, catalog []*drivers.CatalogEntry) (string, error)

Transpile transpiles a Rill SQL statement to a target dialect

Types

type Isolate

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

Isolate represents a SQL library (GraalVM) isolate that we can interface with using the protobuf RPCs. Isolates have thread-local state, and since Go can arbitrarily create new threads, we handle the entire isolate lifecycle in a single thread-locked event loop (see eventLoop).

func OpenIsolate added in v0.15.0

func OpenIsolate() *Isolate

OpenIsolate creates an isolate and starts its event loop

func (*Isolate) Close

func (i *Isolate) Close() error

Close will finish any outstanding requests, then teardown the GraalVM isolate and end the event loop.

func (*Isolate) Request added in v0.15.0

func (i *Isolate) Request(req *rpc.Request) (*rpc.Response, error)

Request makes thread-safe requests to the SQL library. It only errors if the isolate was closed. It's the caller's responsibility to handle response.Error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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