Class: Dart::Reflection::SequelTable::Reflector

Inherits:
Object
  • Object
show all
Defined in:
lib/dart/reflection/sequel_table/reflector.rb

Instance Method Summary collapse

Constructor Details

#initialize(database_url) ⇒ Reflector

Returns a new instance of Reflector.

Parameters:

  • database_url (String)

    specifies database to reflect on



11
12
13
# File 'lib/dart/reflection/sequel_table/reflector.rb', line 11

def initialize(database_url)
  @db = ::Sequel.connect(database_url)
end

Instance Method Details

#get_relations_for_code_gen(options = {}) ⇒ Array<Relation>

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • exclude_tables (Object)

    an Array or Regexp defining tables to exclude from the reflection

  • naming_conventions (Object)

    identify direct associations by column naming conventions (e.g. users.group_id => Group one_to_many users)

Returns:



20
21
22
23
24
25
# File 'lib/dart/reflection/sequel_table/reflector.rb', line 20

def get_relations_for_code_gen(options={})
  schema = get_schema(options)
  create_join_associations_for_codegen!(schema, options)

  schema.relations
end

#get_schema_for_resolver(options = {}) ⇒ Array<Relation>

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • exclude_tables (Object)

    an Array or Regexp defining tables to exclude from the reflection

  • naming_conventions (Object)

    identify direct associations by column naming conventions (e.g. users.group_id => Group one_to_many users)

Returns:



32
33
34
35
36
# File 'lib/dart/reflection/sequel_table/reflector.rb', line 32

def get_schema_for_resolver(options={})
  schema = get_schema(options)
  create_join_associations_for_resolver!(schema, options)
  schema
end