gocb

package module
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2018 License: Apache-2.0 Imports: 25 Imported by: 92

README ¶

GoDoc

Couchbase Go Client

This is the official Couchbase Go SDK. If you are looking for our previous unofficial prototype Go client library, please see: http://www.github.com/couchbase/go-couchbase.

The Go SDK library allows you to connect to a Couchbase cluster from Go. It is written in pure Go, and uses the included gocbcore library to handle communicating to the cluster over the Couchbase binary protocol.

Source

The project source is hosted at http://github.com/couchbase/gocb.

Documentation

You can explore our API reference through godoc at https://godoc.org/github.com/couchbase/gocb.

You can also find documentation for the Go SDK at the Couchbase Developer Portal.

Bug Tracker

Issues are tracked on Couchbase's public issues.couchbase.com. Contact the site admins regarding login or other problems at issues.couchbase.com (officially) or ask around in couchbase/discuss on gitter.im (unofficially).

Installing

To install the latest stable version, run:

go get gopkg.in/couchbase/gocb.v1

To install the latest developer version, run:

go get github.com/couchbase/gocb

License

Copyright 2016 Couchbase Inc.

Licensed under the Apache License, Version 2.0.

See LICENSE for further details.

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	// DiagStateOk indicates that the connection state is ok.
	DiagStateOk = DiagConnState(0)

	// DiagStateDisconnected indicates that the connection is disconnected.
	DiagStateDisconnected = DiagConnState(1)
)
View Source
const (
	// Couchbase indicates a Couchbase bucket type.
	Couchbase = BucketType(0)

	// Memcached indicates a Memcached bucket type.
	Memcached = BucketType(1)

	// Ephemeral indicates an Ephemeral bucket type.
	Ephemeral = BucketType(2)
)
View Source
const (
	// SearchIndexSourceTypeCouchbase specifies to use a couchbase FTS index sourceType
	SearchIndexSourceTypeCouchbase = "couchbase"

	// SearchIndexSourceTypeMemcached specifies to use a memcached FTS index sourceType
	SearchIndexSourceTypeMemcached = "memcached"

	// SearchIndexIngestControlOpPause specifies to use FTS ingest control op of pause
	SearchIndexIngestControlOpPause = "pause"

	// SearchIndexIngestControlOpResume specifies to use FTS ingest control op of resume
	SearchIndexIngestControlOpResume = "resume"

	// SearchIndexQueryControlOpPause specifies to use FTS query control op of allow
	SearchIndexQueryControlOpPause = "allow"

	// SearchIndexQueryControlOpResume specifies to use FTS ingest control op of disallow
	SearchIndexQueryControlOpResume = "disallow"

	// SearchIndexPlanFreezeControlOpPause specifies to use FTS plan freeze control op of freeze
	SearchIndexPlanFreezeControlOpPause = "freeze"

	// SearchIndexPlanFreezeControlOpResume specifies to use FTS plan freeze control op of unfreeze
	SearchIndexPlanFreezeControlOpResume = "unfreeze"
)
View Source
const (
	// IndexTypeN1ql indicates that GSI was used to build the index.
	IndexTypeN1ql = IndexType("gsi")

	// IndexTypeView indicates that views were used to build the index.
	IndexTypeView = IndexType("views")
)
View Source
const (
	// QueryProfileNone disables query profiling
	QueryProfileNone = QueryProfileType("off")

	// QueryProfilePhases includes phase profiling information in the query response
	QueryProfilePhases = QueryProfileType("phases")

	// QueryProfileTimings includes timing profiling information in the query response
	QueryProfileTimings = QueryProfileType("timings")
)
View Source
const (
	// SubdocFlagNone indicates no special behaviours
	SubdocFlagNone = SubdocFlag(gocbcore.SubdocFlagNone)

	// SubdocFlagCreatePath indicates you wish to recursively create the tree of paths
	// if it does not already exist within the document.
	SubdocFlagCreatePath = SubdocFlag(gocbcore.SubdocFlagMkDirP)

	// SubdocFlagXattr indicates your path refers to an extended attribute rather than the document.
	SubdocFlagXattr = SubdocFlag(gocbcore.SubdocFlagXattrPath)

	// SubdocFlagUseMacros indicates that you wish macro substitution to occur on the value
	SubdocFlagUseMacros = SubdocFlag(gocbcore.SubdocFlagExpandMacros)
)
View Source
const (
	// SubdocDocFlagNone indicates no special behaviours
	SubdocDocFlagNone = SubdocDocFlag(gocbcore.SubdocDocFlagNone)

	// SubdocDocFlagMkDoc indicates that the document should be created if it does not already exist.
	SubdocDocFlagMkDoc = SubdocDocFlag(gocbcore.SubdocDocFlagMkDoc)

	// SubdocDocFlagReplaceDoc indices that this operation should be a replace rather than upsert.
	SubdocDocFlagReplaceDoc = SubdocDocFlag(gocbcore.SubdocDocFlagReplaceDoc)

	// SubdocDocFlagAccessDeleted indicates that you wish to receive soft-deleted documents.
	SubdocDocFlagAccessDeleted = SubdocDocFlag(gocbcore.SubdocDocFlagAccessDeleted)
)
View Source
const (
	// MemdService represents a memcached service.
	MemdService = ServiceType(gocbcore.MemdService)

	// MgmtService represents a management service (typically ns_server).
	MgmtService = ServiceType(gocbcore.MgmtService)

	// CapiService represents a CouchAPI service (typically for views).
	CapiService = ServiceType(gocbcore.CapiService)

	// N1qlService represents a N1QL service (typically for query).
	N1qlService = ServiceType(gocbcore.N1qlService)

	// FtsService represents a full-text-search service.
	FtsService = ServiceType(gocbcore.FtsService)

	// CbasService represents an analytics service.
	CbasService = ServiceType(gocbcore.CbasService)
)

Various logging levels (or subsystems) which can categorize the message. Currently these are ordered in decreasing severity.

View Source
const (
	// RedactNone indicates to perform no redactions
	RedactNone = LogRedactLevel(0)

	// RedactPartial indicates to redact all possible user-identifying information from logs.
	RedactPartial = LogRedactLevel(1)

	// RedactFull indicates to fully redact all possible identifying information from logs.
	RedactFull = LogRedactLevel(2)
)
View Source
const (
	// NotBounded indicates no data consistency is required.
	NotBounded = ConsistencyMode(1)
	// RequestPlus indicates that request-level data consistency is required.
	RequestPlus = ConsistencyMode(2)
	// StatementPlus inidcates that statement-level data consistency is required.
	StatementPlus = ConsistencyMode(3)
)
View Source
const (
	// DefaultHighlightStyle specifies to use the default to highlight search result hits.
	DefaultHighlightStyle = SearchHighlightStyle("")

	// HtmlHighlightStyle specifies to use HTML tags to highlight search result hits.
	HtmlHighlightStyle = SearchHighlightStyle("html")

	// AnsiHightlightStyle specifies to use ANSI tags to highlight search result hits.
	AnsiHightlightStyle = SearchHighlightStyle("ansi")
)
View Source
const (
	// Before indicates to update the index before querying it.
	Before = StaleMode(1)
	// None indicates that no special behaviour should be used.
	None = StaleMode(2)
	// After indicates to update the index asynchronously after querying.
	After = StaleMode(3)
)
View Source
const (
	// Ascending indicates the query results should be sorted from lowest to highest.
	Ascending = SortOrder(1)
	// Descending indicates the query results should be sorted from highest to lowest.
	Descending = SortOrder(2)
)

Variables ¶

