pg_graph 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa1692b7ab3d63c38fdbf070900b2230b94bbe1b449125c0a3317bedb3067a9d
4
- data.tar.gz: bf2923bee9600e977612d28dbf1878506d451f72a2221cb53ccbb34e5f8c76a1
3
+ metadata.gz: 205f624795509b7cb4a51ac77a111693c7c0d72f58e559523e6d76619eaa2031
4
+ data.tar.gz: 36d4c72d4a18048763884a10cd3e5c0be7be6be3b8ffa8ee728575806bcd534f
5
5
  SHA512:
6
- metadata.gz: 816e4a03f7982f3a9c941dad362c47e4deca97eae20fa6d1eca5f780d1cd3a6e2890ed3fabdfe6fa676a46ba96b4922c02efef3578fdf36807cafb20367da572
7
- data.tar.gz: f23c6fb8769ba2caee7a72a36397e60f3eb81d7c28beb5064cca9342ae968e1a06a005d2fff6ee3de36638209b98a24a5556f94a1f756eae626da25aee768d73
6
+ metadata.gz: bbd311752c8c9a4b72b3e9f8d2e702bb67640e59f7fe359beafb77a6e8286c4b0eb44396eed494945f421a87053e0c712c527b3148fa2d08b5cd5c15a2f7b433
7
+ data.tar.gz: 2fd98a73d2ddfe8fff7323cb3f74c3034bdba3d314cad29f5241a985ed28ef6685f6e8fe0239212da0c13d7aa9cc1c962bfddf06fec462423bd839b0457173fb
@@ -43,7 +43,7 @@ module PgGraph
43
43
  def table_type2table(name)
44
44
  record_type2table(table_type2record_type(name))
45
45
  end
46
-
46
+
47
47
  def table_type2record_type(name)
48
48
  name[1..-2]
49
49
  end
@@ -82,19 +82,74 @@ module PgGraph
82
82
  end
83
83
 
84
84
  # Types are both native postgres type and types from the information_schema
85
+ #
86
+ # Unsupported types: box, circle, interval, line, lseg, money, path, pg_lsn, pg_snapshot, point, polygon
87
+ #
85
88
  def postgres_type2ruby_class(name)
86
89
  case name
87
- when "character varying", "varchar", "text", "uuid", "xml"; String
88
- when "smallint", "integer", "int8", "int4", "int2"; Integer
89
- when "double precision", "real", "float8"; Float
90
- when "numeric", "decimal"; BigDecimal
90
+ # Boolean
91
91
  when "bool", "boolean"; Boolean
92
- when "json jsonb"; Hash
93
- when "bytea"; String
94
- when "timestamp", "timestamp without time zone"; Time
92
+
93
+ # Character types
94
+ when
95
+ "character", "char",
96
+ "character varying", "varchar",
97
+ "text"; String
98
+
99
+ # Binary data
100
+ when
101
+ "bit", "bit varying", "varbit",
102
+ "bytea"; String
103
+
104
+ # Integer types
105
+ when
106
+ "bigint", "int8",
107
+ "integer", "int", "int4",
108
+ "smallint", "int2"; Integer
109
+
110
+ # Float types
111
+ when
112
+ "double precision", "float8",
113
+ "real", "float4",
114
+ "float" ; Float
115
+
116
+ # Decimal types
117
+ when "numeric", "decimal"; BigDecimal
118
+
119
+ # Temporal
120
+ when
121
+ "time", "time with time zone", "timetz", "time without time zone",
122
+ "timestamp", "timestamp with time zone", "timestamptz", "timestamp without time zone"; Time
123
+
124
+ when
125
+ "date"; Date
126
+
127
+ # Array
95
128
  when /^_/; Array
129
+
130
+ # Serials
131
+ when
132
+ "bigserial", "serial8",
133
+ "serial", "serial4",
134
+ "smallserial", "serial2"; Integer
135
+
136
+ # UUIDS
137
+ when "uuid"; String
138
+
139
+ # JSON
140
+ when "json", "jsonb"; Hash
141
+
142
+ # XML
143
+ when "xml"; String
144
+
145
+ # Special types
146
+ when "cidr"; String
147
+ when "inet"; String
148
+ when "macaddr", "macaddr8"; String
149
+ when "tsquery", "tsvector"; String
150
+
96
151
  else
97
- raise "Unsupported postgres type: #{name.inspect} (FIXIT!)"
152
+ raise "PgGraph doesn't support the '#{name.inspect}' postgres type"
98
153
  end
99
154
  end
100
155
 
@@ -1,3 +1,3 @@
1
1
  module PgGraph
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen