Class: Droonga::Catalog::Schema::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/droonga/catalog/schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, name, raw) ⇒ Column

Returns a new instance of Column.



55
56
57
58
59
60
61
# File 'lib/droonga/catalog/schema.rb', line 55

def initialize(table, name, raw)
  @table = table
  @name = name
  @raw = raw
  @vector_options = ColumnVectorOptions.new(raw_vector_options)
  @index_options = ColumnIndexOptions.new(raw_index_options)
end

Instance Attribute Details

#index_optionsObject (readonly)

Returns the value of attribute index_options.



54
55
56
# File 'lib/droonga/catalog/schema.rb', line 54

def index_options
  @index_options
end

#nameObject (readonly)

Returns the value of attribute name.



54
55
56
# File 'lib/droonga/catalog/schema.rb', line 54

def name
  @name
end

#rawObject (readonly)

Returns the value of attribute raw.



54
55
56
# File 'lib/droonga/catalog/schema.rb', line 54

def raw
  @raw
end

#tableObject (readonly)

Returns the value of attribute table.



54
55
56
# File 'lib/droonga/catalog/schema.rb', line 54

def table
  @table
end

#vector_optionsObject (readonly)

Returns the value of attribute vector_options.



54
55
56
# File 'lib/droonga/catalog/schema.rb', line 54

def vector_options
  @vector_options
end

Instance Method Details

#==(other) ⇒ Object



63
64
65
66
67
# File 'lib/droonga/catalog/schema.rb', line 63

def ==(other)
  self.class == other.class and
    name == other.name and
    raw == other.raw
end

#typeObject



69
70
71
# File 'lib/droonga/catalog/schema.rb', line 69

def type
  @raw["type"] || "Scalar"
end

#type_symbolObject



73
74
75
76
77
78
79
80
81
82
# File 'lib/droonga/catalog/schema.rb', line 73

def type_symbol
  case type
  when "Scalar"
    :scalar
  when "Vector"
    :vector
  when "Index"
    :index
  end
end

#value_typeObject



84
85
86
# File 'lib/droonga/catalog/schema.rb', line 84

def value_type
  @raw["valueType"]
end

#value_type_groongaObject



88
89
90
91
92
93
94
# File 'lib/droonga/catalog/schema.rb', line 88

def value_type_groonga
  if value_type == "Integer"
    "Int64"
  else
    value_type
  end
end