View Source
var (
	// ErrNotEnoughReplicas occurs when not enough replicas exist to match the specified durability requirements.
	ErrNotEnoughReplicas = errors.New("Not enough replicas to match durability requirements.")
	// ErrDurabilityTimeout occurs when the server took too long to meet the specified durability requirements.
	ErrDurabilityTimeout = errors.New("Failed to meet durability requirements in time.")
	// ErrNoResults occurs when no results are available to a query.
	ErrNoResults = errors.New("No results returned.")
	// ErrNoOpenBuckets occurs when a cluster-level operation is performed before any buckets are opened.
	ErrNoOpenBuckets = errors.New("You must open a bucket before you can perform cluster level operations.")
	// ErrIndexInvalidName occurs when an invalid name was specified for an index.
	ErrIndexInvalidName = errors.New("An invalid index name was specified.")
	// ErrIndexNoFields occurs when an index with no fields is created.
	ErrIndexNoFields = errors.New("You must specify at least one field to index.")
	// ErrIndexNotFound occurs when an operation expects an index but it was not found.
	ErrIndexNotFound = errors.New("The index specified does not exist.")
	// ErrIndexAlreadyExists occurs when an operation expects an index not to exist, but it was found.
	ErrIndexAlreadyExists = errors.New("The index specified already exists.")
	// ErrFacetNoRanges occurs when a range-based facet is specified but no ranges were indicated.
	ErrFacetNoRanges = errors.New("At least one range must be specified on a facet.")

	// ErrSearchIndexInvalidName occurs when an invalid name was specified for a search index.
	ErrSearchIndexInvalidName = errors.New("An invalid search index name was specified.")
	// ErrSearchIndexMissingType occurs when no type was specified for a search index.
	ErrSearchIndexMissingType = errors.New("No search index type was specified.")
	// ErrSearchIndexInvalidSourceType occurs when an invalid source type was specific for a search index.
	ErrSearchIndexInvalidSourceType = errors.New("An invalid search index source type was specified.")
	// ErrSearchIndexInvalidSourceName occurs when an invalid source name was specific for a search index.
	ErrSearchIndexInvalidSourceName = errors.New("An invalid search index source name was specified.")
	// ErrSearchIndexAlreadyExists occurs when an invalid source name was specific for a search index.
	ErrSearchIndexAlreadyExists = errors.New("The search index specified already exists.")
	// ErrSearchIndexInvalidIngestControlOp occurs when an invalid ingest control op was specific for a search index.
	ErrSearchIndexInvalidIngestControlOp = errors.New("An invalid search index ingest control op was specified.")
	// ErrSearchIndexInvalidQueryControlOp occurs when an invalid query control op was specific for a search index.
	ErrSearchIndexInvalidQueryControlOp = errors.New("An invalid search index query control op was specified.")
	// ErrSearchIndexInvalidPlanFreezeControlOp occurs when an invalid plan freeze control op was specific for a search index.
	ErrSearchIndexInvalidPlanFreezeControlOp = errors.New("An invalid search index plan freeze control op was specified.")

	// ErrMixedAuthentication occurs when a combination of certification authentication and password authentication are used.
	ErrMixedAuthentication = errors.New("Invalid mixed authentication configuration, cannot use cluster level authentication with bucket password authentication.")
	// ErrMixedCertAuthentication occurs when client certificate authentication is setup but CertAuthenticator is not used or vise versa.
	ErrMixedCertAuthentication = errors.New("Invalid mixed authentication configuration, client certificate and CertAuthenticator must be used together.")
	// ErrDispatchFail occurs when we failed to execute an operation due to internal routing issues.
	ErrDispatchFail = gocbcore.ErrDispatchFail
	// ErrBadHosts occurs when an invalid list of hosts is specified for bootstrapping.
	ErrBadHosts = gocbcore.ErrBadHosts
	// ErrProtocol occurs when an invalid protocol is specified for bootstrapping.
	ErrProtocol = gocbcore.ErrProtocol
	// ErrNoReplicas occurs when an operation expecting replicas is performed, but no replicas are available.
	ErrNoReplicas = gocbcore.ErrNoReplicas
	// ErrInvalidServer occurs when a specified server index is invalid.
	ErrInvalidServer = gocbcore.ErrInvalidServer
	// ErrInvalidVBucket occurs when a specified vbucket index is invalid.
	ErrInvalidVBucket = gocbcore.ErrInvalidVBucket
	// ErrInvalidReplica occurs when a specified replica index is invalid.
	ErrInvalidReplica = gocbcore.ErrInvalidReplica
	// ErrInvalidCert occurs when the specified certificate is not valid.
	ErrInvalidCert = gocbcore.ErrInvalidCert
	// ErrInvalidCredentials is returned when an invalid set of credentials is provided for a service.
	ErrInvalidCredentials = gocbcore.ErrInvalidCredentials
	// ErrNonZeroCas occurs when an operation that require a CAS value of 0 is used with a non-zero value.
	ErrNonZeroCas = gocbcore.ErrNonZeroCas

	// ErrShutdown occurs when an operation is performed on a bucket that has been closed.
	ErrShutdown = gocbcore.ErrShutdown
	// ErrOverload occurs when more operations were dispatched than the client is capable of writing.
	ErrOverload = gocbcore.ErrOverload
	// ErrNetwork occurs when various generic network errors occur.
	ErrNetwork = gocbcore.ErrNetwork
	// ErrTimeout occurs when an operation times out.
	ErrTimeout = gocbcore.ErrTimeout
	// ErrCliInternalError indicates an internal error occurred within the client.
	ErrCliInternalError = gocbcore.ErrCliInternalError

	// ErrStreamClosed occurs when an error is related to a stream closing.
	ErrStreamClosed = gocbcore.ErrStreamClosed
	// ErrStreamStateChanged occurs when an error is related to a cluster rebalance.
	ErrStreamStateChanged = gocbcore.ErrStreamStateChanged
	// ErrStreamDisconnected occurs when a stream is closed due to a connection dropping.
	ErrStreamDisconnected = gocbcore.ErrStreamDisconnected
	// ErrStreamTooSlow occurs when a stream is closed due to being too slow at consuming data.
	ErrStreamTooSlow = gocbcore.ErrStreamTooSlow

	// ErrKeyNotFound occurs when the key is not found on the server.
	ErrKeyNotFound = gocbcore.ErrKeyNotFound
	// ErrKeyExists occurs when the key already exists on the server.
	ErrKeyExists = gocbcore.ErrKeyExists
	// ErrTooBig occurs when the document is too big to be stored.
	ErrTooBig = gocbcore.ErrTooBig
	// ErrNotStored occurs when an item fails to be stored.  Usually an append/prepend to missing key.
	ErrNotStored = gocbcore.ErrNotStored
	// ErrAuthError occurs when there is an issue with authentication (bad password?).
	ErrAuthError = gocbcore.ErrAuthError
	// ErrRangeError occurs when an invalid range is specified.
	ErrRangeError = gocbcore.ErrRangeError
	// ErrRollback occurs when a server rollback has occurred making the operation no longer valid.
	ErrRollback = gocbcore.ErrRollback
	// ErrAccessError occurs when you do not have access to the specified resource.
	ErrAccessError = gocbcore.ErrAccessError
	// ErrOutOfMemory occurs when the server has run out of memory to process requests.
	ErrOutOfMemory = gocbcore.ErrOutOfMemory
	// ErrNotSupported occurs when an operation is performed which is not supported.
	ErrNotSupported = gocbcore.ErrNotSupported
	// ErrInternalError occurs when an internal error has prevented an operation from succeeding.
	ErrInternalError = gocbcore.ErrInternalError
	// ErrBusy occurs when the server is too busy to handle your operation.
	ErrBusy = gocbcore.ErrBusy
	// ErrTmpFail occurs when the server is not immediately able to handle your request.
	ErrTmpFail = gocbcore.ErrTmpFail

	// ErrSubDocPathNotFound occurs when a sub-document operation targets a path
	// which does not exist in the specifie document.
	ErrSubDocPathNotFound = gocbcore.ErrSubDocPathNotFound
	// ErrSubDocPathMismatch occurs when a sub-document operation specifies a path
	// which does not match the document structure (field access on an array).
	ErrSubDocPathMismatch = gocbcore.ErrSubDocPathMismatch
	// ErrSubDocPathInvalid occurs when a sub-document path could not be parsed.
	ErrSubDocPathInvalid = gocbcore.ErrSubDocPathInvalid
	// ErrSubDocPathTooBig occurs when a sub-document path is too big.
	ErrSubDocPathTooBig = gocbcore.ErrSubDocPathTooBig
	// ErrSubDocDocTooDeep occurs when an operation would cause a document to be
	// nested beyond the depth limits allowed by the sub-document specification.
	ErrSubDocDocTooDeep = gocbcore.ErrSubDocDocTooDeep
	// ErrSubDocCantInsert occurs when a sub-document operation could not insert.
	ErrSubDocCantInsert = gocbcore.ErrSubDocCantInsert
	// ErrSubDocNotJson occurs when a sub-document operation is performed on a
	// document which is not JSON.
	ErrSubDocNotJson = gocbcore.ErrSubDocNotJson
	// ErrSubDocBadRange occurs when a sub-document operation is performed with
	// a bad range.
	ErrSubDocBadRange = gocbcore.ErrSubDocBadRange
	// ErrSubDocBadDelta occurs when a sub-document counter operation is performed
	// and the specified delta is not valid.
	ErrSubDocBadDelta = gocbcore.ErrSubDocBadDelta
	// ErrSubDocPathExists occurs when a sub-document operation expects a path not
	// to exists, but the path was found in the document.
	ErrSubDocPathExists = gocbcore.ErrSubDocPathExists
	// ErrSubDocValueTooDeep occurs when a sub-document operation specifies a value
	// which is deeper than the depth limits of the sub-document specification.
	ErrSubDocValueTooDeep = gocbcore.ErrSubDocValueTooDeep
	// ErrSubDocBadCombo occurs when a multi-operation sub-document operation is
	// performed and operations within the package of ops conflict with each other.
	ErrSubDocBadCombo = gocbcore.ErrSubDocBadCombo
	// ErrSubDocBadMulti occurs when a multi-operation sub-document operation is
	// performed and operations within the package of ops conflict with each other.
	ErrSubDocBadMulti = gocbcore.ErrSubDocBadMulti
	// ErrSubDocSuccessDeleted occurs when a multi-operation sub-document operation
	// is performed on a soft-deleted document.
	ErrSubDocSuccessDeleted = gocbcore.ErrSubDocSuccessDeleted

	// ErrSubDocXattrInvalidFlagCombo occurs when an invalid set of
	// extended-attribute flags is passed to a sub-document operation.
	ErrSubDocXattrInvalidFlagCombo = gocbcore.ErrSubDocXattrInvalidFlagCombo
	// ErrSubDocXattrInvalidKeyCombo occurs when an invalid set of key operations
	// are specified for a extended-attribute sub-document operation.
	ErrSubDocXattrInvalidKeyCombo = gocbcore.ErrSubDocXattrInvalidKeyCombo
	// ErrSubDocXattrUnknownMacro occurs when an invalid macro value is specified.
	ErrSubDocXattrUnknownMacro = gocbcore.ErrSubDocXattrUnknownMacro
	// ErrSubDocXattrUnknownVAttr occurs when an invalid virtual attribute is specified.
	ErrSubDocXattrUnknownVAttr = gocbcore.ErrSubDocXattrUnknownVAttr
	// ErrSubDocXattrCannotModifyVAttr occurs when a mutation is attempted upon
	// a virtual attribute (which are immutable by definition).
	ErrSubDocXattrCannotModifyVAttr = gocbcore.ErrSubDocXattrCannotModifyVAttr
	// ErrSubDocMultiPathFailureDeleted occurs when a Multi Path Failure occurs on
	// a soft-deleted document.
	ErrSubDocMultiPathFailureDeleted = gocbcore.ErrSubDocMultiPathFailureDeleted
)

Functions ¶

func ErrorCause ¶ added in v1.2.5

func ErrorCause(err error) error

ErrorCause returns the underlying error for an enhanced error.

func IngestMethodInsert ¶ added in v1.5.1

func IngestMethodInsert(bucket *Bucket, key string, val interface{}) error

IngestMethodInsert indicates that the Insert function should be used for kv ingest.

func IngestMethodReplace ¶ added in v1.5.1

func IngestMethodReplace(bucket *Bucket, key string, val interface{}) error

IngestMethodReplace indicates that the Replace function should be used for kv ingest.

func IngestMethodUpsert ¶ added in v1.5.1

func IngestMethodUpsert(bucket *Bucket, key string, val interface{}) error

IngestMethodUpsert indicates that the Upsert function should be used for kv ingest.

func IsKeyExistsError ¶ added in v1.2.4

func IsKeyExistsError(err error) bool

IsKeyExistsError indicates whether the passed error is a key-value "Key Already Exists" error.

Experimental: This API is subject to change at any time.

func IsKeyNotFoundError ¶ added in v1.2.4

func IsKeyNotFoundError(err error) bool

IsKeyNotFoundError indicates whether the passed error is a key-value "Key Not Found" error.

Experimental: This API is subject to change at any time.

func IsStatusBusyError ¶ added in v1.5.1

func IsStatusBusyError(err error) bool

IsStatusBusyError indicates whether the passed error is a key-value "server is busy, try again later" error.

Experimental: This API is subject to change at any time.

func IsTmpFailError ¶ added in v1.5.1

func IsTmpFailError(err error) bool

IsTmpFailError indicates whether the passed error is a key-value "temporary failure, try again later" error.

Experimental: This API is subject to change at any time.

func PassthroughDataConverterFunction ¶ added in v1.5.1

func PassthroughDataConverterFunction(docBytes []byte) (interface{}, error)

PassthroughDataConverterFunction is a DataConverterFunction that returns the data that is passed to it. The interface out of this represents a map[string]interface{}.

func QueryExponentialDelayFunction ¶ added in v1.4.2

func QueryExponentialDelayFunction(retryDelay uint, retries uint) time.Duration

QueryExponentialDelayFunction provides retry delay durations (ms) following an exponential increment pattern

func QueryLinearDelayFunction ¶ added in v1.4.2

func QueryLinearDelayFunction(retryDelay uint, retries uint) time.Duration

QueryLinearDelayFunction provides retry delay durations (ms) following a linear increment pattern

func SetLogRedactionLevel ¶ added in v1.3.4

func SetLogRedactionLevel(level LogRedactLevel)

SetLogRedactionLevel specifies the level with which logs should be redacted.

func SetLogger ¶ added in v1.2.1

func SetLogger(logger Logger)

SetLogger sets a logger to be used by the library. A logger can be obtained via the DefaultStdioLogger() or VerboseStdioLogger() functions. You can also implement your own logger using the Logger interface.

func UUIDIdGeneratorFunction ¶ added in v1.5.1

func UUIDIdGeneratorFunction(doc interface{}) (string, error)

UUIDIdGeneratorFunction is a IdGeneratorFunction that creates a UUID ID for each document.

func Version ¶ added in v1.3.3

func Version() string

Version returns a string representation of the current SDK version.

Types ¶

type AnalyticsDeferredResultHandle ¶ added in v1.5.1

type AnalyticsDeferredResultHandle interface {
	One(valuePtr interface{}) error
	Next(valuePtr interface{}) bool
	NextBytes() []byte
	Close() error

	Status() (string, error)
}

AnalyticsDeferredResultHandle allows access to the handle of a deferred Analytics query.

Experimental: This API is subject to change at any time.

type AnalyticsIngestOptions ¶ added in v1.5.1

type AnalyticsIngestOptions struct {
	// contains filtered or unexported fields
}

AnalyticsIngestOptions contains the options for an Analytics query to KV ingest.

func DefaultAnalyticsIngestOptions ¶ added in v1.5.1

func DefaultAnalyticsIngestOptions() *AnalyticsIngestOptions

DefaultAnalyticsIngestOptions creates a new AnalyticsIngestOptions from a set of defaults.

UNCOMMITTED: This API may change.

func (*AnalyticsIngestOptions) AnalyticsTimeout ¶ added in v1.5.1

func (ai *AnalyticsIngestOptions) AnalyticsTimeout(timeout time.Duration) *AnalyticsIngestOptions

AnalyticsTimeout sets the timeout value that will be used for execution of the AnalyticsQuery.

func (*AnalyticsIngestOptions) DataConverter ¶ added in v1.5.1

DataConverter sets the DataConverterFunction to use for conversion of Analytics documents to KV documents.

func (*AnalyticsIngestOptions) IdGenerator ¶ added in v1.5.1

IdGenerator sets the IdGeneratorFunction to use for generation of IDs

func (*AnalyticsIngestOptions) IgnoreIngestError ¶ added in v1.5.1

func (ai *AnalyticsIngestOptions) IgnoreIngestError(ignore bool) *AnalyticsIngestOptions

IgnoreIngestError sets whether errors will be ignored when performing KV operations

func (*AnalyticsIngestOptions) IngestMethod ¶ added in v1.5.1

func (ai *AnalyticsIngestOptions) IngestMethod(method ingestMethod) *AnalyticsIngestOptions

IngestMethod sets ingestMethod that will be used for KV operations

func (*AnalyticsIngestOptions) KVRetryBehavior ¶ added in v1.5.1

func (ai *AnalyticsIngestOptions) KVRetryBehavior(behavior QueryRetryBehavior) *AnalyticsIngestOptions

KVRetryBehavior sets the QueryRetryBehavior to use for retrying KV operations when a temporary or overload error occurs.

func (*AnalyticsIngestOptions) KVRetryOn ¶ added in v1.5.1

func (ai *AnalyticsIngestOptions) KVRetryOn(errors []error) *AnalyticsIngestOptions

KVRetryOn sets the errors to perform retries on for kv operation errors.

type AnalyticsQuery ¶ added in v1.2.2

type AnalyticsQuery struct {
	// contains filtered or unexported fields
}

AnalyticsQuery represents a pending Analytics query.

func NewAnalyticsQuery ¶ added in v1.2.2

func NewAnalyticsQuery(statement string) *AnalyticsQuery

NewAnalyticsQuery creates a new AnalyticsQuery object from a query string.

func (*AnalyticsQuery) ContextId ¶ added in v1.4.2

func (aq *AnalyticsQuery) ContextId(clientContextId string) *AnalyticsQuery

