class
CryBase::CouchBase::Services::Query::Cluster
- CryBase::CouchBase::Services::Query::Cluster
- Reference
- Object
Defined in:
crybase/couchbase/services/query/cluster.crConstructors
- .from_string(uri : String, username : String | Nil = nil, password : String | Nil = nil, connect_timeout : Time::Span = Client::DEFAULT_CONNECT_TIMEOUT, read_timeout : Time::Span = Client::DEFAULT_READ_TIMEOUT, write_timeout : Time::Span = Client::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, discover_topology : Bool = true, management_port : Int32 | Nil = nil, network : String | Nil = nil) : Cluster
- .new(seeds : Array(Endpoint), username : String, password : String, connect_timeout : Time::Span = Client::DEFAULT_CONNECT_TIMEOUT, read_timeout : Time::Span = Client::DEFAULT_READ_TIMEOUT, write_timeout : Time::Span = Client::DEFAULT_WRITE_TIMEOUT, *, tls_verify : Bool = true, tls_hostname : String | Nil = nil, tls_context : OpenSSL::SSL::Context::Client | Nil = nil, management_seeds : Array(Endpoint) | Nil = nil, discover_topology : Bool = false, network : String | Nil = nil)
Class Method Summary
- .management_endpoints(connection_string : ConnectionString, port_override : Int32 | Nil = nil) : Array(Endpoint)
- .management_endpoints(seed_endpoints : Array(Endpoint)) : Array(Endpoint)
- .seed_endpoints(connection_string : ConnectionString) : Array(Endpoint)
Instance Method Summary
- #active_endpoint : Endpoint | Nil
- #bucket(name : String, *, namespace : String = QueryContext::DEFAULT_NAMESPACE) : BucketContext(Cluster)
- #bucket=(name : String) : String
- #clear_prepared_cache : Nil
- #close : Nil
- #closed? : Bool
- #default_bucket : String | Nil
- #default_scope : String | Nil
- #endpoints : Array(Endpoint)
- #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
- #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
- #management_seeds : Array(Endpoint)
- #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
-
#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 through the active Query endpoint.
- #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
- #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
- #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
- #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
- #refresh_topology : Array(Endpoint)
- #scope(name : String = QueryContext::DEFAULT_SCOPE) : Cluster
- #scope=(name : String) : String
- #seeds : Array(Endpoint)
Constructor Detail
def self.from_string(uri : String, username : String | Nil = nil, password : String | Nil = nil, connect_timeout : Time::Span = Client::DEFAULT_CONNECT_TIMEOUT, read_timeout : Time::Span = Client::DEFAULT_READ_TIMEOUT, write_timeout : Time::Span = Client::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, discover_topology : Bool = true, management_port : Int32 | Nil = nil, network : String | Nil = nil) : Cluster
#
def self.new(seeds : Array(Endpoint), username : String, password : String, connect_timeout : Time::Span = Client::DEFAULT_CONNECT_TIMEOUT, read_timeout : Time::Span = Client::DEFAULT_READ_TIMEOUT, write_timeout : Time::Span = Client::DEFAULT_WRITE_TIMEOUT, *, tls_verify : Bool = true, tls_hostname : String | Nil = nil, tls_context : OpenSSL::SSL::Context::Client | Nil = nil, management_seeds : Array(Endpoint) | Nil = nil, discover_topology : Bool = false, network : String | Nil = nil)
#
Class Method Detail
def self.management_endpoints(connection_string : ConnectionString, port_override : Int32 | Nil = nil) : Array(Endpoint)
#
Instance Method Detail
def bucket(name : String, *, namespace : String = QueryContext::DEFAULT_NAMESPACE) : BucketContext(Cluster)
#
def 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
#
def 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
#
def 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
#
def 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 through the active 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.
def 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
#
def 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
#
def 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
#
def 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
#