Class: Couchbase::Options::View

Inherits:
Base
  • Object
show all
Defined in:
lib/couchbase/options.rb

Overview

Options for Cluster#view_query

Constant Summary collapse

DEFAULT =

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.

View.new.freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#client_context, #parent_span, #retry_strategy, #timeout

Instance Method Summary collapse

Constructor Details

#initialize(scan_consistency: :not_bounded, namespace: :production, skip: nil, limit: nil, start_key: nil, end_key: nil, start_key_doc_id: nil, end_key_doc_id: nil, inclusive_end: nil, group: nil, group_level: nil, key: nil, keys: nil, order: nil, reduce: nil, on_error: nil, debug: false, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ View

Returns a new instance of View.

Yield Parameters:



2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
# File 'lib/couchbase/options.rb', line 2457

def initialize(scan_consistency: :not_bounded,
               namespace: :production,
               skip: nil,
               limit: nil,
               start_key: nil,
               end_key: nil,
               start_key_doc_id: nil,
               end_key_doc_id: nil,
               inclusive_end: nil,
               group: nil,
               group_level: nil,
               key: nil,
               keys: nil,
               order: nil,
               reduce: nil,
               on_error: nil,
               debug: false,
               timeout: nil,
               retry_strategy: nil,
               client_context: nil,
               parent_span: nil)
  super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)

  @scan_consistency = scan_consistency
  @namespace = namespace
  @skip = skip
  @limit = limit
  @start_key = start_key
  @end_key = end_key
  @start_key_doc_id = start_key_doc_id
  @end_key_doc_id = end_key_doc_id
  @inclusive_end = inclusive_end
  @group = group
  @group_level = group_level
  @key = key
  @keys = keys
  @order = order
  @reduce = reduce
  @on_error = on_error
  @debug = debug
  yield self if block_given?
end

Instance Attribute Details

#debugBoolean?



2429
2430
2431
# File 'lib/couchbase/options.rb', line 2429

def debug
  @debug
end

#end_key#to_json?



2418
2419
2420
# File 'lib/couchbase/options.rb', line 2418

def end_key
  @end_key
end

#end_key_doc_idString?



2420
2421
2422
# File 'lib/couchbase/options.rb', line 2420

def end_key_doc_id
  @end_key_doc_id
end

#groupBoolean?



2422
2423
2424
# File 'lib/couchbase/options.rb', line 2422

def group
  @group
end

#group_levelInteger?



2423
2424
2425
# File 'lib/couchbase/options.rb', line 2423

def group_level
  @group_level
end

#inclusive_endBoolean?



2421
2422
2423
# File 'lib/couchbase/options.rb', line 2421

def inclusive_end
  @inclusive_end
end

#key#to_json?



2424
2425
2426
# File 'lib/couchbase/options.rb', line 2424

def key
  @key
end

#keysArray<#to_json>?



2425
2426
2427
# File 'lib/couchbase/options.rb', line 2425

def keys
  @keys
end

#limitInteger



2416
2417
2418
# File 'lib/couchbase/options.rb', line 2416

def limit
  @limit
end

#namespaceSymbol



2414
2415
2416
# File 'lib/couchbase/options.rb', line 2414

def namespace
  @namespace
end

#on_errorSymbol?



2428
2429
2430
# File 'lib/couchbase/options.rb', line 2428

def on_error
  @on_error
end

#orderSymbol?



2426
2427
2428
# File 'lib/couchbase/options.rb', line 2426

def order
  @order
end

#reduceBoolean?



2427
2428
2429
# File 'lib/couchbase/options.rb', line 2427

def reduce
  @reduce
end

#scan_consistencySymbol



2413
2414
2415
# File 'lib/couchbase/options.rb', line 2413

def scan_consistency
  @scan_consistency
end

#skipInteger



2415
2416
2417
# File 'lib/couchbase/options.rb', line 2415

def skip
  @skip
end

#start_key#to_json?



2417
2418
2419
# File 'lib/couchbase/options.rb', line 2417

def start_key
  @start_key
end

#start_key_doc_idString?



2419
2420
2421
# File 'lib/couchbase/options.rb', line 2419

def start_key_doc_id
  @start_key_doc_id
end

Instance Method Details

#raw(key, value) ⇒ Object

Allows providing custom JSON key/value pairs for advanced usage



2504
2505
2506
# File 'lib/couchbase/options.rb', line 2504

def raw(key, value)
  @raw_parameters[key] = JSON.generate(value)
end

#to_backendObject

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.



2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
# File 'lib/couchbase/options.rb', line 2509

def to_backend
  {
    timeout: Utils::Time.extract_duration(@timeout),
    scan_consistency: @scan_consistency,
    skip: @skip,
    limit: @limit,
    start_key: (JSON.generate(@start_key) unless @start_key.nil?),
    end_key: (JSON.generate(@end_key) unless @end_key.nil?),
    start_key_doc_id: @start_key_doc_id,
    end_key_doc_id: @end_key_doc_id,
    inclusive_end: @inclusive_end,
    group: @group,
    group_level: @group_level,
    key: (JSON.generate(@key) unless @key.nil?),
    keys: @keys&.map { |key| JSON.generate(key) },
    order: @order,
    reduce: @reduce,
    on_error: @on_error,
    debug: @debug,
  }
end