ContextId sets the client context id for the request, for use with tracing.

func (*AnalyticsQuery) Deferred ¶ added in v1.5.1

func (aq *AnalyticsQuery) Deferred(deferred bool) *AnalyticsQuery

Deferred sets whether or not the query should be run as a deferred query.

Experimental: This API is subject to change at any time.

func (*AnalyticsQuery) Pretty ¶ added in v1.4.2

func (aq *AnalyticsQuery) Pretty(pretty bool) *AnalyticsQuery

Pretty indicates whether the response should be nicely formatted.

func (*AnalyticsQuery) Priority ¶ added in v1.4.2

func (aq *AnalyticsQuery) Priority(priority bool) *AnalyticsQuery

Priority sets whether or not the query should be run with priority status.

func (*AnalyticsQuery) RawParam ¶ added in v1.4.2

func (aq *AnalyticsQuery) RawParam(name string, value interface{}) *AnalyticsQuery

RawParam allows specifying custom query options.

func (*AnalyticsQuery) ServerSideTimeout ¶ added in v1.4.2

func (aq *AnalyticsQuery) ServerSideTimeout(timeout time.Duration) *AnalyticsQuery

ServerSideTimeout indicates the maximum time to wait for this query to complete.

type AnalyticsResultMetrics ¶ added in v1.4.2

type AnalyticsResultMetrics struct {
	ElapsedTime      time.Duration
	ExecutionTime    time.Duration
	ResultCount      uint
	ResultSize       uint
	MutationCount    uint
	SortCount        uint
	ErrorCount       uint
	WarningCount     uint
	ProcessedObjects uint
}

AnalyticsResultMetrics encapsulates various metrics gathered during a queries execution.

type AnalyticsResults ¶ added in v1.2.2

type AnalyticsResults interface {
	One(valuePtr interface{}) error
	Next(valuePtr interface{}) bool
	NextBytes() []byte
	Close() error

	RequestId() string
	ClientContextId() string
	Status() string
	Warnings() []AnalyticsWarning
	Signature() interface{}
	Metrics() AnalyticsResultMetrics
	Handle() AnalyticsDeferredResultHandle
}

AnalyticsResults allows access to the results of a Analytics query.

type AnalyticsWarning ¶ added in v1.4.2

type AnalyticsWarning struct {
	Code    uint32 `json:"code"`
	Message string `json:"msg"`
}

AnalyticsWarning represents any warning generating during the execution of an Analytics query.

type AppendOp ¶

type AppendOp struct {
	Key   string
	Value string
	Cas   Cas
	Err   error
	// contains filtered or unexported fields
}

AppendOp represents a type of `BulkOp` used for Append operations. See BulkOp.

type AuthCredsRequest ¶ added in v1.3.1

type AuthCredsRequest struct {
	Service  ServiceType
	Endpoint string
	Bucket   string
}

AuthCredsRequest encapsulates the data for a credential request from the new Authenticator interface. UNCOMMITTED

type AuthDomain ¶ added in v1.2.4

type AuthDomain string

AuthDomain specifies the user domain of a specific user

const (
	// LocalDomain specifies users that are locally stored in Couchbase.
	LocalDomain AuthDomain = "local"

	// ExternalDomain specifies users that are externally stored
	// (in LDAP for instance).
	ExternalDomain = "external"
)

type Authenticator ¶

type Authenticator interface {
	Credentials(req AuthCredsRequest) ([]UserPassPair, error)
}

Authenticator provides an interface to authenticate to each service. Note that only authenticators implemented here are stable, and support for custom authenticators is considered volatile.

type Bucket ¶

type Bucket struct {
	// contains filtered or unexported fields
}

Bucket is an interface representing a single bucket within a cluster.

func (*Bucket) AnalyticsIngest ¶ added in v1.5.1

func (b *Bucket) AnalyticsIngest(analyticsQuery *AnalyticsQuery, analyticsParams []interface{}, opts *AnalyticsIngestOptions) error

AnalyticsIngest executes an Analytics query and inserts/updates/replaces the transformed results into a bucket.

UNCOMMITTED: This API may change.

func (*Bucket) AnalyticsTimeout ¶ added in v1.4.2

func (b *Bucket) AnalyticsTimeout() time.Duration

AnalyticsTimeout returns the maximum amount of time to wait for an Analytics query to complete.

func (*Bucket) Append ¶

func (b *Bucket) Append(key, value string) (Cas, error)

Append appends a string value to a document.

func (*Bucket) AppendDura ¶

func (b *Bucket) AppendDura(key, value string, replicateTo, persistTo uint) (Cas, error)

AppendDura appends a string value to a document. Additionally checks document durability.

func (*Bucket) AppendMt ¶

func (b *Bucket) AppendMt(key, value string) (Cas, MutationToken, error)

AppendMt performs a Append operation and includes MutationToken in the results.

func (*Bucket) BulkOperationTimeout ¶

func (b *Bucket) BulkOperationTimeout() time.Duration

BulkOperationTimeout returns the maximum amount of time to wait for a bulk op to succeed.

func (*Bucket) Close ¶

func (b *Bucket) Close() error

Close the instance’s underlying socket resources. Note that operations pending on the connection may fail.

func (*Bucket) Counter ¶

func (b *Bucket) Counter(key string, delta, initial int64, expiry uint32) (uint64, Cas, error)

Counter performs an atomic addition or subtraction for an integer document. Passing a non-negative `initial` value will cause the document to be created if it did not already exist.

func (*Bucket) CounterDura ¶

func (b *Bucket) CounterDura(key string, delta, initial int64, expiry uint32, replicateTo, persistTo uint) (uint64, Cas, error)

CounterDura performs an atomic addition or subtraction for an integer document. Additionally checks document durability.

func (*Bucket) CounterMt ¶

func (b *Bucket) CounterMt(key string, delta, initial int64, expiry uint32) (uint64, Cas, MutationToken, error)

CounterMt performs a Counter operation and includes MutationToken in the results.

func (*Bucket) Diagnostics ¶ added in v1.3.3

func (bucket *Bucket) Diagnostics() (*DiagnosticReport, error)

Diagnostics returns information about the internal state of the SDK.

Experimental: This API is subject to change at any time.

func (*Bucket) Do ¶

func (b *Bucket) Do(ops []BulkOp) error

Do execute one or more `BulkOp` items in parallel.

func (*Bucket) DurabilityPollTimeout ¶

func (b *Bucket) DurabilityPollTimeout() time.Duration

DurabilityPollTimeout returns the amount of time waiting between durability polls.

func (*Bucket) DurabilityTimeout ¶

func (b *Bucket) DurabilityTimeout() time.Duration

DurabilityTimeout returns the maximum amount of time to wait for durability to succeed.

func (*Bucket) ExecuteAnalyticsQuery ¶ added in v1.4.2

func (b *Bucket) ExecuteAnalyticsQuery(q *AnalyticsQuery, params interface{}) (AnalyticsResults, error)

ExecuteAnalyticsQuery performs an analytics query and returns a list of rows or an error.

func (*Bucket) ExecuteN1qlQuery ¶

func (b *Bucket) ExecuteN1qlQuery(q *N1qlQuery, params interface{}) (QueryResults, error)

ExecuteN1qlQuery performs a n1ql query and returns a list of rows or an error.

func (*Bucket) ExecuteSearchQuery ¶

func (b *Bucket) ExecuteSearchQuery(q *SearchQuery) (SearchResults, error)

ExecuteSearchQuery performs a view query and returns a list of rows or an error.

func (*Bucket) ExecuteSpatialQuery ¶

func (b *Bucket) ExecuteSpatialQuery(q *SpatialQuery) (ViewResults, error)

ExecuteSpatialQuery performs a spatial query and returns a list of rows or an error.

func (*Bucket) ExecuteViewQuery ¶

func (b *Bucket) ExecuteViewQuery(q *ViewQuery) (ViewResults, error)

ExecuteViewQuery performs a view query and returns a list of rows or an error.

func (*Bucket) Get ¶

func (b *Bucket) Get(key string, valuePtr interface{}) (Cas, error)

Get retrieves a document from the bucket

func (*Bucket) GetAndLock ¶

func (b *Bucket) GetAndLock(key string, lockTime uint32, valuePtr interface{}) (Cas, error)

GetAndLock locks a document for a period of time, providing exclusive RW access to it.

func (*Bucket) GetAndTouch ¶

func (b *Bucket) GetAndTouch(key string, expiry uint32, valuePtr interface{}) (Cas, error)

GetAndTouch retrieves a document and simultaneously updates its expiry time.

func (*Bucket) GetReplica ¶

func (b *Bucket) GetReplica(key string, valuePtr interface{}, replicaIdx int) (Cas, error)

GetReplica returns the value of a particular document from a replica server.

func (*Bucket) Insert ¶

func (b *Bucket) Insert(key string, value interface{}, expiry uint32) (Cas, error)

Insert inserts a new document to the bucket.

func (*Bucket) InsertDura ¶

func (b *Bucket) InsertDura(key string, value interface{}, expiry uint32, replicateTo, persistTo uint) (Cas, error)

InsertDura inserts a new document to the bucket. Additionally checks document durability.

func (*Bucket) InsertMt ¶

func (b *Bucket) InsertMt(key string, value interface{}, expiry uint32) (Cas, MutationToken, error)

InsertMt performs a Insert operation and includes MutationToken in the results.

func (*Bucket) Internal ¶

func (b *Bucket) Internal() *BucketInternal

Internal methods, not safe to be consumed by third parties.

func (*Bucket) InvalidateQueryCache ¶

func (b *Bucket) InvalidateQueryCache()

InvalidateQueryCache forces the internal cache of prepared queries to be cleared.

Queries to be cached are controlled by the Adhoc() method of N1qlQuery.

func (*Bucket) IoRouter ¶

func (b *Bucket) IoRouter() *gocbcore.Agent

IoRouter returns the underlying gocb agent managing connections.

func (*Bucket) ListAppend ¶

func (b *Bucket) ListAppend(key string, value interface{}, createList bool) (Cas, error)

ListAppend inserts an item to the end of a list document.

func (*Bucket) ListGet ¶

func (b *Bucket) ListGet(key string, index uint, valuePtr interface{}) (Cas, error)

ListGet retrieves an item from a list document by index.

func (*Bucket) ListPrepend ¶

func (b *Bucket) ListPrepend(key string, value interface{}, createList bool) (Cas, error)

ListPrepend inserts an item to the beginning of a list document.

func (*Bucket) ListRemove ¶

func (b *Bucket) ListRemove(key string, index uint) (Cas, error)

ListRemove removes an item from a list document by its index.

func (*Bucket) ListSet ¶

func (b *Bucket) ListSet(key string, index uint, value interface{}) (Cas, error)

ListSet replaces the item at a particular index of a list document.

func (*Bucket) ListSize ¶

func (b *Bucket) ListSize(key string) (uint, Cas, error)

ListSize returns the current number of items in a list. PERFORMANCE NOTICE: This currently performs a full document fetch...

func (*Bucket) LookupIn ¶

func (b *Bucket) LookupIn(key string) *LookupInBuilder

LookupIn creates a sub-document lookup operation builder.

func (*Bucket) LookupInEx ¶ added in v1.2.3

func (b *Bucket) LookupInEx(key string, flags SubdocDocFlag) *LookupInBuilder

LookupInEx creates a sub-document lookup operation builder.

func (*Bucket) Manager ¶

func (b *Bucket) Manager(username, password string) *BucketManager

Manager returns a BucketManager for performing management operations on this bucket.

func (*Bucket) MapAdd ¶

func (b *Bucket) MapAdd(key, path string, value interface{}, createMap bool) (Cas, error)

MapAdd inserts an item to a map document.

func (*Bucket) MapGet ¶

func (b *Bucket) MapGet(key, path string, valuePtr interface{}) (Cas, error)

MapGet retrieves a single item from a map document by its key.

func (*Bucket) MapRemove ¶

func (b *Bucket) MapRemove(key, path string) (Cas, error)

MapRemove removes a specified key from the specified map document.

func (*Bucket) MapSize ¶

func (b *Bucket) MapSize(key string) (uint, Cas, error)

MapSize returns the current number of items in a map document. PERFORMANCE NOTICE: This currently performs a full document fetch...

func (*Bucket) MutateIn ¶

func (b *Bucket) MutateIn(key string, cas Cas, expiry uint32) *MutateInBuilder

MutateIn creates a sub-document mutation operation builder.

func (*Bucket) MutateInEx ¶ added in v1.2.3

func (b *Bucket) MutateInEx(key string, flags SubdocDocFlag, cas Cas, expiry uint32) *MutateInBuilder

MutateInEx creates a sub-document mutation operation builder.

func (*Bucket) MutateInExDura ¶ added in v1.3.6

func (b *Bucket) MutateInExDura(key string, flags SubdocDocFlag, cas Cas, expiry uint32, replicaTo, persistTo uint) *MutateInBuilder

MutateInExDura creates a sub-document mutation operation builder with durability.

