Module: PgKingdom
- Defined in:
- lib/pgkingdom.rb,
lib/pgkingdom/table.rb,
lib/pgkingdom/version.rb,
lib/pgkingdom/columns_helper.rb,
lib/pgkingdom/options_helper.rb
Overview
Provides global namespace and methods.
Defined Under Namespace
Modules: ColumnsHelper, OptionsHelper Classes: Table
Constant Summary collapse
- VERSION =
Watch this, to have every story update in our SQL Kingdom.
"0.1.1"
Class Method Summary collapse
-
.available_data_types ⇒ Array<Symbol>
Filters :todo, :unsupported, etc from PgKingdom.data_types and returns flattened.
-
.data_types ⇒ Hash{String=>(Symbol|Array<Symbol>|Array<Array<Symbol>>)}
Returns a Hash of PostgreSQL data types.
Class Method Details
.available_data_types ⇒ Array<Symbol>
Filters :todo, :unsupported, etc from data_types and returns flattened.
9 10 11 12 13 |
# File 'lib/pgkingdom.rb', line 9 def available_data_types @_available_data_types ||= data_types.select do |key, val| ![:TODO, :DONT_USE_ARRAYS_EXPLICITLY, :NOT_SUPPORTED, []].include? val end.map { |key, val| val }.flatten end |
.data_types ⇒ Hash{String=>(Symbol|Array<Symbol>|Array<Array<Symbol>>)}
Returns a Hash of PostgreSQL data types.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/pgkingdom.rb', line 18 def data_types @_data_types ||= { arrays: [ :DONT_USE_ARRAYS_EXPLICITLY ], # Included as option :array => true into primitive types uuid: [ :uuid ], # REQUIRES: CREATE EXTENSION "uuid-ossp"; binary: [ :bytea ], boolean: [ :boolean ], monetary: [ :money ], bit_string: [ :bit_verying, :bit ], network_address: [ :cidr, :inet, :macaddr ], numeric: [ [:smallint, :integer, :bigint], #integer [:decimal, :numeric, :real, :double_precision], # floating point [:smallserial, :serial, :bigserial] # serials ], character: [ [:varchar, :character_varying], [:char, :character], [:text] ], datetime: [ [:timestamp, :timestamp_without_tz, :timestamp_with_tz], [:date], [:time, :time_without_tz, :time_with_tz], [:interval] ], range: [ [:int4range, :int8range, :numrange], [:tsrange, :tstzrange, :daterange] ], enumerated: [ :TODO ], text_search: [ :TODO ], json: [ :TODO ], oid: [ :NOT_SUPPORTED ], xml: [ :NOT_SUPPORTED ], pg_lsn: [ :NOT_SUPPORTED ], pseudo: [ :NOT_SUPPORTED ], geometric: [ :NOT_SUPPORTED ], composite: [ :NOT_SUPPORTED ], } end |