Class: Couchbase::RangeScan

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

Overview

A range scan performs a scan on a range of keys

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from: nil, to: nil) ⇒ RangeScan

Creates an instance of a RangeScan scan type

Parameters:

  • from (ScanTerm, String, nil) (defaults to: nil)

    the lower bound of the range, if set

  • to (ScanTerm, String, nil) (defaults to: nil)

    the upper bound of the range, if set



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/couchbase/key_value_scan.rb', line 48

def initialize(from: nil, to: nil)
  @from =
    if from.nil? || from.instance_of?(ScanTerm)
      from
    else
      ScanTerm(from)
    end
  @to =
    if to.nil? || to.instance_of?(ScanTerm)
      to
    else
      ScanTerm(to)
    end
end

Instance Attribute Details

#fromScanTerm?

Returns:



41
42
43
# File 'lib/couchbase/key_value_scan.rb', line 41

def from
  @from
end

#toScanTerm?

Returns:



42
43
44
# File 'lib/couchbase/key_value_scan.rb', line 42

def to
  @to
end

Instance Method Details

#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.



64
65
66
67
68
69
70
# File 'lib/couchbase/key_value_scan.rb', line 64

def to_backend
  {
    scan_type: :range,
    from: @from&.to_backend,
    to: @to&.to_backend,
  }
end