func (*Bucket) N1qlTimeout ¶

func (b *Bucket) N1qlTimeout() time.Duration

N1qlTimeout returns the maximum amount of time to wait for a N1QL query to complete.

func (*Bucket) Name ¶ added in v1.2.1

func (b *Bucket) Name() string

Name returns the name of the bucket we are connected to.

func (*Bucket) OperationTimeout ¶

func (b *Bucket) OperationTimeout() time.Duration

OperationTimeout returns the maximum amount of time to wait for an operation to succeed.

func (*Bucket) Ping ¶ added in v1.3.3

func (b *Bucket) Ping(services []ServiceType) (*PingReport, error)

Ping will ping a list of services and verify they are active and responding in an acceptable period of time.

Experimental: This API is subject to change at any time.

func (*Bucket) Prepend ¶

func (b *Bucket) Prepend(key, value string) (Cas, error)

Prepend prepends a string value to a document.

func (*Bucket) PrependDura ¶

func (b *Bucket) PrependDura(key, value string, replicateTo, persistTo uint) (Cas, error)

PrependDura prepends a string value to a document. Additionally checks document durability.

func (*Bucket) PrependMt ¶

func (b *Bucket) PrependMt(key, value string) (Cas, MutationToken, error)

PrependMt performs a Prepend operation and includes MutationToken in the results.

func (*Bucket) QueuePop ¶

func (b *Bucket) QueuePop(key string, valuePtr interface{}) (Cas, error)

QueuePop pops the oldest item from a queue and returns it.

func (*Bucket) QueuePush ¶

func (b *Bucket) QueuePush(key string, value interface{}, createQueue bool) (Cas, error)

QueuePush adds a new item to the end of a queue.

func (*Bucket) QueueSize ¶

func (b *Bucket) QueueSize(key string) (uint, Cas, error)

QueueSize returns the current size of a queue.

func (*Bucket) Remove ¶

func (b *Bucket) Remove(key string, cas Cas) (Cas, error)

Remove removes a document from the bucket.

func (*Bucket) RemoveDura ¶

func (b *Bucket) RemoveDura(key string, cas Cas, replicateTo, persistTo uint) (Cas, error)

RemoveDura removes a document from the bucket. Additionally checks document durability.

func (*Bucket) RemoveMt ¶

func (b *Bucket) RemoveMt(key string, cas Cas) (Cas, MutationToken, error)

RemoveMt performs a Remove operation and includes MutationToken in the results.

func (*Bucket) Replace ¶

func (b *Bucket) Replace(key string, value interface{}, cas Cas, expiry uint32) (Cas, error)

Replace replaces a document in the bucket.

func (*Bucket) ReplaceDura ¶

func (b *Bucket) ReplaceDura(key string, value interface{}, cas Cas, expiry uint32, replicateTo, persistTo uint) (Cas, error)

ReplaceDura replaces a document in the bucket. Additionally checks document durability.

func (*Bucket) ReplaceMt ¶

func (b *Bucket) ReplaceMt(key string, value interface{}, cas Cas, expiry uint32) (Cas, MutationToken, error)

ReplaceMt performs a Replace operation and includes MutationToken in the results.

func (*Bucket) SetAdd ¶

func (b *Bucket) SetAdd(key string, value interface{}, createSet bool) (Cas, error)

SetAdd adds a new value to a set document.

func (*Bucket) SetAnalyticsQueryRetryBehavior ¶ added in v1.4.2

func (b *Bucket) SetAnalyticsQueryRetryBehavior(retryBehavior QueryRetryBehavior)

SetAnalyticsQueryRetryBehavior sets the retry behavior to use for retrying queries.

func (*Bucket) SetAnalyticsTimeout ¶ added in v1.4.2

func (b *Bucket) SetAnalyticsTimeout(timeout time.Duration)

SetAnalyticsTimeout sets the maximum amount of time to wait for an Analytics query to complete.

func (*Bucket) SetBulkOperationTimeout ¶

func (b *Bucket) SetBulkOperationTimeout(timeout time.Duration)

SetBulkOperationTimeout sets the maxium amount of time to wait for a bulk op to succeed.

func (*Bucket) SetDurabilityPollTimeout ¶

func (b *Bucket) SetDurabilityPollTimeout(timeout time.Duration)

SetDurabilityPollTimeout sets the amount of time waiting between durability polls.

func (*Bucket) SetDurabilityTimeout ¶

func (b *Bucket) SetDurabilityTimeout(timeout time.Duration)

SetDurabilityTimeout sets the maximum amount of time to wait for durability to succeed.

func (*Bucket) SetExists ¶

func (b *Bucket) SetExists(key string, value interface{}) (bool, Cas, error)

SetExists checks if a particular value exists within the specified set document. PERFORMANCE WARNING: This performs a full set fetch and compare.

func (*Bucket) SetN1qlTimeout ¶

func (b *Bucket) SetN1qlTimeout(timeout time.Duration)

SetN1qlTimeout sets the maximum amount of time to wait for a N1QL query to complete.

func (*Bucket) SetOperationTimeout ¶

func (b *Bucket) SetOperationTimeout(timeout time.Duration)

SetOperationTimeout sets the maximum amount of time to wait for an operation to succeed.

func (*Bucket) SetRemove ¶

func (b *Bucket) SetRemove(key string, value interface{}) (Cas, error)

SetRemove removes a single specified value from the specified set document. WARNING: This relies on Go's interface{} comparison behaviour! PERFORMANCE WARNING: This performs full set fetch, modify, store cycles.

func (*Bucket) SetSearchQueryRetryBehavior ¶ added in v1.4.2

func (b *Bucket) SetSearchQueryRetryBehavior(retryBehavior QueryRetryBehavior)

SetSearchQueryRetryBehavior sets the retry behavior to use for retrying queries.

func (*Bucket) SetSize ¶

func (b *Bucket) SetSize(key string) (uint, Cas, error)

SetSize returns the current number of values in a set. PERFORMANCE NOTICE: This currently performs a full document fetch...

func (*Bucket) SetTranscoder ¶

func (b *Bucket) SetTranscoder(transcoder Transcoder)

SetTranscoder specifies a Transcoder to use when translating documents from their

raw byte format to Go types and back.

func (*Bucket) SetViewTimeout ¶

func (b *Bucket) SetViewTimeout(timeout time.Duration)

SetViewTimeout sets the maximum amount of time to wait for a view query to complete.

func (*Bucket) Stats ¶

func (b *Bucket) Stats(key string) (ServerStats, error)

Stats returns various server statistics from the cluster.

func (*Bucket) Touch ¶

func (b *Bucket) Touch(key string, cas Cas, expiry uint32) (Cas, error)

Touch touches a document, specifying a new expiry time for it. The Cas value must be 0.

func (*Bucket) TouchDura ¶

func (b *Bucket) TouchDura(key string, cas Cas, expiry uint32, replicateTo, persistTo uint) (Cas, error)

TouchDura touches a document, specifying a new expiry time for it. Additionally checks document durability. The Cas value must be 0.

func (*Bucket) UUID ¶ added in v1.2.3

func (b *Bucket) UUID() string

UUID returns the uuid of the bucket we are connected to.

func (*Bucket) Unlock ¶

func (b *Bucket) Unlock(key string, cas Cas) (Cas, error)

Unlock unlocks a document which was locked with GetAndLock.

func (*Bucket) Upsert ¶

func (b *Bucket) Upsert(key string, value interface{}, expiry uint32) (Cas, error)

Upsert inserts or replaces a document in the bucket.

func (*Bucket) UpsertDura ¶

func (b *Bucket) UpsertDura(key string, value interface{}, expiry uint32, replicateTo, persistTo uint) (Cas, error)

UpsertDura inserts or replaces a document in the bucket. Additionally checks document durability.

func (*Bucket) UpsertMt ¶

func (b *Bucket) UpsertMt(key string, value interface{}, expiry uint32) (Cas, MutationToken, error)

UpsertMt performs a Upsert operation and includes MutationToken in the results.

func (*Bucket) ViewTimeout ¶

func (b *Bucket) ViewTimeout() time.Duration

ViewTimeout returns the maximum amount of time to wait for a view query to complete.

type BucketAuthenticator ¶

type BucketAuthenticator struct {
	Password string
}

BucketAuthenticator provides a password for a single bucket.

type BucketAuthenticatorMap ¶

type BucketAuthenticatorMap map[string]BucketAuthenticator

BucketAuthenticatorMap is a map of bucket name to BucketAuthenticator.

type BucketInternal ¶

type BucketInternal struct {
	// contains filtered or unexported fields
}

BucketInternal holds various internally used bucket extension methods.

Internal: This should never be used and is not supported.

func (*BucketInternal) GetRandom ¶

func (bi *BucketInternal) GetRandom(valuePtr interface{}) (string, Cas, error)

GetRandom retrieves a document from the bucket

func (*BucketInternal) RemoveMeta ¶

func (bi *BucketInternal) RemoveMeta(key string, value, extra []byte, datatype uint8,
	options, flags, expiry uint32, cas, revseqno uint64) (Cas, error)

RemoveMeta removes a document (with metadata) from the bucket.

func (*BucketInternal) UpsertMeta ¶

func (bi *BucketInternal) UpsertMeta(key string, value, extra []byte, datatype uint8,
	options, flags, expiry uint32, cas, revseqno uint64) (Cas, error)

UpsertMeta inserts or replaces (with metadata) a document in a bucket.

type BucketManager ¶

type BucketManager struct {
	// contains filtered or unexported fields
}

BucketManager provides methods for performing bucket management operations. See ClusterManager for methods that allow creating and removing buckets themselves.

func (*BucketManager) BuildDeferredIndexes ¶

func (bm *BucketManager) BuildDeferredIndexes() ([]string, error)

BuildDeferredIndexes builds all indexes which are currently in deferred state.

func (*BucketManager) CreateIndex ¶

func (bm *BucketManager) CreateIndex(indexName string, fields []string, ignoreIfExists, deferred bool) error

CreateIndex creates an index over the specified fields.

func (*BucketManager) CreatePrimaryIndex ¶

func (bm *BucketManager) CreatePrimaryIndex(customName string, ignoreIfExists, deferred bool) error

CreatePrimaryIndex creates a primary index. An empty customName uses the default naming.

func (*BucketManager) DropIndex ¶

func (bm *BucketManager) DropIndex(indexName string, ignoreIfNotExists bool) error

DropIndex drops a specific index by name.

func (*BucketManager) DropPrimaryIndex ¶

func (bm *BucketManager) DropPrimaryIndex(customName string, ignoreIfNotExists bool) error

DropPrimaryIndex drops the primary index. Pass an empty customName for unnamed primary indexes.

func (*BucketManager) Flush ¶

func (bm *BucketManager) Flush() error

Flush will delete all the of the data from a bucket. Keep in mind that you must have flushing enabled in the buckets configuration.

func (*BucketManager) GetDesignDocument ¶

func (bm *BucketManager) GetDesignDocument(name string) (*DesignDocument, error)

GetDesignDocument retrieves a single design document for the given bucket..

func (*BucketManager) GetDesignDocuments ¶

func (bm *BucketManager) GetDesignDocuments() ([]*DesignDocument, error)

GetDesignDocuments will retrieve all design documents for the given bucket.

func (*BucketManager) GetIndexes ¶

func (bm *BucketManager) GetIndexes() ([]IndexInfo, error)

GetIndexes returns a list of all currently registered indexes.

func (*BucketManager) InsertDesignDocument ¶

func (bm *BucketManager) InsertDesignDocument(ddoc *DesignDocument) error

InsertDesignDocument inserts a design document to the given bucket.

func (*BucketManager) RemoveDesignDocument ¶

func (bm *BucketManager) RemoveDesignDocument(name string) error

RemoveDesignDocument will remove a design document from the given bucket.

func (*BucketManager) UpsertDesignDocument ¶

func (bm *BucketManager) UpsertDesignDocument(ddoc *DesignDocument) error

UpsertDesignDocument will insert a design document to the given bucket, or update an existing design document with the same name.

func (*BucketManager) WatchIndexes ¶

func (bm *BucketManager) WatchIndexes(watchList []string, watchPrimary bool, timeout time.Duration) error

WatchIndexes waits for a set of indexes to come online

type BucketSettings ¶

type BucketSettings struct {
	FlushEnabled  bool
	IndexReplicas bool
	Name          string
	Password      string
	Quota         int
	Replicas      int
	Type          BucketType
}

BucketSettings holds information about the settings for a bucket.

type BucketType ¶

type BucketType int

BucketType specifies the kind of bucket

type BulkOp ¶

type BulkOp interface {
	// contains filtered or unexported methods
}

BulkOp represents a single operation that can be submitted (within a list of more operations) to .Do() You can create a bulk operation by instantiating one of the implementations of BulkOp, such as GetOp, UpsertOp, ReplaceOp, and more.

type Cas ¶

type Cas gocbcore.Cas

Cas represents the specific state of a document on the cluster.

