pg_graph 0.1.6 → 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: b24d838b20ef999a63391e330fa9a35b8888a46a20128ea8f41ffaf5c64e4c2f
4
- data.tar.gz: ee8a549def41b47989472d7cdb757ceef10a98b758d7e2f89aa65b603ae6baea
3
+ metadata.gz: 205f624795509b7cb4a51ac77a111693c7c0d72f58e559523e6d76619eaa2031
4
+ data.tar.gz: 36d4c72d4a18048763884a10cd3e5c0be7be6be3b8ffa8ee728575806bcd534f
5
5
  SHA512:
6
- metadata.gz: 457085837cc06237a3eeabca20e568ebc239e05c4a20467cb1ed08288c6df889fce9cb55c4d27a4c5ad0bc5947cf8a74e869c892b7ff6d43def318e3da92d406
7
- data.tar.gz: 9c4ee15fb96f547ac544d2f7608eca0af7eb05a82743440d6c9bb3b335ef362485cbe80716427774a00db8ce9354457b35705278dc8b157b15ba866785e591bf
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", "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"; 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.6"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-14 00:00:00.000000000 Z
11
+ date: 2022-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: boolean