Module: ActiveRecord::ConnectionAdapters::CockroachDB::ColumnDefinitionUtils
- Defined in:
- lib/active_record/connection_adapters/cockroachdb/table_definition.rb
Class Method Summary collapse
- .default_srid(options) ⇒ Object
- .geo_type(type = 'GEOMETRY') ⇒ Object
- .limit_from_options(type, options = {}) ⇒ Object
Class Method Details
.default_srid(options) ⇒ Object
63 64 65 |
# File 'lib/active_record/connection_adapters/cockroachdb/table_definition.rb', line 63 def default_srid() [:geographic] ? 4326 : CockroachDBAdapter::DEFAULT_SRID end |
.geo_type(type = 'GEOMETRY') ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/active_record/connection_adapters/cockroachdb/table_definition.rb', line 47 def geo_type(type = 'GEOMETRY') g_type = type.to_s.delete('_').upcase return 'POINT' if g_type == 'STPOINT' return 'POLYGON' if g_type == 'STPOLYGON' g_type end |
.limit_from_options(type, options = {}) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/active_record/connection_adapters/cockroachdb/table_definition.rb', line 55 def (type, = {}) spatial_type = geo_type(type) spatial_type << 'Z' if [:has_z] spatial_type << 'M' if [:has_m] spatial_type << ",#{[:srid] || default_srid()}" spatial_type end |