type CertAuthenticator ¶ added in v1.3.7

type CertAuthenticator struct {
}

CertAuthenticator implements an Authenticator which can be used with certificate authentication.

func (CertAuthenticator) Credentials ¶ added in v1.3.7

func (ca CertAuthenticator) Credentials(req AuthCredsRequest) ([]UserPassPair, error)

Credentials returns the credentials for a particular service.

type CertificateAuthenticator ¶ added in v1.3.3

type CertificateAuthenticator struct {
	CertAuthenticator
}

CertificateAuthenticator is included for backwards compatibility only. Deprecated: Use CertAuthenticator instead.

type Cluster ¶

type Cluster struct {
	// contains filtered or unexported fields
}

Cluster represents a connection to a specific Couchbase cluster.

func Connect ¶

func Connect(connSpecStr string) (*Cluster, error)

Connect creates a new Cluster object for a specific cluster. These options are copied from (and should stay in sync with) the gocbcore agent.FromConnStr comment. Supported connSpecStr options are:

cacertpath (string) - Path to the CA certificate
certpath (string) - Path to your authentication certificate
keypath (string) - Path to your authentication key
config_total_timeout (int) - Maximum period to attempt to connect to cluster in ms.
config_node_timeout (int) - Maximum period to attempt to connect to a node in ms.
http_redial_period (int) - Maximum period to keep HTTP config connections open in ms.
http_retry_delay (int) - Period to wait between retrying nodes for HTTP config in ms.
config_poll_floor_interval (int) - Minimum time to wait between fetching configs via CCCP in ms.
config_poll_interval (int) - Period to wait between CCCP config polling in ms.
kv_pool_size (int) - The number of connections to establish per node.
max_queue_size (int) - The maximum size of the operation queues per node.
use_kverrmaps (bool) - Whether to enable error maps from the server.
use_enhanced_errors (bool) - Whether to enable enhanced error information.
fetch_mutation_tokens (bool) - Whether to fetch mutation tokens for operations.
compression (bool) - Whether to enable network-wise compression of documents.
compression_min_size (int) - The minimal size of the document to consider compression.
compression_min_ratio (float64) - The minimal compress ratio (compressed / original) for the document to be sent compressed.
server_duration (bool) - Whether to enable fetching server operation durations.
http_max_idle_conns (int) - Maximum number of idle http connections in the pool.
http_max_idle_conns_per_host (int) - Maximum number of idle http connections in the pool per host.
http_idle_conn_timeout (int) - Maximum length of time for an idle connection to stay in the pool in ms.
network (string) - The network type to use.
orphaned_response_logging (bool) - Whether to enable orphan response logging.
orphaned_response_logging_interval (int) - How often to log orphan responses in ms.
orphaned_response_logging_sample_size (int) - The number of samples to include in each orphaned response log.
operation_tracing (bool) - Whether to enable tracing.
n1ql_timeout (int) - Maximum execution time for n1ql queries in ms.
fts_timeout (int) - Maximum execution time for fts searches in ms.
analytics_timeout (int) - Maximum execution time for analytics queries in ms.

func (*Cluster) AnalyticsTimeout ¶ added in v1.2.2

func (c *Cluster) AnalyticsTimeout() time.Duration

AnalyticsTimeout returns the maximum time to wait for a cluster-level Analytics query to complete.

func (*Cluster) Authenticate ¶

func (c *Cluster) Authenticate(auth Authenticator) error

Authenticate specifies an Authenticator interface to use to authenticate with cluster services.

func (*Cluster) Close ¶ added in v1.3.4

func (c *Cluster) Close() error

Close shuts down all buckets in this cluster and invalidates any references this cluster has.

func (*Cluster) ConnectTimeout ¶

func (c *Cluster) ConnectTimeout() time.Duration

ConnectTimeout returns the maximum time to wait when attempting to connect to a bucket.

func (*Cluster) EnhancedErrors ¶ added in v1.2.5

func (c *Cluster) EnhancedErrors() bool

EnhancedErrors returns the current enhanced error message state.

func (*Cluster) ExecuteAnalyticsQuery ¶ added in v1.2.2

func (c *Cluster) ExecuteAnalyticsQuery(q *AnalyticsQuery, params interface{}) (AnalyticsResults, error)

ExecuteAnalyticsQuery performs an analytics query and returns a list of rows or an error.

func (*Cluster) ExecuteN1qlQuery ¶

func (c *Cluster) ExecuteN1qlQuery(q *N1qlQuery, params interface{}) (QueryResults, error)

ExecuteN1qlQuery performs a n1ql query and returns a list of rows or an error.

func (*Cluster) ExecuteSearchQuery ¶

func (c *Cluster) ExecuteSearchQuery(q *SearchQuery) (SearchResults, error)

ExecuteSearchQuery performs a n1ql query and returns a list of rows or an error.

func (*Cluster) FtsTimeout ¶

func (c *Cluster) FtsTimeout() time.Duration

FtsTimeout returns the maximum time to wait for a cluster-level FTS query to complete.

func (*Cluster) InvalidateQueryCache ¶

func (c *Cluster) InvalidateQueryCache()

InvalidateQueryCache forces the internal cache of prepared queries to be cleared.

func (*Cluster) Manager ¶

func (c *Cluster) Manager(username, password string) *ClusterManager

Manager returns a ClusterManager object for performing cluster management operations on this cluster.

func (*Cluster) N1qlTimeout ¶

func (c *Cluster) N1qlTimeout() time.Duration

N1qlTimeout returns the maximum time to wait for a cluster-level N1QL query to complete.

func (*Cluster) NmvRetryDelay ¶

func (c *Cluster) NmvRetryDelay() time.Duration

NmvRetryDelay returns the time to wait between retrying an operation due to not my vbucket.

func (*Cluster) OpenBucket ¶

func (c *Cluster) OpenBucket(bucket, password string) (*Bucket, error)

OpenBucket opens a new connection to the specified bucket.

func (*Cluster) OpenBucketWithMt ¶

func (c *Cluster) OpenBucketWithMt(bucket, password string) (*Bucket, error)

OpenBucketWithMt opens a new connection to the specified bucket and enables mutation tokens. MutationTokens allow you to execute queries and durability requirements with very specific operation-level consistency.

func (*Cluster) OpenStreamingBucket ¶

func (c *Cluster) OpenStreamingBucket(streamName, bucket, password string) (*StreamingBucket, error)

OpenStreamingBucket opens a new connection to the specified bucket for the purpose of streaming data.

func (*Cluster) ServerConnectTimeout ¶

func (c *Cluster) ServerConnectTimeout() time.Duration

ServerConnectTimeout returns the maximum time to attempt to connect to a single node.

func (*Cluster) SetAnalyticsTimeout ¶ added in v1.2.2

func (c *Cluster) SetAnalyticsTimeout(timeout time.Duration)

SetAnalyticsTimeout sets the maximum time to wait for a cluster-level Analytics query to complete.

func (*Cluster) SetConnectTimeout ¶

func (c *Cluster) SetConnectTimeout(timeout time.Duration)

SetConnectTimeout sets the maximum time to wait when attempting to connect to a bucket.

func (*Cluster) SetEnhancedErrors ¶ added in v1.2.5

func (c *Cluster) SetEnhancedErrors(enabled bool)

SetEnhancedErrors sets the current enhanced error message state.

func (*Cluster) SetFtsTimeout ¶

func (c *Cluster) SetFtsTimeout(timeout time.Duration)

SetFtsTimeout sets the maximum time to wait for a cluster-level FTS query to complete.

func (*Cluster) SetN1qlTimeout ¶

func (c *Cluster) SetN1qlTimeout(timeout time.Duration)

SetN1qlTimeout sets the maximum time to wait for a cluster-level N1QL query to complete.

func (*Cluster) SetNmvRetryDelay ¶

func (c *Cluster) SetNmvRetryDelay(delay time.Duration)

SetNmvRetryDelay sets the time to wait between retrying an operation due to not my vbucket.

func (*Cluster) SetServerConnectTimeout ¶

func (c *Cluster) SetServerConnectTimeout(timeout time.Duration)

SetServerConnectTimeout sets the maximum time to attempt to connect to a single node.

func (*Cluster) SetTracer ¶ added in v1.3.4

func (c *Cluster) SetTracer(tracer opentracing.Tracer)

SetTracer allows you to specify a custom tracer to use for this cluster. EXPERIMENTAL

type ClusterAuthenticator ¶

type ClusterAuthenticator struct {
	Buckets  BucketAuthenticatorMap
	Username string
	Password string
}

ClusterAuthenticator implements an Authenticator which uses a list of buckets and passwords.

func (ClusterAuthenticator) Credentials ¶ added in v1.3.1

func (ca ClusterAuthenticator) Credentials(req AuthCredsRequest) ([]UserPassPair, error)

Credentials returns the credentials for a particular service.

type ClusterManager ¶

type ClusterManager struct {
	// contains filtered or unexported fields
}

ClusterManager provides methods for performing cluster management operations.

func (*ClusterManager) GetBuckets ¶

func (cm *ClusterManager) GetBuckets() ([]*BucketSettings, error)

GetBuckets returns a list of all active buckets on the cluster.

func (*ClusterManager) GetUser ¶ added in v1.2.4

func (cm *ClusterManager) GetUser(domain AuthDomain, name string) (*User, error)

GetUser returns the data for a particular user

func (*ClusterManager) GetUsers ¶ added in v1.2.1

func (cm *ClusterManager) GetUsers(domain AuthDomain) ([]*User, error)

GetUsers returns a list of all users on the cluster.

func (*ClusterManager) InsertBucket ¶

func (cm *ClusterManager) InsertBucket(settings *BucketSettings) error

InsertBucket creates a new bucket on the cluster.

func (*ClusterManager) RemoveBucket ¶

func (cm *ClusterManager) RemoveBucket(name string) error

RemoveBucket will delete a bucket from the cluster by name.

func (*ClusterManager) RemoveUser ¶ added in v1.2.1

func (cm *ClusterManager) RemoveUser(domain AuthDomain, name string) error

RemoveUser removes a built-in RBAC user on the cluster.

func (*ClusterManager) SearchIndexManager ¶ added in v1.3.6

func (cm *ClusterManager) SearchIndexManager() *SearchIndexManager

SearchIndexManager returns a SearchIndexManager for performing FTS index management on this cluster Experimental: This API is subject to change at any time.

func (*ClusterManager) UpdateBucket ¶

func (cm *ClusterManager) UpdateBucket(settings *BucketSettings) error

UpdateBucket will update the settings for a specific bucket on the cluster.

func (*ClusterManager) UpsertUser ¶ added in v1.2.1

func (cm *ClusterManager) UpsertUser(domain AuthDomain, name string, settings *UserSettings) error

UpsertUser updates a built-in RBAC user on the cluster.

type ConsistencyMode ¶

type ConsistencyMode int

ConsistencyMode indicates the level of data consistency desired for a query.

type CounterOp ¶

type CounterOp struct {
	Key     string
	Delta   int64
	Initial int64
	Expiry  uint32
	Cas     Cas
	Value   uint64
	Err     error
	// contains filtered or unexported fields
}

CounterOp represents a type of `BulkOp` used for Counter operations. See BulkOp.

type DataConverterFunction ¶ added in v1.5.1

type DataConverterFunction func(docBytes []byte) (interface{}, error)

DataConverterFunction is called to convert from analytics document format to kv document

type DefaultTranscoder ¶

type DefaultTranscoder struct {
}

DefaultTranscoder implements the default transcoding behaviour of all Couchbase SDKs.

func (DefaultTranscoder) Decode ¶

func (t DefaultTranscoder) Decode(bytes []byte, flags uint32, out interface{}) error

Decode applies the default Couchbase transcoding behaviour to decode into a Go type.

func (DefaultTranscoder) Encode ¶

func (t DefaultTranscoder) Encode(value interface{}) ([]byte, uint32, error)

Encode applies the default Couchbase transcoding behaviour to encode a Go type.

type DesignDocument ¶

type DesignDocument struct {
	Name         string          `json:"-"`
	Views        map[string]View `json:"views,omitempty"`
	SpatialViews map[string]View `json:"spatial,omitempty"`
}

DesignDocument represents a Couchbase design document containing multiple views.

type DiagConnState ¶ added in v1.3.3

type DiagConnState int

DiagConnState represents the state of a connection in a diagnostics report.

type DiagnosticEntry ¶ added in v1.3.3

type DiagnosticEntry struct {
	Service      ServiceType
	State        DiagConnState
	LocalAddr    string
	RemoteAddr   string
	LastActivity time.Time
}

DiagnosticEntry represents a single entry in a diagnostics report.

type DiagnosticReport ¶ added in v1.3.3

type DiagnosticReport struct {
	ConfigRev int64
	Services  []DiagnosticEntry
}

DiagnosticReport encapsulates the results of a Diagnostics operation.

func (*DiagnosticReport) MarshalJSON ¶ added in v1.3.3

