class CQL::Postgres::Driver

Overview

Lets crystal-db open postgres:// and postgresql:// URLs with the wire driver, so CQL::Schema and DB.open use it unless another PostgreSQL driver (the pg shard) registered those names first. cockroachdb:// is opt-in (.register_cockroachdb, or compile with -Dcql_postgres_driver_cockroachdb) because only CockroachDB 24.3 was checked against a real server. crystal-db keeps its own pool; the options it owns are removed from the URL before the rest is read as a Config.

Defined in:

postgres/driver.cr

Constant Summary

COCKROACHDB_NAME = "cockroachdb"
DB_OWNED_KEYS = {"initial_pool_size", "max_pool_size", "max_idle_pool_size", "checkout_timeout", "retry_attempts", "retry_delay", "prepared_statements", "prepared_statements_cache"}
NAMES = {Connection::DRIVER_NAME, "postgresql"}

Class Method Summary

Instance Method Summary

Class Method Detail

def self.register : Nil #

Registers the driver under every default name nobody has claimed yet.


[View source]
def self.register_cockroachdb : Nil #

Opts DB.open("cockroachdb://...") in to this driver.


[View source]
def self.registered?(name : String) : Bool #

[View source]

Instance Method Detail

def connection_builder(uri : URI) : DB::ConnectionBuilder #
Description copied from class DB::Driver

Returns a new connection factory.

NOTE For implementors uri should be parsed once. If all the options are sound a ConnectionBuilder is returned.


[View source]