Sha256: a233fb1d98ce02d86b7c38834b56030ab99eb7a5d05192ef3c7e411224bb9c46

Contents?: true

Size: 526 Bytes

Versions: 2

Compression:

Stored size: 526 Bytes

Contents

module Timescaledb
  class ConnectionNotEstablishedError < StandardError; end

  module_function
  
  # @param [String] config with the postgres connection string.
  def establish_connection(config)
    Connection.instance.config = config
  end

  # @param [PG::Connection] to use it directly from a raw connection
  def use_connection conn
    Connection.instance.use_connection conn
  end

  def connection
    raise ConnectionNotEstablishedError.new unless Connection.instance.connected?

    Connection.instance
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
timescaledb-0.3.0 lib/timescaledb/connection_handling.rb
timescaledb-0.2.9 lib/timescaledb/connection_handling.rb