func (report *DiagnosticReport) MarshalJSON() ([]byte, error)

MarshalJSON generates a JSON representation of this diagnostics report.

type DocumentFragment ¶

type DocumentFragment struct {
	// contains filtered or unexported fields
}

DocumentFragment represents multiple chunks of a full Document.

func (*DocumentFragment) Cas ¶

func (frag *DocumentFragment) Cas() Cas

Cas returns the Cas of the Document

func (*DocumentFragment) Content ¶

func (frag *DocumentFragment) Content(path string, valuePtr interface{}) error

Content retrieves the value of the operation by its path. The path is the path provided to the operation

func (*DocumentFragment) ContentByIndex ¶

func (frag *DocumentFragment) ContentByIndex(idx int, valuePtr interface{}) error

ContentByIndex retrieves the value of the operation by its index. The index is the position of the operation as it was added to the builder.

func (*DocumentFragment) Exists ¶

func (frag *DocumentFragment) Exists(path string) bool

Exists checks whether the indicated path exists in this DocumentFragment and no errors were returned from the server.

func (*DocumentFragment) MutationToken ¶

func (frag *DocumentFragment) MutationToken() MutationToken

MutationToken returns the MutationToken for the change represented by this DocumentFragment.

type GetAndTouchOp ¶

type GetAndTouchOp struct {
	Key    string
	Value  interface{}
	Expiry uint32
	Cas    Cas
	Err    error
	// contains filtered or unexported fields
}

GetAndTouchOp represents a type of `BulkOp` used for GetAndTouch operations. See BulkOp.

type GetOp ¶

type GetOp struct {
	Key   string
	Value interface{}
	Cas   Cas
	Err   error
	// contains filtered or unexported fields
}

GetOp represents a type of `BulkOp` used for Get operations. See BulkOp.

type IdGeneratorFunction ¶ added in v1.5.1

type IdGeneratorFunction func(doc interface{}) (string, error)

IdGeneratorFunction is called to create an ID for a document.

type IndexInfo ¶

type IndexInfo struct {
	Name      string    `json:"name"`
	IsPrimary bool      `json:"is_primary"`
	Type      IndexType `json:"using"`
	State     string    `json:"state"`
	Keyspace  string    `json:"keyspace_id"`
	Namespace string    `json:"namespace_id"`
	IndexKey  []string  `json:"index_key"`
}

IndexInfo represents a Couchbase GSI index.

type IndexType ¶

type IndexType string

IndexType provides information on the type of indexer used for an index.

type InsertOp ¶

type InsertOp struct {
	Key    string
	Value  interface{}
	Expiry uint32
	Cas    Cas
	Err    error
	// contains filtered or unexported fields
}

InsertOp represents a type of `BulkOp` used for Insert operations. See BulkOp.

type LogLevel ¶ added in v1.2.1

type LogLevel gocbcore.LogLevel

LogLevel specifies the severity of a log message.

type LogRedactLevel ¶ added in v1.3.4

type LogRedactLevel int

LogRedactLevel specifies the degree with which to redact the logs.

type Logger ¶ added in v1.2.1

type Logger interface {
	// Outputs logging information:
	// level is the verbosity level
	// offset is the position within the calling stack from which the message
	// originated. This is useful for contextual loggers which retrieve file/line
	// information.
	Log(level LogLevel, offset int, format string, v ...interface{}) error
}

Logger defines a logging interface. You can either use one of the default loggers (DefaultStdioLogger(), VerboseStdioLogger()) or implement your own.

func DefaultStdioLogger ¶ added in v1.2.1

func DefaultStdioLogger() Logger

DefaultStdioLogger gets the default standard I/O logger.

gocb.SetLogger(gocb.DefaultStdioLogger())

func VerboseStdioLogger ¶ added in v1.2.1

func VerboseStdioLogger() Logger

VerboseStdioLogger is a more verbose level of DefaultStdioLogger(). Messages pertaining to the scheduling of ordinary commands (and their responses) will also be emitted.

gocb.SetLogger(gocb.VerboseStdioLogger())

type LookupInBuilder ¶

type LookupInBuilder struct {
	// contains filtered or unexported fields
}

LookupInBuilder is a builder used to create a set of sub-document lookup operations.

func (*LookupInBuilder) Execute ¶

func (set *LookupInBuilder) Execute() (*DocumentFragment, error)

Execute executes this set of lookup operations on the bucket.

func (*LookupInBuilder) Exists ¶

func (set *LookupInBuilder) Exists(path string) *LookupInBuilder

Exists is similar to Get(), but does not actually retrieve the value from the server. This may save bandwidth if you only need to check for the existence of a path (without caring for its content). You can check the status of this operation by using .Content (and ignoring the value) or .Exists()

func (*LookupInBuilder) ExistsEx ¶ added in v1.2.1

func (set *LookupInBuilder) ExistsEx(path string, flags SubdocFlag) *LookupInBuilder

ExistsEx allows you to perform a sub-document Exists operation with flags

func (*LookupInBuilder) Get ¶

func (set *LookupInBuilder) Get(path string) *LookupInBuilder

Get indicates a path to be retrieved from the document. The value of the path can later be retrieved (after .Execute()) using the Content or ContentByIndex method. The path syntax follows N1QL's path syntax (e.g. `foo.bar.baz`).

func (*LookupInBuilder) GetCount ¶ added in v1.2.3

func (set *LookupInBuilder) GetCount(path string) *LookupInBuilder

GetCount allows you to retrieve the number of items in an array or keys within an dictionary within an element of a document.

func (*LookupInBuilder) GetCountEx ¶ added in v1.2.3

func (set *LookupInBuilder) GetCountEx(path string, flags SubdocFlag) *LookupInBuilder

GetCountEx allows you to perform a sub-document GetCount operation with flags

func (*LookupInBuilder) GetEx ¶ added in v1.2.1

func (set *LookupInBuilder) GetEx(path string, flags SubdocFlag) *LookupInBuilder

GetEx allows you to perform a sub-document Get operation with flags

type MultiError ¶ added in v1.2.1

type MultiError struct {
	Errors []error
}

MultiError encapsulates multiple errors that may be returned by one method.

func (*MultiError) Error ¶ added in v1.2.1

func (e *MultiError) Error() string

type MutateInBuilder ¶

type MutateInBuilder struct {
	// contains filtered or unexported fields
}

MutateInBuilder is a builder used to create a set of sub-document mutation operations.

func (*MutateInBuilder) ArrayAddUnique ¶

func (set *MutateInBuilder) ArrayAddUnique(path string, value interface{}, createParents bool) *MutateInBuilder

ArrayAddUnique adds an dictionary add unique operation to this mutation operation set.

func (*MutateInBuilder) ArrayAddUniqueEx ¶ added in v1.2.1

func (set *MutateInBuilder) ArrayAddUniqueEx(path string, value interface{}, flags SubdocFlag) *MutateInBuilder

ArrayAddUniqueEx allows you to perform a sub-document ArrayAddUnique operation with flags

func (*MutateInBuilder) ArrayAppend ¶

func (set *MutateInBuilder) ArrayAppend(path string, value interface{}, createParents bool) *MutateInBuilder

ArrayAppend adds an element to the end (i.e. right) of an array

func (*MutateInBuilder) ArrayAppendEx ¶ added in v1.2.1

func (set *MutateInBuilder) ArrayAppendEx(path string, value interface{}, flags SubdocFlag) *MutateInBuilder

ArrayAppendEx allows you to perform a sub-document ArrayAppend operation with flags

func (*MutateInBuilder) ArrayAppendMulti ¶

func (set *MutateInBuilder) ArrayAppendMulti(path string, values interface{}, createParents bool) *MutateInBuilder

ArrayAppendMulti adds multiple values as elements to an array. `values` must be an array type ArrayAppendMulti("path", []int{1,2,3,4}, true) =>

"path" [..., 1,2,3,4]

This is a more efficient version (at both the network and server levels) of doing ArrayAppend("path", 1, true).ArrayAppend("path", 2, true).ArrayAppend("path", 3, true)

See ArrayAppend() for more information

func (*MutateInBuilder) ArrayAppendMultiEx ¶ added in v1.2.1

func (set *MutateInBuilder) ArrayAppendMultiEx(path string, values interface{}, flags SubdocFlag) *MutateInBuilder

ArrayAppendMultiEx allows you to perform a sub-document ArrayAppendMulti operation with flags

func (*MutateInBuilder) ArrayInsert ¶

func (set *MutateInBuilder) ArrayInsert(path string, value interface{}) *MutateInBuilder

ArrayInsert inserts an element at a given position within an array. The position should be specified as part of the path, e.g. path.to.array[3]

func (*MutateInBuilder) ArrayInsertEx ¶ added in v1.2.1

func (set *MutateInBuilder) ArrayInsertEx(path string, value interface{}, flags SubdocFlag) *MutateInBuilder

ArrayInsertEx allows you to perform a sub-document ArrayInsert operation with flags

func (*MutateInBuilder) ArrayInsertMulti ¶

func (set *MutateInBuilder) ArrayInsertMulti(path string, values interface{}) *MutateInBuilder

ArrayInsertMulti inserts multiple elements at a specified position within the array. See ArrayAppendMulti for more information about multiple element operations, and ArrayInsert for more information about array insertion operations

func (*MutateInBuilder) ArrayInsertMultiEx ¶ added in v1.2.1

func (set *MutateInBuilder) ArrayInsertMultiEx(path string, values interface{}, flags SubdocFlag) *MutateInBuilder

ArrayInsertMultiEx allows you to perform a sub-document ArrayInsertMulti operation with flags

func (*MutateInBuilder) ArrayPrepend ¶

func (set *MutateInBuilder) ArrayPrepend(path string, value interface{}, createParents bool) *MutateInBuilder

ArrayPrepend adds an element to the beginning (i.e. left) of an array

func (*MutateInBuilder) ArrayPrependEx ¶ added in v1.2.1

func (set *MutateInBuilder) ArrayPrependEx(path string, value interface{}, flags SubdocFlag) *MutateInBuilder

ArrayPrependEx allows you to perform a sub-document ArrayPrepend operation with flags

func (*MutateInBuilder) ArrayPrependMulti ¶

func (set *MutateInBuilder) ArrayPrependMulti(path string, values interface{}, createParents bool) *MutateInBuilder

ArrayPrependMulti adds multiple values at the beginning of an array. See ArrayAppendMulti for more information about multiple element operations and ArrayPrepend for the semantics of this operation

func (*MutateInBuilder) ArrayPrependMultiEx ¶ added in v1.2.1

func (set *MutateInBuilder) ArrayPrependMultiEx(path string, values interface{}, flags SubdocFlag) *MutateInBuilder

ArrayPrependMultiEx allows you to perform a sub-document ArrayPrependMulti operation with flags

func (*MutateInBuilder) Counter ¶

func (set *MutateInBuilder) Counter(path string, delta int64, createParents bool) *MutateInBuilder

Counter adds an counter operation to this mutation operation set.

func (*MutateInBuilder) CounterEx ¶ added in v1.2.1

func (set *MutateInBuilder) CounterEx(path string, delta int64, flags SubdocFlag) *MutateInBuilder

CounterEx allows you to perform a sub-document Counter operation with flags

func (*MutateInBuilder) Execute ¶

func (set *MutateInBuilder) Execute() (*DocumentFragment, error)

Execute executes this set of mutation operations on the bucket.

func (*MutateInBuilder) Insert ¶

func (set *MutateInBuilder) Insert(path string, value interface{}, createParents bool) *MutateInBuilder

Insert adds an insert operation to this mutation operation set.

func (*MutateInBuilder) InsertEx ¶ added in v1.2.1

func (set *MutateInBuilder) InsertEx(path string, value interface{}, flags SubdocFlag) *MutateInBuilder

InsertEx allows you to perform a sub-document Insert operation with flags

func (*MutateInBuilder) Remove ¶

func (set *MutateInBuilder) Remove(path string) *MutateInBuilder

Remove adds an remove operation to this mutation operation set.

func (*MutateInBuilder) RemoveEx ¶ added in v1.2.1

func (set *MutateInBuilder) RemoveEx(path string, flags SubdocFlag) *MutateInBuilder

RemoveEx allows you to perform a sub-document Remove operation with flags

func (*MutateInBuilder) Replace ¶

func (set *MutateInBuilder) Replace(path string, value interface{}) *MutateInBuilder

Replace adds an replace operation to this mutation operation set.

func (*MutateInBuilder) ReplaceEx ¶ added in v1.2.1

func (set *MutateInBuilder) ReplaceEx(path string, value interface{}, flags SubdocFlag) *MutateInBuilder

ReplaceEx allows you to perform a sub-document Replace operation with flags

func (*MutateInBuilder) Upsert ¶

func (set *MutateInBuilder) Upsert(path string, value interface{}, createParents bool) *MutateInBuilder

Upsert adds an upsert operation to this mutation operation set.

func (*MutateInBuilder) UpsertEx ¶ added in v1.2.1

