class

CryBase::CouchBase::Services::Query::Client

Inherits Reference < Object

Constants

DEFAULT_CONNECT_TIMEOUT = 5.seconds
DEFAULT_READ_TIMEOUT = 30.seconds
DEFAULT_WRITE_TIMEOUT = 5.seconds
PATH = "/query/service"

Constructors

from_string(uri : String, username : String | Nil = nil, password : String | Nil = nil, connect_timeout : Time::Span = DEFAULT_CONNECT_TIMEOUT, read_timeout : Time::Span = DEFAULT_READ_TIMEOUT, write_timeout : Time::Span = DEFAULT_WRITE_TIMEOUT, *, bucket : String | Nil = nil, tls_verify : Bool | Nil = nil, tls_hostname : String | Nil = nil, tls_context : OpenSSL::SSL::Context::Client | Nil = nil) : Client
Source
new(endpoint : Endpoint, username : String, password : String, connect_timeout : Time::Span = DEFAULT_CONNECT_TIMEOUT, read_timeout : Time::Span = DEFAULT_READ_TIMEOUT, write_timeout : Time::Span = DEFAULT_WRITE_TIMEOUT, *, tls_verify : Bool = true, tls_hostname : String | Nil = nil, tls_context : OpenSSL::SSL::Context::Client | Nil = nil)
Source

Class methods

form(statement : String, positional_args, named_args, readonly : Bool | Nil, scan_consistency : ScanConsistency | String | Nil, client_context_id : String | Nil, timeout : Time::Span | Nil, query_context : QueryContext | String | Nil, bucket : String | Nil, scope : String | Nil, namespace : String | Nil, options) : String
Source
prepare_statement(statement : String, name : String | Nil = nil, force : Bool = false) : String
Source
prepared_cache_key(statement : String, query_context : QueryContext | String | Nil, bucket : String | Nil, scope : String | Nil, namespace : String | Nil, options) : String
Source
prepared_form(prepared : String, positional_args, named_args, readonly : Bool | Nil, scan_consistency : ScanConsistency | String | Nil, client_context_id : String | Nil, timeout : Time::Span | Nil, query_context : QueryContext | String | Nil, bucket : String | Nil, scope : String | Nil, namespace : String | Nil, options) : String
Source

Instance methods

bucket(name : String, *, namespace : String = QueryContext::DEFAULT_NAMESPACE) : BucketContext(Client)
Source
bucket=(name : String) : String
Source
clear_prepared_cache
Source
close
Source
closed?
Source
default_bucket
Source
default_scope
Source
endpoint
Source
execute_prepared(prepared : PreparedStatement, *positional_args, named_args = NamedTuple.new, readonly : Bool | Nil = nil, scan_consistency : ScanConsistency | String | Nil = nil, client_context_id : String | Nil = nil, timeout : Time::Span | Nil = nil, query_context : QueryContext | String | Nil = nil, bucket : String | Nil = nil, scope : String | Nil = nil, namespace : String | Nil = nil, options = NamedTuple.new, raise_on_error : Bool = true) : Result
Source
execute_prepared(prepared : String, *positional_args, named_args = NamedTuple.new, readonly : Bool | Nil = nil, scan_consistency : ScanConsistency | String | Nil = nil, client_context_id : String | Nil = nil, timeout : Time::Span | Nil = nil, query_context : QueryContext | String | Nil = nil, bucket : String | Nil = nil, scope : String | Nil = nil, namespace : String | Nil = nil, options = NamedTuple.new, raise_on_error : Bool = true) : Result
Source
prepare(statement : String, name : String | Nil = nil, *, force : Bool = false, readonly : Bool | Nil = nil, scan_consistency : ScanConsistency | String | Nil = nil, client_context_id : String | Nil = nil, timeout : Time::Span | Nil = nil, query_context : QueryContext | String | Nil = nil, bucket : String | Nil = nil, scope : String | Nil = nil, namespace : String | Nil = nil, options = NamedTuple.new) : PreparedStatement
Source
query(statement : String, *positional_args, named_args = NamedTuple.new, readonly : Bool | Nil = nil, scan_consistency : ScanConsistency | String | Nil = nil, client_context_id : String | Nil = nil, timeout : Time::Span | Nil = nil, query_context : QueryContext | String | Nil = nil, bucket : String | Nil = nil, scope : String | Nil = nil, namespace : String | Nil = nil, options = NamedTuple.new, retry_policy : CryBase::CouchBase::RetryPolicy = CryBase::CouchBase::RetryPolicy.no_retry, adhoc : Bool = true, raise_on_error : Bool = true) : Result

Executes a N1QL/SQL++ statement against this Query endpoint.

readonly: true sends the Couchbase Query readonly=true request option. Use it for SELECT and other non-mutating statements; leave it unset for INSERT, UPDATE, UPSERT, DELETE, and other mutations.

adhoc: true is the default and sends the statement directly. adhoc: false prepares the statement, caches the prepared plan for the same statement/options, and executes by prepared name. Missing prepared plans are cleared and prepared once again.

retry_policy: is a per-query policy value. It defaults to CryBase::CouchBase::RetryPolicy.no_retry; retry execution is not implemented yet.

Source
query_as(type : T.class, statement : String, *positional_args, named_args = NamedTuple.new, readonly : Bool | Nil = nil, scan_consistency : ScanConsistency | String | Nil = nil, client_context_id : String | Nil = nil, timeout : Time::Span | Nil = nil, query_context : QueryContext | String | Nil = nil, bucket : String | Nil = nil, scope : String | Nil = nil, namespace : String | Nil = nil, options = NamedTuple.new, adhoc : Bool = true, raise_on_error : Bool = true) : Array(T) forall T
Source
query_cursor(statement : String, *positional_args, named_args = NamedTuple.new, readonly : Bool | Nil = nil, scan_consistency : ScanConsistency | String | Nil = nil, client_context_id : String | Nil = nil, timeout : Time::Span | Nil = nil, query_context : QueryContext | String | Nil = nil, bucket : String | Nil = nil, scope : String | Nil = nil, namespace : String | Nil = nil, options = NamedTuple.new, raise_on_error : Bool = true) : Cursor
Source
query_each(statement : String, *positional_args, named_args = NamedTuple.new, readonly : Bool | Nil = nil, scan_consistency : ScanConsistency | String | Nil = nil, client_context_id : String | Nil = nil, timeout : Time::Span | Nil = nil, query_context : QueryContext | String | Nil = nil, bucket : String | Nil = nil, scope : String | Nil = nil, namespace : String | Nil = nil, options = NamedTuple.new, raise_on_error : Bool = true, & : JSON::Any -> ) : Result
Source
query_each_as(type : T.class, statement : String, *positional_args, named_args = NamedTuple.new, readonly : Bool | Nil = nil, scan_consistency : ScanConsistency | String | Nil = nil, client_context_id : String | Nil = nil, timeout : Time::Span | Nil = nil, query_context : QueryContext | String | Nil = nil, bucket : String | Nil = nil, scope : String | Nil = nil, namespace : String | Nil = nil, options = NamedTuple.new, raise_on_error : Bool = true, & : T -> ) : Result forall T
Source
scope(name : String = QueryContext::DEFAULT_SCOPE) : Client
Source
scope=(name : String) : String
Source