Class: Droonga::Catalog::Schema::Table

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, raw) ⇒ Table

Returns a new instance of Table.



108
109
110
111
112
113
114
115
116
# File 'lib/droonga/catalog/schema.rb', line 108

def initialize(name, raw)
  @name = name
  @raw = raw
  @columns = {}

  raw_columns.each do |column_name, raw_column|
    @columns[column_name] = Column.new(name, column_name, raw_column)
  end
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



107
108
109
# File 'lib/droonga/catalog/schema.rb', line 107

def columns
  @columns
end

#nameObject (readonly)

Returns the value of attribute name.



107
108
109
# File 'lib/droonga/catalog/schema.rb', line 107

def name
  @name
end

#rawObject (readonly)

Returns the value of attribute raw.



107
108
109
# File 'lib/droonga/catalog/schema.rb', line 107

def raw
  @raw
end

Instance Method Details

#==(other) ⇒ Object



118
119
120
121
122
# File 'lib/droonga/catalog/schema.rb', line 118

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

#key_typeObject



141
142
143
# File 'lib/droonga/catalog/schema.rb', line 141

def key_type
  @raw["keyType"]
end

#key_type_groongaObject



145
146
147
148
149
150
151
152
153
154
# File 'lib/droonga/catalog/schema.rb', line 145

def key_type_groonga
  case key_type
  when "Integer"
    "Int64"
  when "Float", "Time", "ShortText", "TokyoGeoPoint", "WGS84GeoPoint"
    key_type
  else
    key_type
  end
end

#normalizerObject



160
161
162
# File 'lib/droonga/catalog/schema.rb', line 160

def normalizer
  @raw["normalizer"]
end

#tokenizerObject



156
157
158
# File 'lib/droonga/catalog/schema.rb', line 156

def tokenizer
  @raw["tokenizer"]
end

#typeObject



124
125
126
# File 'lib/droonga/catalog/schema.rb', line 124

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

#type_symbolObject



128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/droonga/catalog/schema.rb', line 128

def type_symbol
  case type
  when "Array"
    :array
  when "Hash"
    :hash
  when "PatriciaTrie"
    :patricia_trie
  when "DoubleArrayTrie"
    :double_array_trie
  end
end