func (set *MutateInBuilder) UpsertEx(path string, value interface{}, flags SubdocFlag) *MutateInBuilder

UpsertEx allows you to perform a sub-document Upsert operation with flags

type MutationState ¶

type MutationState struct {
	// contains filtered or unexported fields
}

MutationState holds and aggregates MutationToken's across multiple operations.

func NewMutationState ¶

func NewMutationState(tokens ...MutationToken) *MutationState

NewMutationState creates a new MutationState for tracking mutation state.

func (*MutationState) Add ¶

func (mt *MutationState) Add(tokens ...MutationToken)

Add includes an operation's mutation information in this mutation state.

func (*MutationState) MarshalJSON ¶

func (mt *MutationState) MarshalJSON() ([]byte, error)

MarshalJSON marshal's this mutation state to JSON.

func (*MutationState) UnmarshalJSON ¶

func (mt *MutationState) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal's a mutation state from JSON.

type MutationToken ¶

type MutationToken struct {
	// contains filtered or unexported fields
}

MutationToken holds the mutation state information from an operation.

type N1qlQuery ¶

type N1qlQuery struct {
	// contains filtered or unexported fields
}

N1qlQuery represents a pending N1QL query.

func NewN1qlQuery ¶

func NewN1qlQuery(statement string) *N1qlQuery

NewN1qlQuery creates a new N1qlQuery object from a query string.

func (*N1qlQuery) AdHoc ¶

func (nq *N1qlQuery) AdHoc(adhoc bool) *N1qlQuery

AdHoc specifies that this query is adhoc and should not be prepared.

func (*N1qlQuery) Consistency ¶

func (nq *N1qlQuery) Consistency(stale ConsistencyMode) *N1qlQuery

Consistency specifies the level of consistency required for this query.

func (*N1qlQuery) ConsistentWith ¶

func (nq *N1qlQuery) ConsistentWith(state *MutationState) *N1qlQuery

ConsistentWith specifies a mutation state to be consistent with for this query.

func (*N1qlQuery) Custom ¶

func (nq *N1qlQuery) Custom(name string, value interface{}) *N1qlQuery

Custom allows specifying custom query options.

func (*N1qlQuery) PipelineBatch ¶ added in v1.2.5

func (nq *N1qlQuery) PipelineBatch(pipelineBatch int) *N1qlQuery

PipelineBatch controls the number of items execution operators can batch for fetch from the KV node.

func (*N1qlQuery) PipelineCap ¶ added in v1.2.5

func (nq *N1qlQuery) PipelineCap(pipelineCap int) *N1qlQuery

PipelineCap controls the maximum number of items each execution operator can buffer between various operators.

func (*N1qlQuery) Profile ¶ added in v1.3.4

func (nq *N1qlQuery) Profile(profileMode QueryProfileType) *N1qlQuery

Profile specifies a profiling mode to use for this N1QL query.

func (*N1qlQuery) ReadOnly ¶ added in v1.2.5

func (nq *N1qlQuery) ReadOnly(readOnly bool) *N1qlQuery

ReadOnly controls whether a query can change a resulting recordset. If readonly is true, then only SELECT statements are permitted.

func (*N1qlQuery) ScanCap ¶ added in v1.2.5

func (nq *N1qlQuery) ScanCap(scanCap int) *N1qlQuery

ScanCap specifies the maximum buffered channel size between the indexer client and the query service for index scans. This parameter controls when to use scan backfill. Use 0 or a negative number to disable.

func (*N1qlQuery) Timeout ¶

func (nq *N1qlQuery) Timeout(timeout time.Duration) *N1qlQuery

Timeout indicates the maximum time to wait for this query to complete.

type PasswordAuthenticator ¶ added in v1.2.3

type PasswordAuthenticator struct {
	Username string
	Password string
}

PasswordAuthenticator implements an Authenticator which uses an RBAC username and password.

func (PasswordAuthenticator) Credentials ¶ added in v1.3.1

func (ra PasswordAuthenticator) Credentials(req AuthCredsRequest) ([]UserPassPair, error)

Credentials returns the credentials for a particular service.

type PingReport ¶ added in v1.3.3

type PingReport struct {
	Services []PingServiceEntry
}

PingReport encapsulates the details from a executed ping operation.

func (*PingReport) MarshalJSON ¶ added in v1.3.3

func (report *PingReport) MarshalJSON() ([]byte, error)

MarshalJSON generates a JSON representation of this ping report.

type PingServiceEntry ¶ added in v1.3.3

type PingServiceEntry struct {
	Service  ServiceType
	Endpoint string
	Success  bool
	Latency  time.Duration
}

PingServiceEntry represents a single entry in a ping report.

type PrependOp ¶

type PrependOp struct {
	Key   string
	Value string
	Cas   Cas
	Err   error
	// contains filtered or unexported fields
}

PrependOp represents a type of `BulkOp` used for Prepend operations. See BulkOp.

type QueryDelayRetryBehavior ¶ added in v1.4.2

type QueryDelayRetryBehavior struct {
	// contains filtered or unexported fields
}

QueryDelayRetryBehavior provides the behavior to use when retrying queries with a backoff delay

func NewQueryDelayRetryBehavior ¶ added in v1.4.2

func NewQueryDelayRetryBehavior(maxRetries uint, retryDelay uint, delayLimit time.Duration, delayFunc QueryRetryDelayFunction) *QueryDelayRetryBehavior

NewQueryDelayRetryBehavior provides a QueryDelayRetryBehavior that will retry at most maxRetries number of times and with an initial retry delay of retryDelay (ms) up to a maximum delay of delayLimit

func (*QueryDelayRetryBehavior) CanRetry ¶ added in v1.4.2

func (rb *QueryDelayRetryBehavior) CanRetry(retries uint) bool

CanRetry determines whether or not the query can be retried according to the behavior

func (*QueryDelayRetryBehavior) NextInterval ¶ added in v1.4.2

func (rb *QueryDelayRetryBehavior) NextInterval(retries uint) time.Duration

NextInterval calculates what the next retry interval (ms) should be given how many retries there have been already

type QueryProfileType ¶ added in v1.3.4

type QueryProfileType string

QueryProfileType specifies the profiling mode to use during a query.

type QueryResultMetrics ¶

type QueryResultMetrics struct {
	ElapsedTime   time.Duration
	ExecutionTime time.Duration
	ResultCount   uint
	ResultSize    uint
	MutationCount uint
	SortCount     uint
	ErrorCount    uint
	WarningCount  uint
}

QueryResultMetrics encapsulates various metrics gathered during a queries execution.

type QueryResults ¶

type QueryResults interface {
	One(valuePtr interface{}) error
	Next(valuePtr interface{}) bool
	NextBytes() []byte
	Close() error

	RequestId() string
	ClientContextId() string
	Metrics() QueryResultMetrics

	// SourceAddr returns the source endpoint where the request was sent to.
	// VOLATILE
	SourceEndpoint() string
}

QueryResults allows access to the results of a N1QL query.

type QueryRetryBehavior ¶ added in v1.4.2

type QueryRetryBehavior interface {
	NextInterval(retries uint) time.Duration
	CanRetry(retries uint) bool
}

QueryRetryBehavior defines the behavior to be used when retrying queries

type QueryRetryDelayFunction ¶ added in v1.4.2

type QueryRetryDelayFunction func(retryDelay uint, retries uint) time.Duration

QueryRetryDelayFunction is called to get the next try delay

type RemoveOp ¶

type RemoveOp struct {
	Key string
	Cas Cas
	Err error
	// contains filtered or unexported fields
}

RemoveOp represents a type of `BulkOp` used for Remove operations. See BulkOp.

type ReplaceOp ¶

type ReplaceOp struct {
	Key    string
	Value  interface{}
	Expiry uint32
	Cas    Cas
	Err    error
	// contains filtered or unexported fields
}

ReplaceOp represents a type of `BulkOp` used for Replace operations. See BulkOp.

type SearchHighlightStyle ¶

type SearchHighlightStyle string

SearchHighlightStyle indicates the type of highlighting to use for a search query.

type SearchIndexDefinitionBuilder ¶ added in v1.3.6

type SearchIndexDefinitionBuilder struct {
	// contains filtered or unexported fields
}

SearchIndexDefinitionBuilder provides methods for building a Couchbase FTS index.

func (*SearchIndexDefinitionBuilder) AddField ¶ added in v1.3.6

func (b *SearchIndexDefinitionBuilder) AddField(name string, value interface{}) *SearchIndexDefinitionBuilder

AddField adds a field with the specified name to the Couchbase FTS index being built

type SearchIndexManager ¶ added in v1.3.6

type SearchIndexManager struct {
	// contains filtered or unexported fields
}

SearchIndexManager provides methods for performing Couchbase FTS index management. Experimental: This API is subject to change at any time.

func (*SearchIndexManager) CreateIndex ¶ added in v1.3.6

func (sim *SearchIndexManager) CreateIndex(builder SearchIndexDefinitionBuilder) error

CreateIndex creates a FTS index with the specific definition.

func (*SearchIndexManager) DeleteIndex ¶ added in v1.3.6

func (sim *SearchIndexManager) DeleteIndex(indexName string) (bool, error)

DeleteIndex removes the FTS index with the specific name.

func (*SearchIndexManager) GetAllIndexDefinitions ¶ added in v1.3.7

func (sim *SearchIndexManager) GetAllIndexDefinitions() ([]interface{}, error)

GetAllIndexDefinitions retrieves all of the FTS indexes for the cluster.

func (*SearchIndexManager) GetAllIndexPartitionInfo ¶ added in v1.3.6

func (sim *SearchIndexManager) GetAllIndexPartitionInfo() (interface{}, error)

GetAllIndexPartitionInfo retrieves all index partition information.

func (*SearchIndexManager) GetAllIndexStats ¶ added in v1.3.6

func (sim *SearchIndexManager) GetAllIndexStats() (interface{}, error)

GetAllIndexStats retrieves all search index stats.

func (*SearchIndexManager) GetIndexDefinition ¶ added in v1.3.7

func (sim *SearchIndexManager) GetIndexDefinition(indexName string) (interface{}, error)

GetIndexDefinition retrieves a specific FTS index by name.

func (*SearchIndexManager) GetIndexPartitionIndexedDocumentCount ¶ added in v1.3.6

func (sim *SearchIndexManager) GetIndexPartitionIndexedDocumentCount(pIndexName string) (int, error)

GetIndexPartitionIndexedDocumentCount retrieves a specific index partition document count.

func (*SearchIndexManager) GetIndexPartitionInfo ¶ added in v1.3.6

func (sim *SearchIndexManager) GetIndexPartitionInfo(pIndexName string) (interface{}, error)

GetIndexPartitionInfo retrieves a specific index partition information.

func (*SearchIndexManager) GetIndexStats ¶ added in v1.3.6

func (sim *SearchIndexManager) GetIndexStats(indexName string) (interface{}, error)

GetIndexStats retrieves search index stats for the specified index.

func (*SearchIndexManager) GetIndexedDocumentCount ¶ added in v1.3.6

func (sim *SearchIndexManager) GetIndexedDocumentCount(indexName string) (int, error)

GetIndexedDocumentCount retrieves the document count for a FTS index.

func (*SearchIndexManager) SetIndexIngestion ¶ added in v1.3.6

func (sim *SearchIndexManager) SetIndexIngestion(indexName string, op string) (bool, error)

SetIndexIngestion sets the FTS index ingestion state.

func (*SearchIndexManager) SetIndexPlanFreeze ¶ added in v1.3.6

func (sim *SearchIndexManager) SetIndexPlanFreeze(indexName string, op string) (bool, error)

SetIndexPlanFreeze sets the FTS index plan freeze state.

func (*SearchIndexManager) SetIndexQuerying ¶ added in v1.3.6

func (sim *SearchIndexManager) SetIndexQuerying(indexName string, op string) (bool, error)

SetIndexQuerying sets the FTS index querying ability state.

type SearchQuery ¶

type SearchQuery struct {
	// contains filtered or unexported fields
}

SearchQuery represents a pending search query.

func NewSearchQuery ¶

func NewSearchQuery(indexName string, query interface{}) *SearchQuery

NewSearchQuery creates a new SearchQuery object from an index name and query.

func (*SearchQuery) AddFacet ¶

func (sq *SearchQuery) AddFacet(name string, facet interface{}) *SearchQuery

AddFacet adds a new search facet to include in the results.

func (*SearchQuery) Consistency ¶

func (sq *SearchQuery) Consistency(stale ConsistencyMode) *SearchQuery

Consistency specifies the level of consistency required for this query.

func (*SearchQuery) ConsistentWith ¶

func (sq *SearchQuery) ConsistentWith(state *MutationState) *SearchQuery

ConsistentWith specifies a mutation state to be consistent with for this query.

func (*SearchQuery) Explain ¶

func (sq *SearchQuery) Explain(value bool) *SearchQuery

Explain enables search query explanation which provides details on how a query is executed.

func (*SearchQuery) Fields ¶

