Module: Neighbor::PostgreSQL::RegisterTypes

Defined in:
lib/neighbor/postgresql.rb

Instance Method Summary collapse

Instance Method Details

#initialize_type_map(m = type_map) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/neighbor/postgresql.rb', line 25

def initialize_type_map(m = type_map)
  super
  m.register_type "cube", Type::Cube.new
  m.register_type "halfvec" do |_, _, sql_type|
    limit = extract_limit(sql_type)
    Type::Halfvec.new(limit: limit)
  end
  m.register_type "sparsevec" do |_, _, sql_type|
    limit = extract_limit(sql_type)
    Type::Sparsevec.new(limit: limit)
  end
  m.register_type "vector" do |_, _, sql_type|
    limit = extract_limit(sql_type)
    Type::Vector.new(limit: limit)
  end
end