Expand description
This is an interface for working with the Trino database, written for
use by dbcrossbar and related tools.
§Features
These may be selected at compile-time, using features = ["feature-name"]
in your Cargo.toml. If you don’t specify any features, this library is
extremely lightweight.
values: Provides aValueenum that can represent a subset of Trino’s values. This pulls in dependencies for lots of things, including geodata, decimals, JSON and UUIDs.proptest: Support for testing using theproptestcrate. This pulls inproptestand related libraries.client: A basic Trino REST client. This is mostly intended for testing, and does not currently attempt to be a production-quality client. It currently has no HTTPS or password support. This pulls in a full-fledged async HTTP stack.rustls-tls: Enable Rust-native HTTPS support with WebPKI roots in the client.macros: Provides a#[derive(TrinoRow)]macro for deserializing query results into a Ruststruct.
§What this library provides
This is a bit of a grab-bag of types and utilities, driven by the common needs of several related tools.
§Storage transforms
This is the heart of the library. This library exists because Trino doesn’t
store any data itself. Instead, it delegates storage to connectors. And
these connectors expose nearly all the limitations of the underlying storage
system. They’re often missing key data types, or don’t support NOT NULL,
or don’t support transactions. The following types help generate code that
works around these limitations:
ConnectorTypeis the main entry point to this part of the library, providing an API to describe a connector’s limitations. See this section for example code!StorageTransformdescribes how to transform data when storing it using a specific connector, and when reading it back.
§Basic utility types
These are included mostly because they’re needed by other parts of the library.
DataTypeandField, which describe a subset of available data types in Trino.Ident, which represents and prints a simple Trino identifier.QuotedString, which formats a quoted and escaped string.TableOptions, which represents theWITHclause of aCREATE TABLEstatement.
§Values (requires the values feature)
Valuerepresents a subset of Trino’s values.- [
IsCloseEnoughTo] is a trait for comparing values that knows about the limitations of Trino’s connectors.
§Other features
crate::proptest(requires theproptestfeature) provides tools for generating random values for testing.crate::client(requires theclientfeature) provides a basic Trino client.
Re-exports§
pub use crate::values::Value;values
Modules§
- client
client - A basic Trino REST API client based on
reqwest. - pretty
- Pretty-printing support for Trino SQL.
- proptest
proptest - Generate values for testing using
proptest. - values
values - Trino values (or at least those we care about).
Structs§
- Field
- A field in a
DataType::Rowdata type. - Ident
- A Trino identifier, which may need to be quoted, depending on contents.
- Quoted
String - Formatting wrapper for quoted strings.
- Storage
Transform - Downgrades from stanard Trino types (used when running SQL) to “simpler” types that are supported by particular storage backends.
- Table
Options - The
WITH (...)clause of aCREATE TABLEstatement.
Enums§
- Connector
Type - Compatibility information about each supported Trino connector type.
- Data
Type - A Trino data type.
- Identifier
Error - An error related to a Trino identifier.
Derive Macros§
- Trino
Row macros - Allow a struct type to be used with Trino.