class Fx::Adapters::Postgres::Functions

Fetches defined functions from the postgres connection. @api private

Constants

FUNCTIONS_WITH_DEFINITIONS_QUERY

The SQL query used by F(x) to retrieve the functions considered dumpable into `db/schema.rb`.

Attributes

connection[R]

Public Class Methods

all(*args) click to toggle source

Wraps all as a static facade.

@return [Array<Fx::Function>]

# File lib/fx/adapters/postgres/functions.rb, line 30
def self.all(*args)
  new(*args).all
end
new(connection) click to toggle source
# File lib/fx/adapters/postgres/functions.rb, line 34
def initialize(connection)
  @connection = connection
end

Public Instance Methods

all() click to toggle source

All of the functions that this connection has defined.

@return [Array<Fx::Function>]

# File lib/fx/adapters/postgres/functions.rb, line 41
def all
  functions_from_postgres.map { |function| to_fx_function(function) }
end

Private Instance Methods

functions_from_postgres() click to toggle source
# File lib/fx/adapters/postgres/functions.rb, line 49
def functions_from_postgres
  connection.execute(FUNCTIONS_WITH_DEFINITIONS_QUERY)
end
to_fx_function(result) click to toggle source
# File lib/fx/adapters/postgres/functions.rb, line 53
def to_fx_function(result)
  Fx::Function.new(result)
end