Class: Couchbase::Protostellar::ResponseConverter::Admin::Query Private

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/protostellar/response_converter/admin/query.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Constant Summary collapse

INDEX_TYPE_MAP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

{
  :INDEX_TYPE_VIEW => :view,
  :INDEX_TYPE_GSI => :gsi,
}.freeze
INDEX_STATE_MAP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

{
  :INDEX_STATE_DEFERRED => :deferred,
  :INDEX_STATE_BUILDING => :building,
  :INDEX_STATE_PENDING => :pending,
  :INDEX_STATE_ONLINE => :online,
  :INDEX_STATE_OFFLINE => :offline,
  :INDEX_STATE_ABRIDGED => :abridged,
  :INDEX_STATE_SCHEDULED => :scheduled,
}.freeze

Class Method Summary collapse

Class Method Details

.to_query_index_array(resp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/couchbase/protostellar/response_converter/admin/query.rb', line 39

def self.to_query_index_array(resp)
  resp.indexes.map do |proto_idx|
    Couchbase::Management::QueryIndex.new do |idx|
      idx.bucket = proto_idx.bucket_name
      idx.scope = proto_idx.scope_name
      idx.collection = proto_idx.collection_name
      idx.name = proto_idx.name
      idx.is_primary = proto_idx.is_primary
      idx.type = INDEX_TYPE_MAP[proto_idx.type]
      idx.state = INDEX_STATE_MAP[proto_idx.state]
      idx.index_key = proto_idx.fields.to_a
      idx.condition = proto_idx.condition if proto_idx.has_condition?
      idx.partition = proto_idx.partition if proto_idx.has_partition?
    end
  end
end