module Views

Public Class Methods

filter_contact() click to toggle source
# File lib/jungle_path/app/schemas/views.rb, line 5
def self.filter_contact
        @filter_contact = JunglePath::DBModel::View.new(
                JunglePath::SQL::Helpers.sql("
                        create or replace function filter_contact(p_contact_id int)
                        returns table (
                          id int,
                          name text,
                          email text,
                                user_id int,
                          created_at timestamp,
                          created_by_user_id int,
                          updated_at timestamp,
                          updated_by_user_id int
                        )
                        as
                        $body$
                                select
                                        a.*
                                from contact a
                                where a.id = p_contact_id
                        $body$
                        language sql;
                "),
                "drop function filter_contact(int)",
                [:contact],
                [:contact_id]
        ) unless @filter_contact
        @filter_contact
end
filter_test() click to toggle source
# File lib/jungle_path/app/schemas/views.rb, line 35
def self.filter_test
        @filter_test = JunglePath::DBModel::View.new(
                JunglePath::SQL::Helpers.sql("
                        create or replace function filter_test(p_contact_id int)
                        returns table (
                          id int,
                          name text,
                          email text,
                                user_id int,
                          created_at timestamp,
                          created_by_user_id int,
                          updated_at timestamp,
                          updated_by_user_id int
                        )
                        as
                        $body$
                                select
                                        a.*
                                from contact a
                                where a.id = p_contact_id
                        $body$
                        language sql;
                "),
                "drop function filter_test(int)",
                [:contact, :test],
                [:contact_id]
        ) unless @filter_test
        @filter_test
end