func (sq *SearchQuery) Fields(fields ...string) *SearchQuery

Fields specifies which fields you wish to return in the results.

func (*SearchQuery) Highlight ¶

func (sq *SearchQuery) Highlight(style SearchHighlightStyle, fields ...string) *SearchQuery

Highlight specifies how to highlight the hits in the search result.

func (*SearchQuery) Limit ¶

func (sq *SearchQuery) Limit(value int) *SearchQuery

Limit specifies a limit on the number of results to return.

func (*SearchQuery) Skip ¶

func (sq *SearchQuery) Skip(value int) *SearchQuery

Skip specifies how many results to skip at the beginning of the result list.

func (*SearchQuery) Sort ¶

func (sq *SearchQuery) Sort(fields ...interface{}) *SearchQuery

Sort specifies a sorting order for the results. Only available in Couchbase Server 4.6+.

func (*SearchQuery) Timeout ¶

func (sq *SearchQuery) Timeout(value time.Duration) *SearchQuery

Timeout indicates the maximum time to wait for this query to complete.

type SearchResultDateFacet ¶

type SearchResultDateFacet struct {
	Name  string `json:"name,omitempty"`
	Min   string `json:"min,omitempty"`
	Max   string `json:"max,omitempty"`
	Count int    `json:"count,omitempty"`
}

SearchResultDateFacet holds the results of a date facet in search results.

type SearchResultFacet ¶

type SearchResultFacet struct {
	Field         string                     `json:"field,omitempty"`
	Total         int                        `json:"total,omitempty"`
	Missing       int                        `json:"missing,omitempty"`
	Other         int                        `json:"other,omitempty"`
	Terms         []SearchResultTermFacet    `json:"terms,omitempty"`
	NumericRanges []SearchResultNumericFacet `json:"numeric_ranges,omitempty"`
	DateRanges    []SearchResultDateFacet    `json:"date_ranges,omitempty"`
}

SearchResultFacet holds the results of a specified facet in search results.

type SearchResultHit ¶

type SearchResultHit struct {
	Index       string                                       `json:"index,omitempty"`
	Id          string                                       `json:"id,omitempty"`
	Score       float64                                      `json:"score,omitempty"`
	Explanation map[string]interface{}                       `json:"explanation,omitempty"`
	Locations   map[string]map[string][]SearchResultLocation `json:"locations,omitempty"`
	Fragments   map[string][]string                          `json:"fragments,omitempty"`
	Fields      map[string]string                            `json:"fields,omitempty"`
}

SearchResultHit holds a single hit in a list of search results.

type SearchResultLocation ¶

type SearchResultLocation struct {
	Position       int    `json:"position,omitempty"`
	Start          int    `json:"start,omitempty"`
	End            int    `json:"end,omitempty"`
	ArrayPositions []uint `json:"array_positions,omitempty"`
}

SearchResultLocation holds the location of a hit in a list of search results.

type SearchResultNumericFacet ¶

type SearchResultNumericFacet struct {
	Name  string  `json:"name,omitempty"`
	Min   float64 `json:"min,omitempty"`
	Max   float64 `json:"max,omitempty"`
	Count int     `json:"count,omitempty"`
}

SearchResultNumericFacet holds the results of a numeric facet in search results.

type SearchResultStatus ¶

type SearchResultStatus struct {
	Total      int `json:"total,omitempty"`
	Failed     int `json:"failed,omitempty"`
	Successful int `json:"successful,omitempty"`
}

SearchResultStatus holds the status information for an executed search query.

type SearchResultTermFacet ¶

type SearchResultTermFacet struct {
	Term  string `json:"term,omitempty"`
	Count int    `json:"count,omitempty"`
}

SearchResultTermFacet holds the results of a term facet in search results.

type SearchResults ¶

type SearchResults interface {
	Status() SearchResultStatus
	Errors() []string
	TotalHits() int
	Hits() []SearchResultHit
	Facets() map[string]SearchResultFacet
	Took() time.Duration
	MaxScore() float64
}

SearchResults allows access to the results of a search query.

type ServerStats ¶

type ServerStats map[string]map[string]string

ServerStats is a tree of statistics information returned from the server.

stats := cb.Stats(...)
for server := stats {
    for statName, stat := server {
    //...
    }
}

type ServiceType ¶ added in v1.3.1

type ServiceType gocbcore.ServiceType

ServiceType specifies a particular Couchbase service type.

type SortOrder ¶

type SortOrder int

SortOrder specifies the ordering for the view queries results.

type SpatialQuery ¶

type SpatialQuery struct {
	// contains filtered or unexported fields
}

SpatialQuery represents a pending spatial query.

func NewSpatialQuery ¶

func NewSpatialQuery(ddoc, name string) *SpatialQuery

NewSpatialQuery creates a new SpatialQuery object from a design document and view name.

func (*SpatialQuery) Bbox ¶

func (vq *SpatialQuery) Bbox(bounds []float64) *SpatialQuery

Bbox specifies the bounding region to use for the spatial query.

func (*SpatialQuery) Custom ¶

func (vq *SpatialQuery) Custom(name, value string) *SpatialQuery

Custom allows specifying custom query options.

func (*SpatialQuery) Development ¶

func (vq *SpatialQuery) Development(val bool) *SpatialQuery

Development specifies whether to query the production or development design document.

func (*SpatialQuery) Limit ¶

func (vq *SpatialQuery) Limit(num uint) *SpatialQuery

Limit specifies a limit on the number of results to return.

func (*SpatialQuery) Skip ¶

func (vq *SpatialQuery) Skip(num uint) *SpatialQuery

Skip specifies how many results to skip at the beginning of the result list.

func (*SpatialQuery) Stale ¶

func (vq *SpatialQuery) Stale(stale StaleMode) *SpatialQuery

Stale specifies the level of consistency required for this query.

type StaleMode ¶

type StaleMode int

StaleMode specifies the consistency required for a view query.

type StreamingBucket ¶

type StreamingBucket struct {
	// contains filtered or unexported fields
}

StreamingBucket represents a bucket connection used for streaming data over DCP.

func (*StreamingBucket) IoRouter ¶

func (b *StreamingBucket) IoRouter() *gocbcore.Agent

IoRouter returns the underlying gocb agent managing connections.

type SubdocDocFlag ¶ added in v1.2.3

type SubdocDocFlag gocbcore.SubdocDocFlag

SubdocDocFlag specifies document-level flags for a sub-document operation.

type SubdocFlag ¶ added in v1.2.1

type SubdocFlag gocbcore.SubdocFlag

SubdocFlag provides special handling flags for sub-document operations

type ThresholdLoggingTracer ¶ added in v1.3.4

type ThresholdLoggingTracer struct {
	Interval           time.Duration
	SampleSize         uint32
	KvThreshold        time.Duration
	ViewsThreshold     time.Duration
	N1qlThreshold      time.Duration
	SearchThreshold    time.Duration
	AnalyticsThreshold time.Duration
	// contains filtered or unexported fields
}

ThresholdLoggingTracer is a specialized Tracer implementation which will automatically log operations which fall outside of a set of thresholds. Note that this tracer is only safe for use within the Couchbase SDK, uses by external event sources are likely to fail. EXPERIMENTAL

func (*ThresholdLoggingTracer) AddRef ¶ added in v1.3.4

func (t *ThresholdLoggingTracer) AddRef() int32

AddRef is used internally to keep track of the number of Cluster instances referring to it. This is used to correctly shut down the aggregation routines once there are no longer any instances tracing to it.

func (*ThresholdLoggingTracer) DecRef ¶ added in v1.3.4

func (t *ThresholdLoggingTracer) DecRef() int32

DecRef is the counterpart to AddRef (see AddRef for more information).

func (*ThresholdLoggingTracer) Extract ¶ added in v1.3.4

func (t *ThresholdLoggingTracer) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)

Extract belongs to the Tracer interface.

func (*ThresholdLoggingTracer) Inject ¶ added in v1.3.4

func (t *ThresholdLoggingTracer) Inject(sp opentracing.SpanContext, format interface{}, carrier interface{}) error

Inject belongs to the Tracer interface.

func (*ThresholdLoggingTracer) StartSpan ¶ added in v1.3.4

func (t *ThresholdLoggingTracer) StartSpan(operationName string, opts ...opentracing.StartSpanOption) opentracing.Span

StartSpan belongs to the Tracer interface.

type TouchOp ¶

type TouchOp struct {
	Key    string
	Expiry uint32
	Cas    Cas
	Err    error
	// contains filtered or unexported fields
}

TouchOp represents a type of `BulkOp` used for Touch operations. See BulkOp.

type Transcoder ¶

type Transcoder interface {
	// Decodes retrieved bytes into a Go type.
	Decode([]byte, uint32, interface{}) error

	// Encodes a Go type into bytes for storage.
	Encode(interface{}) ([]byte, uint32, error)
}

Transcoder provides an interface for transforming Go values to and from raw bytes for storage and retreival from Couchbase data storage.

type UpsertOp ¶

type UpsertOp struct {
	Key    string
	Value  interface{}
	Expiry uint32
	Cas    Cas
	Err    error
	// contains filtered or unexported fields
}

UpsertOp represents a type of `BulkOp` used for Upsert operations. See BulkOp.

type User ¶ added in v1.2.1

type User struct {
	Id    string
	Name  string
	Type  string
	Roles []UserRole
}

User represents a user which was retrieved from the server.

type UserPassPair ¶ added in v1.3.1

type UserPassPair gocbcore.UserPassPair

UserPassPair represents a username and password pair.

type UserRole ¶ added in v1.2.1

type UserRole struct {
	Role       string
	BucketName string
}

UserRole represents a role for a particular user on the server.

type UserSettings ¶ added in v1.2.1

type UserSettings struct {
	Name     string
	Password string
	Roles    []UserRole
}

UserSettings represents a user during user creation.

type View ¶

type View struct {
	Map    string `json:"map,omitempty"`
	Reduce string `json:"reduce,omitempty"`
}

View represents a Couchbase view within a design document.

type ViewQuery ¶

type ViewQuery struct {
	// contains filtered or unexported fields
}

ViewQuery represents a pending view query.

func NewViewQuery ¶

func NewViewQuery(ddoc, name string) *ViewQuery

NewViewQuery creates a new ViewQuery object from a design document and view name.

func (*ViewQuery) Custom ¶

func (vq *ViewQuery) Custom(name, value string) *ViewQuery

Custom allows specifying custom query options.

func (*ViewQuery) Development ¶

func (vq *ViewQuery) Development(val bool) *ViewQuery

Development specifies whether to query the production or development design document.

func (*ViewQuery) Group ¶

func (vq *ViewQuery) Group(useGrouping bool) *ViewQuery

Group specifies whether to group the map-reduce results.

func (*ViewQuery) GroupLevel ¶

func (vq *ViewQuery) GroupLevel(groupLevel uint) *ViewQuery

GroupLevel specifies at what level to group the map-reduce results.

func (*ViewQuery) IdRange ¶

func (vq *ViewQuery) IdRange(start, end string) *ViewQuery

IdRange specifies a range of document id's to get results within. Usually requires Range to be specified as well.

func (*ViewQuery) Key ¶

func (vq *ViewQuery) Key(key interface{}) *ViewQuery

Key specifies a specific key to retrieve from the index.

func (*ViewQuery) Keys ¶

func (vq *ViewQuery) Keys(keys []interface{}) *ViewQuery

Keys specifies a list of specific keys to retrieve from the index.

func (*ViewQuery) Limit ¶

func (vq *ViewQuery) Limit(num uint) *ViewQuery

Limit specifies a limit on the number of results to return.

func (*ViewQuery) Order ¶

func (vq *ViewQuery) Order(order SortOrder) *ViewQuery

Order specifies the order to sort the view results in.

func (*ViewQuery) Range ¶

func (vq *ViewQuery) Range(start, end interface{}, inclusiveEnd bool) *ViewQuery

Range specifies a value range to get results within.

func (*ViewQuery) Reduce ¶

func (vq *ViewQuery) Reduce(reduce bool) *ViewQuery

Reduce specifies whether to run the reduce part of the map-reduce.

func (*ViewQuery) Skip ¶

func (vq *ViewQuery) Skip(num uint) *ViewQuery

Skip specifies how many results to skip at the beginning of the result list.

func (*ViewQuery) Stale ¶

func (vq *ViewQuery) Stale(stale StaleMode) *ViewQuery

Stale specifies the level of consistency required for this query.

type ViewResultMetrics ¶ added in v1.2.2

type ViewResultMetrics interface {
	TotalRows() int
}

ViewResultMetrics allows access to the TotalRows value from the view response. This is implemented as an additional interface to maintain ABI compatibility for the 1.x series.

type ViewResults ¶

type ViewResults interface {
	One(valuePtr interface{}) error
	Next(valuePtr interface{}) bool
	NextBytes() []byte
	Close() error
}

ViewResults implements an iterator interface which can be used to iterate over the rows of the query results.

Directories ¶

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL