Class: Couchbase::Bucket::ViewOptions

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|self| ... } ⇒ ViewOptions

Returns a new instance of ViewOptions.

Yield Parameters:

[View source]

96
97
98
99
# File 'lib/couchbase/view_options.rb', line 96

def initialize
  @namespace = :production
  yield self if block_given?
end

Instance Attribute Details

#debugBoolean

Returns allows to return debug information as part of the view response.

Returns:

  • (Boolean)

    allows to return debug information as part of the view response


90
91
92
# File 'lib/couchbase/view_options.rb', line 90

def debug
  @debug
end

#end_key#to_json

Specifies the key, at which the result generation has to be stopped

Returns:

  • (#to_json)

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

def end_key
  @end_key
end

#end_key_doc_idString

Specifies the document id in case #end_key gives multiple results within the index

Returns:

  • (String)

49
50
51
# File 'lib/couchbase/view_options.rb', line 49

def end_key_doc_id
  @end_key_doc_id
end

#groupBoolean

Specifies whether to enable grouping of the results

Returns:

  • (Boolean)

58
59
60
# File 'lib/couchbase/view_options.rb', line 58

def group
  @group
end

#group_levelInteger

Specifies the depth within the key to group the results

Returns:

  • (Integer)

63
64
65
# File 'lib/couchbase/view_options.rb', line 63

def group_level
  @group_level
end

#inclusive_endBoolean

Specifies whether the #end_key/##end_key_doc_id values should be inclusive

Returns:

  • (Boolean)

53
54
55
# File 'lib/couchbase/view_options.rb', line 53

def inclusive_end
  @inclusive_end
end

#key#to_json

Specifies the set of the keys to fetch from the index

Returns:

  • (#to_json)

67
68
69
# File 'lib/couchbase/view_options.rb', line 67

def key
  @key
end

#keysArray<#to_json>

Specifies set of the keys to fetch from the index

Returns:

  • (Array<#to_json>)

72
73
74
# File 'lib/couchbase/view_options.rb', line 72

def keys
  @keys
end

#limitInteger

Specifies the maximum number of results to return

Returns:

  • (Integer)

34
35
36
# File 'lib/couchbase/view_options.rb', line 34

def limit
  @limit
end

#namespace:production, :development

Returns:

  • (:production, :development)

93
94
95
# File 'lib/couchbase/view_options.rb', line 93

def namespace
  @namespace
end

#on_error:stop, :continue

Specifies the behaviour of the view engine should an error occur during the gathering of view index results which would result in only partial results being available

Returns:

  • (:stop, :continue)

87
88
89
# File 'lib/couchbase/view_options.rb', line 87

def on_error
  @on_error
end

#order:ascending, :descending

Specifies the order of the results that should be returned

Returns:

  • (:ascending, :descending)

77
78
79
# File 'lib/couchbase/view_options.rb', line 77

def order
  @order
end

#reduceBoolean

Specifies whether to enable the reduction function associated with this particular view index

Returns:

  • (Boolean)

81
82
83
# File 'lib/couchbase/view_options.rb', line 81

def reduce
  @reduce
end

#scan_consistency:not_bounded, ...

Specifies the level of consistency for the query

Returns:

  • (:not_bounded, :request_plus, :update_after)

26
27
28
# File 'lib/couchbase/view_options.rb', line 26

def scan_consistency
  @scan_consistency
end

#skipInteger

Specifies the number of results to skip from the start of the result set

Returns:

  • (Integer)

30
31
32
# File 'lib/couchbase/view_options.rb', line 30

def skip
  @skip
end

#start_keyObject

Specifies the key, to which the engine has to skip before result generation


37
38
39
# File 'lib/couchbase/view_options.rb', line 37

def start_key
  @start_key
end

#start_key_doc_idString

Specifies the document id in case #start_key gives multiple results within the index

Returns:

  • (String)

45
46
47
# File 'lib/couchbase/view_options.rb', line 45

def start_key_doc_id
  @start_key_doc_id
end

#timeoutInteger

Returns Timeout in milliseconds.

Returns:

  • (Integer)

    Timeout in milliseconds


22
23
24
# File 'lib/couchbase/view_options.rb', line 22

def timeout
  @timeout
end

Instance Method Details

#raw(key, value) ⇒ Object

Allows providing custom JSON key/value pairs for advanced usage

Parameters:

  • key (String)

    the parameter name (key of the JSON property)

  • value (Object)

    the parameter value (value of the JSON property)

[View source]

105
106
107
# File 'lib/couchbase/view_options.rb', line 105

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