Class: Droonga::Catalog::Schema::Column
- Inherits:
-
Object
- Object
- Droonga::Catalog::Schema::Column
- Defined in:
- lib/droonga/catalog/schema.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#index_options ⇒ Object
readonly
Returns the value of attribute index_options.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
-
#vector_options ⇒ Object
readonly
Returns the value of attribute vector_options.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #flags ⇒ Object
-
#initialize(table, name, data) ⇒ Column
constructor
A new instance of Column.
- #to_column_create_body ⇒ Object
- #type ⇒ Object
- #type_flag ⇒ Object
- #value_type ⇒ Object
- #value_type_groonga ⇒ Object
Constructor Details
#initialize(table, name, data) ⇒ Column
Returns a new instance of Column.
69 70 71 72 73 74 75 |
# File 'lib/droonga/catalog/schema.rb', line 69 def initialize(table, name, data) @table = table @name = name @data = data = ColumnVectorOptions.new() = ColumnIndexOptions.new() end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
68 69 70 |
# File 'lib/droonga/catalog/schema.rb', line 68 def data @data end |
#index_options ⇒ Object (readonly)
Returns the value of attribute index_options.
68 69 70 |
# File 'lib/droonga/catalog/schema.rb', line 68 def end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
68 69 70 |
# File 'lib/droonga/catalog/schema.rb', line 68 def name @name end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
68 69 70 |
# File 'lib/droonga/catalog/schema.rb', line 68 def table @table end |
#vector_options ⇒ Object (readonly)
Returns the value of attribute vector_options.
68 69 70 |
# File 'lib/droonga/catalog/schema.rb', line 68 def end |
Instance Method Details
#==(other) ⇒ Object
77 78 79 80 81 |
# File 'lib/droonga/catalog/schema.rb', line 77 def ==(other) self.class == other.class and name == other.name and data == other.data end |
#flags ⇒ Object
100 101 102 |
# File 'lib/droonga/catalog/schema.rb', line 100 def flags [type_flag] + .flags + .flags end |
#to_column_create_body ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/droonga/catalog/schema.rb', line 116 def to_column_create_body body = { "name" => name, "table" => table, "flags" => flags.join("|"), "type" => value_type_groonga } sources = .sources if sources body["source"] = sources.join(",") end body end |
#type ⇒ Object
83 84 85 |
# File 'lib/droonga/catalog/schema.rb', line 83 def type @data["type"] || "Scalar" end |
#type_flag ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/droonga/catalog/schema.rb', line 87 def type_flag case type when "Scalar" "COLUMN_SCALAR" when "Vector" "COLUMN_VECTOR" when "Index" "COLUMN_INDEX" else # TODO raise appropriate error end end |
#value_type ⇒ Object
104 105 106 |
# File 'lib/droonga/catalog/schema.rb', line 104 def value_type @data["valueType"] end |
#value_type_groonga ⇒ Object
108 109 110 111 112 113 114 |
# File 'lib/droonga/catalog/schema.rb', line 108 def value_type_groonga if value_type == "Integer" "Int64" else value_type end end |