diff --git a/change-notes/2021-01-12-model-couchbase.md b/change-notes/2021-01-12-model-couchbase.md new file mode 100644 index 00000000000..77e0973cdff --- /dev/null +++ b/change-notes/2021-01-12-model-couchbase.md @@ -0,0 +1,2 @@ +lgtm,codescanning +* Added support for [the offical Couchbase Go SDK library](https://github.com/couchbase/gocb), v1 and v2. The `go/sql-injection` query (which also handles non-SQL databases such as Couchbase) will now identify Couchbase queries built from untrusted external input. diff --git a/ql/src/go.qll b/ql/src/go.qll index 8277c93ea96..85f99b3c774 100644 --- a/ql/src/go.qll +++ b/ql/src/go.qll @@ -32,6 +32,7 @@ import semmle.go.dataflow.TaintTracking2 import semmle.go.frameworks.Beego import semmle.go.frameworks.BeegoOrm import semmle.go.frameworks.Chi +import semmle.go.frameworks.Couchbase import semmle.go.frameworks.Echo import semmle.go.frameworks.Email import semmle.go.frameworks.Encoding diff --git a/ql/src/semmle/go/frameworks/Couchbase.qll b/ql/src/semmle/go/frameworks/Couchbase.qll new file mode 100644 index 00000000000..7d339c197c7 --- /dev/null +++ b/ql/src/semmle/go/frameworks/Couchbase.qll @@ -0,0 +1,99 @@ +/** + * Provides models of commonly used functions in the official Couchbase Go SDK library. + */ + +import go + +/** + * Provides models of commonly used functions in the official Couchbase Go SDK library. + */ +module Couchbase { + /** + * Gets a package path for the official Couchbase Go SDK library. + * + * Note that v1 and v2 have different APIs, but the names are disjoint so there is no need to + * distinguish between them. + */ + bindingset[result] + string packagePath() { + result = + package([ + "gopkg.in/couchbase/gocb", "github.com/couchbase/gocb", "github.com/couchbaselabs/gocb" + ], "") + } + + /** + * Models of methods on `gocb/AnalyticsQuery` and `gocb/N1qlQuery` which which support a fluent + * interface by returning the receiver. They are not inherently relevant to taint. + */ + private class QueryMethodV1 extends TaintTracking::FunctionModel, Method { + QueryMethodV1() { + exists(string queryTypeName, string methodName | + queryTypeName = "AnalyticsQuery" and + methodName in [ + "ContextId", "Deferred", "Pretty", "Priority", "RawParam", "ServerSideTimeout" + ] + or + queryTypeName = "N1qlQuery" and + methodName in [ + "AdHoc", "Consistency", "ConsistentWith", "Custom", "PipelineBatch", "PipelineCap", + "Profile", "ReadOnly", "ScanCap", "Timeout" + ] + | + this.hasQualifiedName(packagePath(), queryTypeName, methodName) + ) + } + + override predicate hasTaintFlow(FunctionInput inp, FunctionOutput outp) { + inp.isReceiver() and outp.isResult() + } + } + + private class QueryFromN1qlStatementV1 extends TaintTracking::FunctionModel { + QueryFromN1qlStatementV1() { + this.hasQualifiedName(packagePath(), ["NewAnalyticsQuery", "NewN1qlQuery"]) + } + + override predicate hasTaintFlow(FunctionInput inp, FunctionOutput outp) { + inp.isParameter(0) and outp.isResult() + } + } + + /** + * A query used in an API function acting on a `Bucket` or `Cluster` struct of v1 of + * the official Couchbase Go library, gocb. + */ + private class CouchbaseV1Query extends NoSQL::Query::Range { + CouchbaseV1Query() { + // func (b *Bucket) ExecuteAnalyticsQuery(q *AnalyticsQuery, params interface{}) (AnalyticsResults, error) + // func (b *Bucket) ExecuteN1qlQuery(q *N1qlQuery, params interface{}) (QueryResults, error) + // func (c *Cluster) ExecuteAnalyticsQuery(q *AnalyticsQuery, params interface{}) (AnalyticsResults, error) + // func (c *Cluster) ExecuteN1qlQuery(q *N1qlQuery, params interface{}) (QueryResults, error) + exists(Method meth, string structName, string methodName | + structName in ["Bucket", "Cluster"] and + methodName in ["ExecuteN1qlQuery", "ExecuteAnalyticsQuery"] and + meth.hasQualifiedName(packagePath(), structName, methodName) and + this = meth.getACall().getArgument(0) + ) + } + } + + /** + * A query used in an API function acting on a `Bucket` or `Cluster` struct of v1 of + * the official Couchbase Go library, gocb. + */ + private class CouchbaseV2Query extends NoSQL::Query::Range { + CouchbaseV2Query() { + // func (c *Cluster) AnalyticsQuery(statement string, opts *AnalyticsOptions) (*AnalyticsResult, error) + // func (c *Cluster) Query(statement string, opts *QueryOptions) (*QueryResult, error) + // func (s *Scope) AnalyticsQuery(statement string, opts *AnalyticsOptions) (*AnalyticsResult, error) + // func (s *Scope) Query(statement string, opts *QueryOptions) (*QueryResult, error) + exists(Method meth, string structName, string methodName | + structName in ["Cluster", "Scope"] and + methodName in ["AnalyticsQuery", "Query"] and + meth.hasQualifiedName(packagePath(), structName, methodName) and + this = meth.getACall().getArgument(0) + ) + } + } +} diff --git a/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/go.mod b/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/go.mod new file mode 100644 index 00000000000..5ebbf7d20ee --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/go.mod @@ -0,0 +1,17 @@ +go 1.14 + +module test + +require ( + github.com/golang/snappy v0.0.2 // indirect + github.com/google/uuid v1.1.4 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + golang.org/x/net v0.0.0-20201224014010-6772e930b67b // indirect + golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 // indirect + gopkg.in/couchbase/gocb.v1 v1.6.7 + gopkg.in/couchbase/gocbcore.v7 v7.1.18 // indirect + gopkg.in/couchbaselabs/gocbconnstr.v1 v1.0.4 // indirect + gopkg.in/couchbaselabs/gojcbmock.v1 v1.0.4 // indirect + gopkg.in/couchbaselabs/jsonx.v1 v1.0.0 // indirect +) diff --git a/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/test.expected b/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/test.expected new file mode 100644 index 00000000000..e69de29bb2d diff --git a/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/test.go b/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/test.go new file mode 100644 index 00000000000..f81ff812b35 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/test.go @@ -0,0 +1,40 @@ +package test + +//go:generate depstubber -vendor gopkg.in/couchbase/gocb.v1 Bucket,Cluster NewAnalyticsQuery,NewN1qlQuery,QueryProfileNone,StatementPlus + +import ( + "net/http" + "time" + + "gopkg.in/couchbase/gocb.v1" +) + +func analyticsQuery(bucket gocb.Bucket, untrustedSource *http.Request) { + untrusted := untrustedSource.UserAgent() + q0 := gocb.NewAnalyticsQuery(untrusted) + q1 := q0.ContextId("") + q2 := q1.Deferred(true) + q3 := q2.Pretty(true) + q4 := q3.Priority(true) + q5 := q4.RawParam("name", nil) + duration, _ := time.ParseDuration("300s") + q6 := q5.ServerSideTimeout(duration) + bucket.ExecuteAnalyticsQuery(q6, nil) // $sqlinjection=q6 +} + +func n1qlQuery(cluster gocb.Cluster, untrustedSource *http.Request) { + untrusted := untrustedSource.UserAgent() + q0 := gocb.NewN1qlQuery(untrusted) + q1 := q0.AdHoc(true) + q2 := q1.Consistency(gocb.StatementPlus) + q3 := q2.ConsistentWith(&gocb.MutationState{}) + q4 := q3.Custom("name", nil) + q5 := q4.PipelineBatch(2) + q6 := q5.PipelineCap(5) + q7 := q6.Profile(gocb.QueryProfileNone) + q8 := q7.ReadOnly(false) + q9 := q8.ScanCap(10) + duration, _ := time.ParseDuration("300s") + q10 := q9.Timeout(duration) + cluster.ExecuteN1qlQuery(q10, nil) // $sqlinjection=q10 +} diff --git a/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/test.ql b/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/test.ql new file mode 100644 index 00000000000..505d4a1360f --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/test.ql @@ -0,0 +1,18 @@ +import go +import TestUtilities.InlineExpectationsTest +import semmle.go.security.SqlInjection + +class SqlInjectionTest extends InlineExpectationsTest { + SqlInjectionTest() { this = "SqlInjectionTest" } + + override string getARelevantTag() { result = "sqlinjection" } + + override predicate hasActualResult(string file, int line, string element, string tag, string value) { + tag = "sqlinjection" and + exists(DataFlow::Node sink | any(SqlInjection::Configuration c).hasFlow(_, sink) | + element = sink.toString() and + value = sink.toString() and + sink.hasLocationInfo(file, line, _, _, _) + ) + } +} diff --git a/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/vendor/gopkg.in/couchbase/gocb.v1/stub.go b/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/vendor/gopkg.in/couchbase/gocb.v1/stub.go new file mode 100644 index 00000000000..eb6b180faec --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/vendor/gopkg.in/couchbase/gocb.v1/stub.go @@ -0,0 +1,1285 @@ +// Code generated by depstubber. DO NOT EDIT. +// This is a simple stub for gopkg.in/couchbase/gocb.v1, strictly for use in testing. + +// See the LICENSE file for information about the licensing of the original library. +// Source: gopkg.in/couchbase/gocb.v1 (exports: Bucket,Cluster; functions: NewAnalyticsQuery,NewN1qlQuery,QueryProfileNone,StatementPlus) + +// Package gocb is a stub of gopkg.in/couchbase/gocb.v1, generated by depstubber. +package gocb + +import ( + time "time" +) + +type AnalyticsDeferredResultHandle interface { + Close() error + Next(_ interface{}) bool + NextBytes() []byte + One(_ interface{}) error + Status() (string, error) +} + +type AnalyticsIngestOptions struct{} + +func (_ *AnalyticsIngestOptions) AnalyticsTimeout(_ time.Duration) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) DataConverter(_ DataConverterFunction) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) IdGenerator(_ IdGeneratorFunction) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) IgnoreIngestError(_ bool) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) IngestMethod(_ interface{}) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) KVRetryBehavior(_ QueryRetryBehavior) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) KVRetryOn(_ []error) *AnalyticsIngestOptions { + return nil +} + +type AnalyticsQuery struct{} + +func (_ *AnalyticsQuery) ContextId(_ string) *AnalyticsQuery { + return nil +} + +func (_ *AnalyticsQuery) Deferred(_ bool) *AnalyticsQuery { + return nil +} + +func (_ *AnalyticsQuery) Pretty(_ bool) *AnalyticsQuery { + return nil +} + +func (_ *AnalyticsQuery) Priority(_ bool) *AnalyticsQuery { + return nil +} + +func (_ *AnalyticsQuery) RawParam(_ string, _ interface{}) *AnalyticsQuery { + return nil +} + +func (_ *AnalyticsQuery) ServerSideTimeout(_ time.Duration) *AnalyticsQuery { + return nil +} + +type AnalyticsResultMetrics struct { + ElapsedTime time.Duration + ExecutionTime time.Duration + ResultCount uint + ResultSize uint + MutationCount uint + SortCount uint + ErrorCount uint + WarningCount uint + ProcessedObjects uint +} + +type AnalyticsResults interface { + ClientContextId() string + Close() error + Handle() AnalyticsDeferredResultHandle + Metrics() AnalyticsResultMetrics + Next(_ interface{}) bool + NextBytes() []byte + One(_ interface{}) error + RequestId() string + Signature() interface{} + Status() string + Warnings() []AnalyticsWarning +} + +type AnalyticsWarning struct { + Code uint32 + Message string +} + +type AuthCredsRequest struct { + Service ServiceType + Endpoint string + Bucket string +} + +type AuthDomain string + +type Authenticator interface { + Credentials(_ AuthCredsRequest) ([]UserPassPair, error) +} + +type Bucket struct{} + +func (_ *Bucket) AnalyticsIngest(_ *AnalyticsQuery, _ []interface{}, _ *AnalyticsIngestOptions) error { + return nil +} + +func (_ *Bucket) AnalyticsTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) Append(_ string, _ string) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) AppendDura(_ string, _ string, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) AppendMt(_ string, _ string) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) BulkOperationTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) Close() error { + return nil +} + +func (_ *Bucket) Counter(_ string, _ int64, _ int64, _ uint32) (uint64, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) CounterDura(_ string, _ int64, _ int64, _ uint32, _ uint, _ uint) (uint64, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) CounterMt(_ string, _ int64, _ int64, _ uint32) (uint64, Cas, MutationToken, error) { + return 0, 0, MutationToken{}, nil +} + +func (_ *Bucket) Diagnostics() (*DiagnosticReport, error) { + return nil, nil +} + +func (_ *Bucket) Do(_ []BulkOp) error { + return nil +} + +func (_ *Bucket) DurabilityPollTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) DurabilityTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) ExecuteAnalyticsQuery(_ *AnalyticsQuery, _ interface{}) (AnalyticsResults, error) { + return nil, nil +} + +func (_ *Bucket) ExecuteN1qlQuery(_ *N1qlQuery, _ interface{}) (QueryResults, error) { + return nil, nil +} + +func (_ *Bucket) ExecuteSearchQuery(_ *SearchQuery) (SearchResults, error) { + return nil, nil +} + +func (_ *Bucket) ExecuteSpatialQuery(_ *SpatialQuery) (ViewResults, error) { + return nil, nil +} + +func (_ *Bucket) ExecuteViewQuery(_ *ViewQuery) (ViewResults, error) { + return nil, nil +} + +func (_ *Bucket) Get(_ string, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) GetAndLock(_ string, _ uint32, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) GetAndTouch(_ string, _ uint32, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) GetReplica(_ string, _ interface{}, _ int) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) Insert(_ string, _ interface{}, _ uint32) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) InsertDura(_ string, _ interface{}, _ uint32, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) InsertMt(_ string, _ interface{}, _ uint32) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) Internal() *BucketInternal { + return nil +} + +func (_ *Bucket) InvalidateQueryCache() {} + +func (_ *Bucket) IoRouter() interface{} { + return nil +} + +func (_ *Bucket) ListAppend(_ string, _ interface{}, _ bool) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ListGet(_ string, _ uint, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ListPrepend(_ string, _ interface{}, _ bool) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ListRemove(_ string, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ListSet(_ string, _ uint, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ListSize(_ string) (uint, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) LookupIn(_ string) *LookupInBuilder { + return nil +} + +func (_ *Bucket) LookupInEx(_ string, _ SubdocDocFlag) *LookupInBuilder { + return nil +} + +func (_ *Bucket) Manager(_ string, _ string) *BucketManager { + return nil +} + +func (_ *Bucket) MapAdd(_ string, _ string, _ interface{}, _ bool) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) MapGet(_ string, _ string, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) MapRemove(_ string, _ string) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) MapSize(_ string) (uint, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) MutateIn(_ string, _ Cas, _ uint32) *MutateInBuilder { + return nil +} + +func (_ *Bucket) MutateInEx(_ string, _ SubdocDocFlag, _ Cas, _ uint32) *MutateInBuilder { + return nil +} + +func (_ *Bucket) MutateInExDura(_ string, _ SubdocDocFlag, _ Cas, _ uint32, _ uint, _ uint) *MutateInBuilder { + return nil +} + +func (_ *Bucket) N1qlTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) Name() string { + return "" +} + +func (_ *Bucket) OperationTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) Ping(_ []ServiceType) (*PingReport, error) { + return nil, nil +} + +func (_ *Bucket) Prepend(_ string, _ string) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) PrependDura(_ string, _ string, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) PrependMt(_ string, _ string) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) QueuePop(_ string, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) QueuePush(_ string, _ interface{}, _ bool) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) QueueSize(_ string) (uint, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) Remove(_ string, _ Cas) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) RemoveDura(_ string, _ Cas, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) RemoveMt(_ string, _ Cas) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) Replace(_ string, _ interface{}, _ Cas, _ uint32) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ReplaceDura(_ string, _ interface{}, _ Cas, _ uint32, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ReplaceMt(_ string, _ interface{}, _ Cas, _ uint32) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) SetAdd(_ string, _ interface{}, _ bool) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) SetAnalyticsQueryRetryBehavior(_ QueryRetryBehavior) {} + +func (_ *Bucket) SetAnalyticsTimeout(_ time.Duration) {} + +func (_ *Bucket) SetBulkOperationTimeout(_ time.Duration) {} + +func (_ *Bucket) SetDurabilityPollTimeout(_ time.Duration) {} + +func (_ *Bucket) SetDurabilityTimeout(_ time.Duration) {} + +func (_ *Bucket) SetExists(_ string, _ interface{}) (bool, Cas, error) { + return false, 0, nil +} + +func (_ *Bucket) SetN1qlTimeout(_ time.Duration) {} + +func (_ *Bucket) SetOperationTimeout(_ time.Duration) {} + +func (_ *Bucket) SetRemove(_ string, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) SetSearchQueryRetryBehavior(_ QueryRetryBehavior) {} + +func (_ *Bucket) SetSize(_ string) (uint, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) SetTranscoder(_ Transcoder) {} + +func (_ *Bucket) SetViewTimeout(_ time.Duration) {} + +func (_ *Bucket) Stats(_ string) (ServerStats, error) { + return nil, nil +} + +func (_ *Bucket) Touch(_ string, _ Cas, _ uint32) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) TouchDura(_ string, _ Cas, _ uint32, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) UUID() string { + return "" +} + +func (_ *Bucket) Unlock(_ string, _ Cas) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) Upsert(_ string, _ interface{}, _ uint32) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) UpsertDura(_ string, _ interface{}, _ uint32, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) UpsertMt(_ string, _ interface{}, _ uint32) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) ViewTimeout() time.Duration { + return 0 +} + +type BucketInternal struct{} + +func (_ *BucketInternal) GetRandom(_ interface{}) (string, Cas, error) { + return "", 0, nil +} + +func (_ *BucketInternal) RemoveMeta(_ string, _ []byte, _ []byte, _ byte, _ uint32, _ uint32, _ uint32, _ uint64, _ uint64) (Cas, error) { + return 0, nil +} + +func (_ *BucketInternal) UpsertMeta(_ string, _ []byte, _ []byte, _ byte, _ uint32, _ uint32, _ uint32, _ uint64, _ uint64) (Cas, error) { + return 0, nil +} + +type BucketManager struct{} + +func (_ *BucketManager) BuildDeferredIndexes() ([]string, error) { + return nil, nil +} + +func (_ *BucketManager) CreateIndex(_ string, _ []string, _ bool, _ bool) error { + return nil +} + +func (_ *BucketManager) CreatePrimaryIndex(_ string, _ bool, _ bool) error { + return nil +} + +func (_ *BucketManager) DropIndex(_ string, _ bool) error { + return nil +} + +func (_ *BucketManager) DropPrimaryIndex(_ string, _ bool) error { + return nil +} + +func (_ *BucketManager) Flush() error { + return nil +} + +func (_ *BucketManager) GetDesignDocument(_ string) (*DesignDocument, error) { + return nil, nil +} + +func (_ *BucketManager) GetDesignDocuments() ([]*DesignDocument, error) { + return nil, nil +} + +func (_ *BucketManager) GetIndexes() ([]IndexInfo, error) { + return nil, nil +} + +func (_ *BucketManager) InsertDesignDocument(_ *DesignDocument) error { + return nil +} + +func (_ *BucketManager) RemoveDesignDocument(_ string) error { + return nil +} + +func (_ *BucketManager) UpsertDesignDocument(_ *DesignDocument) error { + return nil +} + +func (_ *BucketManager) WatchIndexes(_ []string, _ bool, _ time.Duration) error { + return nil +} + +type BucketSettings struct { + FlushEnabled bool + IndexReplicas bool + Name string + Password string + Quota int + Replicas int + Type BucketType +} + +type BucketType int + +type BulkOp interface{} + +type Cas uint64 + +type Cluster struct{} + +func (_ *Cluster) AnalyticsTimeout() time.Duration { + return 0 +} + +func (_ *Cluster) Authenticate(_ Authenticator) error { + return nil +} + +func (_ *Cluster) Close() error { + return nil +} + +func (_ *Cluster) ConnectTimeout() time.Duration { + return 0 +} + +func (_ *Cluster) EnhancedErrors() bool { + return false +} + +func (_ *Cluster) ExecuteAnalyticsQuery(_ *AnalyticsQuery, _ interface{}) (AnalyticsResults, error) { + return nil, nil +} + +func (_ *Cluster) ExecuteN1qlQuery(_ *N1qlQuery, _ interface{}) (QueryResults, error) { + return nil, nil +} + +func (_ *Cluster) ExecuteSearchQuery(_ *SearchQuery) (SearchResults, error) { + return nil, nil +} + +func (_ *Cluster) FtsTimeout() time.Duration { + return 0 +} + +func (_ *Cluster) InvalidateQueryCache() {} + +func (_ *Cluster) Manager(_ string, _ string) *ClusterManager { + return nil +} + +func (_ *Cluster) N1qlTimeout() time.Duration { + return 0 +} + +func (_ *Cluster) NmvRetryDelay() time.Duration { + return 0 +} + +func (_ *Cluster) OpenBucket(_ string, _ string) (*Bucket, error) { + return nil, nil +} + +func (_ *Cluster) OpenBucketWithMt(_ string, _ string) (*Bucket, error) { + return nil, nil +} + +func (_ *Cluster) OpenStreamingBucket(_ string, _ string, _ string) (*StreamingBucket, error) { + return nil, nil +} + +func (_ *Cluster) ServerConnectTimeout() time.Duration { + return 0 +} + +func (_ *Cluster) SetAnalyticsTimeout(_ time.Duration) {} + +func (_ *Cluster) SetConnectTimeout(_ time.Duration) {} + +func (_ *Cluster) SetEnhancedErrors(_ bool) {} + +func (_ *Cluster) SetFtsTimeout(_ time.Duration) {} + +func (_ *Cluster) SetN1qlTimeout(_ time.Duration) {} + +func (_ *Cluster) SetNmvRetryDelay(_ time.Duration) {} + +func (_ *Cluster) SetServerConnectTimeout(_ time.Duration) {} + +func (_ *Cluster) SetTracer(_ interface{}) {} + +type ClusterManager struct{} + +func (_ *ClusterManager) GetBuckets() ([]*BucketSettings, error) { + return nil, nil +} + +func (_ *ClusterManager) GetUser(_ AuthDomain, _ string) (*User, error) { + return nil, nil +} + +func (_ *ClusterManager) GetUsers(_ AuthDomain) ([]*User, error) { + return nil, nil +} + +func (_ *ClusterManager) InsertBucket(_ *BucketSettings) error { + return nil +} + +func (_ *ClusterManager) Internal() *ClusterManagerInternal { + return nil +} + +func (_ *ClusterManager) RemoveBucket(_ string) error { + return nil +} + +func (_ *ClusterManager) RemoveUser(_ AuthDomain, _ string) error { + return nil +} + +func (_ *ClusterManager) SearchIndexManager() *SearchIndexManager { + return nil +} + +func (_ *ClusterManager) UpdateBucket(_ *BucketSettings) error { + return nil +} + +func (_ *ClusterManager) UpsertUser(_ AuthDomain, _ string, _ *UserSettings) error { + return nil +} + +type ClusterManagerInternal struct{} + +func (_ *ClusterManagerInternal) GetNodesMetadata() ([]NodeMetadata, error) { + return nil, nil +} + +type ConsistencyMode int + +type DataConverterFunction func([]byte) (interface{}, error) + +type DesignDocument struct { + Name string + Views map[string]View + SpatialViews map[string]View +} + +type DiagConnState int + +type DiagnosticEntry struct { + Service ServiceType + State DiagConnState + LocalAddr string + RemoteAddr string + LastActivity time.Time +} + +type DiagnosticReport struct { + ConfigRev int64 + Services []DiagnosticEntry +} + +func (_ *DiagnosticReport) MarshalJSON() ([]byte, error) { + return nil, nil +} + +type DocumentFragment struct{} + +func (_ *DocumentFragment) Cas() Cas { + return 0 +} + +func (_ *DocumentFragment) Content(_ string, _ interface{}) error { + return nil +} + +func (_ *DocumentFragment) ContentByIndex(_ int, _ interface{}) error { + return nil +} + +func (_ *DocumentFragment) Exists(_ string) bool { + return false +} + +func (_ *DocumentFragment) MutationToken() MutationToken { + return MutationToken{} +} + +type IdGeneratorFunction func(interface{}) (string, error) + +type IndexInfo struct { + Name string + IsPrimary bool + Type IndexType + State string + Keyspace string + Namespace string + IndexKey []string +} + +type IndexType string + +type LookupInBuilder struct{} + +func (_ *LookupInBuilder) Execute() (*DocumentFragment, error) { + return nil, nil +} + +func (_ *LookupInBuilder) Exists(_ string) *LookupInBuilder { + return nil +} + +func (_ *LookupInBuilder) ExistsEx(_ string, _ SubdocFlag) *LookupInBuilder { + return nil +} + +func (_ *LookupInBuilder) Get(_ string) *LookupInBuilder { + return nil +} + +func (_ *LookupInBuilder) GetCount(_ string) *LookupInBuilder { + return nil +} + +func (_ *LookupInBuilder) GetCountEx(_ string, _ SubdocFlag) *LookupInBuilder { + return nil +} + +func (_ *LookupInBuilder) GetEx(_ string, _ SubdocFlag) *LookupInBuilder { + return nil +} + +type MutateInBuilder struct{} + +func (_ *MutateInBuilder) ArrayAddUnique(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayAddUniqueEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayAppend(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayAppendEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayAppendMulti(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayAppendMultiEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayInsert(_ string, _ interface{}) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayInsertEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayInsertMulti(_ string, _ interface{}) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayInsertMultiEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayPrepend(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayPrependEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayPrependMulti(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayPrependMultiEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) Counter(_ string, _ int64, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) CounterEx(_ string, _ int64, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) Execute() (*DocumentFragment, error) { + return nil, nil +} + +func (_ *MutateInBuilder) Insert(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) InsertEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) Remove(_ string) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) RemoveEx(_ string, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) Replace(_ string, _ interface{}) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ReplaceEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) Upsert(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) UpsertEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +type MutationState struct{} + +func (_ *MutationState) Add(_ ...MutationToken) {} + +func (_ *MutationState) MarshalJSON() ([]byte, error) { + return nil, nil +} + +func (_ *MutationState) UnmarshalJSON(_ []byte) error { + return nil +} + +type MutationToken struct{} + +type N1qlQuery struct{} + +func (_ *N1qlQuery) AdHoc(_ bool) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) Consistency(_ ConsistencyMode) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) ConsistentWith(_ *MutationState) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) Custom(_ string, _ interface{}) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) PipelineBatch(_ int) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) PipelineCap(_ int) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) Profile(_ QueryProfileType) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) ReadOnly(_ bool) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) ScanCap(_ int) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) Timeout(_ time.Duration) *N1qlQuery { + return nil +} + +func NewAnalyticsQuery(_ string) *AnalyticsQuery { + return nil +} + +func NewN1qlQuery(_ string) *N1qlQuery { + return nil +} + +type NodeMetadata struct { + ClusterCompatibility int + ClusterMembership string + CouchAPIBase string + Hostname string + InterestingStats map[string]float64 + MCDMemoryAllocated float64 + MCDMemoryReserved float64 + MemoryFree float64 + MemoryTotal float64 + OS string + Ports map[string]int + Status string + Uptime int + Version string + ThisNode bool +} + +type PingReport struct { + Services []PingServiceEntry +} + +func (_ *PingReport) MarshalJSON() ([]byte, error) { + return nil, nil +} + +type PingServiceEntry struct { + Service ServiceType + Endpoint string + Success bool + Latency time.Duration +} + +var QueryProfileNone QueryProfileType = "" + +type QueryProfileType string + +type QueryResultMetrics struct { + ElapsedTime time.Duration + ExecutionTime time.Duration + ResultCount uint + ResultSize uint + MutationCount uint + SortCount uint + ErrorCount uint + WarningCount uint +} + +type QueryResults interface { + ClientContextId() string + Close() error + Metrics() QueryResultMetrics + Next(_ interface{}) bool + NextBytes() []byte + One(_ interface{}) error + Profile() interface{} + RequestId() string + SourceEndpoint() string +} + +type QueryRetryBehavior interface { + CanRetry(_ uint) bool + NextInterval(_ uint) time.Duration +} + +type SearchHighlightStyle string + +type SearchIndexDefinitionBuilder struct{} + +func (_ *SearchIndexDefinitionBuilder) AddField(_ string, _ interface{}) *SearchIndexDefinitionBuilder { + return nil +} + +type SearchIndexManager struct{} + +func (_ *SearchIndexManager) CreateIndex(_ SearchIndexDefinitionBuilder) error { + return nil +} + +func (_ *SearchIndexManager) DeleteIndex(_ string) (bool, error) { + return false, nil +} + +func (_ *SearchIndexManager) GetAllIndexDefinitions() ([]interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetAllIndexPartitionInfo() (interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetAllIndexStats() (interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetIndexDefinition(_ string) (interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetIndexPartitionIndexedDocumentCount(_ string) (int, error) { + return 0, nil +} + +func (_ *SearchIndexManager) GetIndexPartitionInfo(_ string) (interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetIndexStats(_ string) (interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetIndexedDocumentCount(_ string) (int, error) { + return 0, nil +} + +func (_ *SearchIndexManager) SetIndexIngestion(_ string, _ string) (bool, error) { + return false, nil +} + +func (_ *SearchIndexManager) SetIndexPlanFreeze(_ string, _ string) (bool, error) { + return false, nil +} + +func (_ *SearchIndexManager) SetIndexQuerying(_ string, _ string) (bool, error) { + return false, nil +} + +type SearchQuery struct{} + +func (_ *SearchQuery) AddFacet(_ string, _ interface{}) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Consistency(_ ConsistencyMode) *SearchQuery { + return nil +} + +func (_ *SearchQuery) ConsistentWith(_ *MutationState) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Explain(_ bool) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Fields(_ ...string) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Highlight(_ SearchHighlightStyle, _ ...string) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Limit(_ int) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Skip(_ int) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Sort(_ ...interface{}) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Timeout(_ time.Duration) *SearchQuery { + return nil +} + +type SearchResultDateFacet struct { + Name string + Min string + Max string + Count int +} + +type SearchResultFacet struct { + Field string + Total int + Missing int + Other int + Terms []SearchResultTermFacet + NumericRanges []SearchResultNumericFacet + DateRanges []SearchResultDateFacet +} + +type SearchResultHit struct { + Index string + Id string + Score float64 + Explanation map[string]interface{} + Locations map[string]map[string][]SearchResultLocation + Fragments map[string][]string + Fields map[string]string + AllFields map[string]interface{} +} + +type SearchResultLocation struct { + Position int + Start int + End int + ArrayPositions []uint +} + +type SearchResultNumericFacet struct { + Name string + Min float64 + Max float64 + Count int +} + +type SearchResultStatus struct { + Total int + Failed int + Successful int + Errors interface{} +} + +type SearchResultTermFacet struct { + Term string + Count int +} + +type SearchResults interface { + Errors() []string + Facets() map[string]SearchResultFacet + Hits() []SearchResultHit + MaxScore() float64 + Status() SearchResultStatus + Took() time.Duration + TotalHits() int +} + +type ServerStats map[string]map[string]string + +type ServiceType int + +type SortOrder int + +type SpatialQuery struct{} + +func (_ *SpatialQuery) Bbox(_ []float64) *SpatialQuery { + return nil +} + +func (_ *SpatialQuery) Custom(_ string, _ string) *SpatialQuery { + return nil +} + +func (_ *SpatialQuery) Development(_ bool) *SpatialQuery { + return nil +} + +func (_ *SpatialQuery) Limit(_ uint) *SpatialQuery { + return nil +} + +func (_ *SpatialQuery) Skip(_ uint) *SpatialQuery { + return nil +} + +func (_ *SpatialQuery) Stale(_ StaleMode) *SpatialQuery { + return nil +} + +type StaleMode int + +var StatementPlus ConsistencyMode = 0 + +type StreamingBucket struct{} + +func (_ *StreamingBucket) IoRouter() interface{} { + return nil +} + +type SubdocDocFlag uint8 + +type SubdocFlag uint8 + +type Transcoder interface { + Decode(_ []byte, _ uint32, _ interface{}) error + Encode(_ interface{}) ([]byte, uint32, error) +} + +type User struct { + Id string + Name string + Type string + Roles []UserRole +} + +type UserPassPair struct { + Username string + Password string +} + +type UserRole struct { + Role string + BucketName string +} + +type UserSettings struct { + Name string + Password string + Roles []UserRole +} + +type View struct { + Map string + Reduce string +} + +type ViewQuery struct{} + +func (_ *ViewQuery) Custom(_ string, _ string) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Development(_ bool) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Group(_ bool) *ViewQuery { + return nil +} + +func (_ *ViewQuery) GroupLevel(_ uint) *ViewQuery { + return nil +} + +func (_ *ViewQuery) IdRange(_ string, _ string) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Key(_ interface{}) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Keys(_ []interface{}) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Limit(_ uint) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Order(_ SortOrder) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Range(_ interface{}, _ interface{}, _ bool) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Reduce(_ bool) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Skip(_ uint) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Stale(_ StaleMode) *ViewQuery { + return nil +} + +type ViewResults interface { + Close() error + Next(_ interface{}) bool + NextBytes() []byte + One(_ interface{}) error +} diff --git a/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/vendor/modules.txt b/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/vendor/modules.txt new file mode 100644 index 00000000000..c6015e6847f --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/CouchbaseV1/vendor/modules.txt @@ -0,0 +1,33 @@ +# github.com/golang/snappy v0.0.2 +## explicit +github.com/golang/snappy +# github.com/google/uuid v1.1.4 +## explicit +github.com/google/uuid +# github.com/opentracing/opentracing-go v1.2.0 +## explicit +github.com/opentracing/opentracing-go +# github.com/pkg/errors v0.9.1 +## explicit +github.com/pkg/errors +# golang.org/x/net v0.0.0-20201224014010-6772e930b67b +## explicit +golang.org/x/net +# golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 +## explicit +golang.org/x/sync +# gopkg.in/couchbase/gocb.v1 v1.6.7 +## explicit +gopkg.in/couchbase/gocb.v1 +# gopkg.in/couchbase/gocbcore.v7 v7.1.18 +## explicit +gopkg.in/couchbase/gocbcore.v7 +# gopkg.in/couchbaselabs/gocbconnstr.v1 v1.0.4 +## explicit +gopkg.in/couchbaselabs/gocbconnstr.v1 +# gopkg.in/couchbaselabs/gojcbmock.v1 v1.0.4 +## explicit +gopkg.in/couchbaselabs/gojcbmock.v1 +# gopkg.in/couchbaselabs/jsonx.v1 v1.0.0 +## explicit +gopkg.in/couchbaselabs/jsonx.v1 diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/Query.expected b/ql/test/library-tests/semmle/go/frameworks/NoSQL/Query.expected index 109ad99673b..e69de29bb2d 100644 --- a/ql/test/library-tests/semmle/go/frameworks/NoSQL/Query.expected +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/Query.expected @@ -1,14 +0,0 @@ -| main.go:24:22:24:29 | pipeline | -| main.go:27:27:27:32 | filter | -| main.go:29:23:29:28 | filter | -| main.go:30:22:30:27 | filter | -| main.go:32:32:32:37 | filter | -| main.go:35:17:35:22 | filter | -| main.go:36:20:36:25 | filter | -| main.go:37:29:37:34 | filter | -| main.go:38:30:38:35 | filter | -| main.go:39:29:39:34 | filter | -| main.go:45:23:45:28 | filter | -| main.go:47:23:47:28 | filter | -| main.go:48:22:48:27 | filter | -| main.go:49:18:49:25 | pipeline | diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/Query.ql b/ql/test/library-tests/semmle/go/frameworks/NoSQL/Query.ql index c5a89c0b8ef..eb51664650b 100644 --- a/ql/test/library-tests/semmle/go/frameworks/NoSQL/Query.ql +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/Query.ql @@ -1,3 +1,17 @@ import go +import TestUtilities.InlineExpectationsTest -select any(NoSQL::Query q) +class NoSQLQueryTest extends InlineExpectationsTest { + NoSQLQueryTest() { this = "NoSQLQueryTest" } + + override string getARelevantTag() { result = "nosqlquery" } + + override predicate hasActualResult(string file, int line, string element, string tag, string value) { + exists(NoSQL::Query q | + q.hasLocationInfo(file, line, _, _, _) and + element = q.toString() and + value = q.toString() and + tag = "nosqlquery" + ) + } +} diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/go.mod b/ql/test/library-tests/semmle/go/frameworks/NoSQL/go.mod index 6cd131e192f..4f784b9bb96 100644 --- a/ql/test/library-tests/semmle/go/frameworks/NoSQL/go.mod +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/go.mod @@ -2,4 +2,14 @@ module main go 1.14 -require go.mongodb.org/mongo-driver v1.3.2 +require ( + github.com/couchbase/gocb/v2 v2.2.0 + github.com/google/uuid v1.1.4 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect + go.mongodb.org/mongo-driver v1.3.2 + gopkg.in/couchbase/gocb.v1 v1.6.7 + gopkg.in/couchbase/gocbcore.v7 v7.1.18 // indirect + gopkg.in/couchbaselabs/gocbconnstr.v1 v1.0.4 // indirect + gopkg.in/couchbaselabs/gojcbmock.v1 v1.0.4 // indirect + gopkg.in/couchbaselabs/jsonx.v1 v1.0.0 // indirect +) diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/main.go b/ql/test/library-tests/semmle/go/frameworks/NoSQL/main.go index a437eef781b..c1ed47119da 100644 --- a/ql/test/library-tests/semmle/go/frameworks/NoSQL/main.go +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/main.go @@ -2,10 +2,15 @@ package main //go:generate depstubber -vendor go.mongodb.org/mongo-driver/bson/primitive D //go:generate depstubber -vendor go.mongodb.org/mongo-driver/mongo Collection,Pipeline +//go:generate depstubber -vendor gopkg.in/couchbase/gocb.v1 Bucket,Cluster +//go:generate depstubber -vendor github.com/couchbase/gocb/v2 Cluster,Scope import ( "context" + gocbv2 "github.com/couchbase/gocb/v2" + gocbv1 "gopkg.in/couchbase/gocb.v1" + "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" ) @@ -21,32 +26,46 @@ func test(coll *mongo.Collection, filter interface{}, models []mongo.WriteModel, matchStage := bson.D{{"$match", filter}} pipeline := mongo.Pipeline{matchStage} - coll.Aggregate(ctx, pipeline, nil) + coll.Aggregate(ctx, pipeline, nil) // $nosqlquery=pipeline coll.BulkWrite(ctx, models, nil) coll.Clone(nil) - coll.CountDocuments(ctx, filter, nil) + coll.CountDocuments(ctx, filter, nil) // $nosqlquery=filter coll.Database() - coll.DeleteMany(ctx, filter, nil) - coll.DeleteOne(ctx, filter, nil) + coll.DeleteMany(ctx, filter, nil) // $nosqlquery=filter + coll.DeleteOne(ctx, filter, nil) // $nosqlquery=filter - coll.Distinct(ctx, fieldName, filter) + coll.Distinct(ctx, fieldName, filter) // $nosqlquery=filter coll.Drop(ctx) coll.EstimatedDocumentCount(ctx, nil) - coll.Find(ctx, filter, nil) - coll.FindOne(ctx, filter, nil) - coll.FindOneAndDelete(ctx, filter, nil) - coll.FindOneAndReplace(ctx, filter, nil) - coll.FindOneAndUpdate(ctx, filter, nil) + coll.Find(ctx, filter, nil) // $nosqlquery=filter + coll.FindOne(ctx, filter, nil) // $nosqlquery=filter + coll.FindOneAndDelete(ctx, filter, nil) // $nosqlquery=filter + coll.FindOneAndReplace(ctx, filter, nil) // $nosqlquery=filter + coll.FindOneAndUpdate(ctx, filter, nil) // $nosqlquery=filter coll.Indexes() coll.InsertMany(ctx, documents) coll.InsertOne(ctx, document, nil) coll.Name() replacement := bson.D{{"location", "NYC"}} - coll.ReplaceOne(ctx, filter, replacement) + coll.ReplaceOne(ctx, filter, replacement) // $nosqlquery=filter update := bson.D{{"$inc", bson.D{{"age", 1}}}} - coll.UpdateMany(ctx, filter, update) - coll.UpdateOne(ctx, filter, update) - coll.Watch(ctx, pipeline) + coll.UpdateMany(ctx, filter, update) // $nosqlquery=filter + coll.UpdateOne(ctx, filter, update) // $nosqlquery=filter + coll.Watch(ctx, pipeline) // $nosqlquery=pipeline +} + +func testGocbV1(bucket gocbv1.Bucket, cluster gocbv1.Cluster, aq *gocbv1.AnalyticsQuery, nq *gocbv1.N1qlQuery) { + bucket.ExecuteAnalyticsQuery(aq, nil) // $nosqlquery=aq + cluster.ExecuteAnalyticsQuery(aq, nil) // $nosqlquery=aq + bucket.ExecuteN1qlQuery(nq, nil) // $nosqlquery=nq + cluster.ExecuteN1qlQuery(nq, nil) // $nosqlquery=nq +} + +func testGocbV2(cluster gocbv2.Cluster, scope gocbv2.Scope) { + cluster.AnalyticsQuery("a", nil) // $nosqlquery="a" + scope.AnalyticsQuery("b", nil) // $nosqlquery="b" + cluster.Query("c", nil) // $nosqlquery="c" + scope.Query("d", nil) // $nosqlquery="d" } func main() {} diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/github.com/couchbase/gocb/v2/stub.go b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/github.com/couchbase/gocb/v2/stub.go new file mode 100644 index 00000000000..05ab17530bc --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/github.com/couchbase/gocb/v2/stub.go @@ -0,0 +1,1930 @@ +// Code generated by depstubber. DO NOT EDIT. +// This is a simple stub for github.com/couchbase/gocb/v2, strictly for use in testing. + +// See the LICENSE file for information about the licensing of the original library. +// Source: github.com/couchbase/gocb/v2 (exports: Cluster,Scope; functions: ) + +// Package gocb is a stub of github.com/couchbase/gocb/v2, generated by depstubber. +package gocb + +import ( + time "time" +) + +type AllowQueryingSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type AnalyticsDataset struct { + Name string + DataverseName string + LinkName string + BucketName string +} + +type AnalyticsIndex struct { + Name string + DatasetName string + DataverseName string + IsPrimary bool +} + +type AnalyticsIndexManager struct{} + +func (_ *AnalyticsIndexManager) ConnectLink(_ *ConnectAnalyticsLinkOptions) error { + return nil +} + +func (_ *AnalyticsIndexManager) CreateDataset(_ string, _ string, _ *CreateAnalyticsDatasetOptions) error { + return nil +} + +func (_ *AnalyticsIndexManager) CreateDataverse(_ string, _ *CreateAnalyticsDataverseOptions) error { + return nil +} + +func (_ *AnalyticsIndexManager) CreateIndex(_ string, _ string, _ map[string]string, _ *CreateAnalyticsIndexOptions) error { + return nil +} + +func (_ *AnalyticsIndexManager) DisconnectLink(_ *DisconnectAnalyticsLinkOptions) error { + return nil +} + +func (_ *AnalyticsIndexManager) DropDataset(_ string, _ *DropAnalyticsDatasetOptions) error { + return nil +} + +func (_ *AnalyticsIndexManager) DropDataverse(_ string, _ *DropAnalyticsDataverseOptions) error { + return nil +} + +func (_ *AnalyticsIndexManager) DropIndex(_ string, _ string, _ *DropAnalyticsIndexOptions) error { + return nil +} + +func (_ *AnalyticsIndexManager) GetAllDatasets(_ *GetAllAnalyticsDatasetsOptions) ([]AnalyticsDataset, error) { + return nil, nil +} + +func (_ *AnalyticsIndexManager) GetAllIndexes(_ *GetAllAnalyticsIndexesOptions) ([]AnalyticsIndex, error) { + return nil, nil +} + +func (_ *AnalyticsIndexManager) GetPendingMutations(_ *GetPendingMutationsAnalyticsOptions) (map[string]map[string]int, error) { + return nil, nil +} + +type AnalyticsMetaData struct { + RequestID string + ClientContextID string + Metrics AnalyticsMetrics + Signature interface{} + Warnings []AnalyticsWarning +} + +type AnalyticsMetrics struct { + ElapsedTime time.Duration + ExecutionTime time.Duration + ResultCount uint64 + ResultSize uint64 + MutationCount uint64 + SortCount uint64 + ErrorCount uint64 + WarningCount uint64 + ProcessedObjects uint64 +} + +type AnalyticsOptions struct { + ClientContextID string + Priority bool + PositionalParameters []interface{} + NamedParameters map[string]interface{} + Readonly bool + ScanConsistency AnalyticsScanConsistency + Raw map[string]interface{} + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type AnalyticsResult struct{} + +func (_ *AnalyticsResult) Close() error { + return nil +} + +func (_ *AnalyticsResult) Err() error { + return nil +} + +func (_ *AnalyticsResult) MetaData() (*AnalyticsMetaData, error) { + return nil, nil +} + +func (_ *AnalyticsResult) Next() bool { + return false +} + +func (_ *AnalyticsResult) One(_ interface{}) error { + return nil +} + +func (_ *AnalyticsResult) Raw() *AnalyticsResultRaw { + return nil +} + +func (_ *AnalyticsResult) Row(_ interface{}) error { + return nil +} + +type AnalyticsResultRaw struct{} + +func (_ *AnalyticsResultRaw) Close() error { + return nil +} + +func (_ *AnalyticsResultRaw) Err() error { + return nil +} + +func (_ *AnalyticsResultRaw) MetaData() ([]byte, error) { + return nil, nil +} + +func (_ *AnalyticsResultRaw) NextBytes() []byte { + return nil +} + +type AnalyticsScanConsistency uint + +type AnalyticsWarning struct { + Code uint32 + Message string +} + +type AnalyzeDocumentOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type AppendOptions struct { + Timeout time.Duration + DurabilityLevel DurabilityLevel + PersistTo uint + ReplicateTo uint + Cas Cas + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type AuthDomain string + +type BinaryCollection struct{} + +func (_ *BinaryCollection) Append(_ string, _ []byte, _ *AppendOptions) (*MutationResult, error) { + return nil, nil +} + +func (_ *BinaryCollection) Decrement(_ string, _ *DecrementOptions) (*CounterResult, error) { + return nil, nil +} + +func (_ *BinaryCollection) Increment(_ string, _ *IncrementOptions) (*CounterResult, error) { + return nil, nil +} + +func (_ *BinaryCollection) Prepend(_ string, _ []byte, _ *PrependOptions) (*MutationResult, error) { + return nil, nil +} + +type Bucket struct{} + +func (_ *Bucket) Collection(_ string) *Collection { + return nil +} + +func (_ *Bucket) Collections() *CollectionManager { + return nil +} + +func (_ *Bucket) DefaultCollection() *Collection { + return nil +} + +func (_ *Bucket) DefaultScope() *Scope { + return nil +} + +func (_ *Bucket) Internal() *InternalBucket { + return nil +} + +func (_ *Bucket) Name() string { + return "" +} + +func (_ *Bucket) Ping(_ *PingOptions) (*PingResult, error) { + return nil, nil +} + +func (_ *Bucket) Scope(_ string) *Scope { + return nil +} + +func (_ *Bucket) ViewIndexes() *ViewIndexManager { + return nil +} + +func (_ *Bucket) ViewQuery(_ string, _ string, _ *ViewOptions) (*ViewResult, error) { + return nil, nil +} + +func (_ *Bucket) WaitUntilReady(_ time.Duration, _ *WaitUntilReadyOptions) error { + return nil +} + +type BucketManager struct{} + +func (_ *BucketManager) CreateBucket(_ CreateBucketSettings, _ *CreateBucketOptions) error { + return nil +} + +func (_ *BucketManager) DropBucket(_ string, _ *DropBucketOptions) error { + return nil +} + +func (_ *BucketManager) FlushBucket(_ string, _ *FlushBucketOptions) error { + return nil +} + +func (_ *BucketManager) GetAllBuckets(_ *GetAllBucketsOptions) (map[string]BucketSettings, error) { + return nil, nil +} + +func (_ *BucketManager) GetBucket(_ string, _ *GetBucketOptions) (*BucketSettings, error) { + return nil, nil +} + +func (_ *BucketManager) UpdateBucket(_ BucketSettings, _ *UpdateBucketOptions) error { + return nil +} + +type BucketSettings struct { + Name string + FlushEnabled bool + ReplicaIndexDisabled bool + RAMQuotaMB uint64 + NumReplicas uint32 + BucketType BucketType + EvictionPolicy EvictionPolicyType + MaxTTL time.Duration + MaxExpiry time.Duration + CompressionMode CompressionMode + MinimumDurabilityLevel DurabilityLevel +} + +type BucketType string + +type BuildDeferredQueryIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type BulkOp interface{} + +type BulkOpOptions struct { + Timeout time.Duration + Transcoder Transcoder + RetryStrategy RetryStrategy +} + +type Cas uint64 + +type Cluster struct{} + +func (_ *Cluster) AnalyticsIndexes() *AnalyticsIndexManager { + return nil +} + +func (_ *Cluster) AnalyticsQuery(_ string, _ *AnalyticsOptions) (*AnalyticsResult, error) { + return nil, nil +} + +func (_ *Cluster) Bucket(_ string) *Bucket { + return nil +} + +func (_ *Cluster) Buckets() *BucketManager { + return nil +} + +func (_ *Cluster) Close(_ *ClusterCloseOptions) error { + return nil +} + +func (_ *Cluster) Diagnostics(_ *DiagnosticsOptions) (*DiagnosticsResult, error) { + return nil, nil +} + +func (_ *Cluster) Ping(_ *PingOptions) (*PingResult, error) { + return nil, nil +} + +func (_ *Cluster) Query(_ string, _ *QueryOptions) (*QueryResult, error) { + return nil, nil +} + +func (_ *Cluster) QueryIndexes() *QueryIndexManager { + return nil +} + +func (_ *Cluster) SearchIndexes() *SearchIndexManager { + return nil +} + +func (_ *Cluster) SearchQuery(_ string, _ interface{}, _ *SearchOptions) (*SearchResult, error) { + return nil, nil +} + +func (_ *Cluster) Users() *UserManager { + return nil +} + +func (_ *Cluster) WaitUntilReady(_ time.Duration, _ *WaitUntilReadyOptions) error { + return nil +} + +type ClusterCloseOptions struct{} + +type ClusterState uint + +type Collection struct{} + +func (_ *Collection) Binary() *BinaryCollection { + return nil +} + +func (_ *Collection) Bucket() *Bucket { + return nil +} + +func (_ *Collection) Do(_ []BulkOp, _ *BulkOpOptions) error { + return nil +} + +func (_ *Collection) Exists(_ string, _ *ExistsOptions) (*ExistsResult, error) { + return nil, nil +} + +func (_ *Collection) Get(_ string, _ *GetOptions) (*GetResult, error) { + return nil, nil +} + +func (_ *Collection) GetAllReplicas(_ string, _ *GetAllReplicaOptions) (*GetAllReplicasResult, error) { + return nil, nil +} + +func (_ *Collection) GetAndLock(_ string, _ time.Duration, _ *GetAndLockOptions) (*GetResult, error) { + return nil, nil +} + +func (_ *Collection) GetAndTouch(_ string, _ time.Duration, _ *GetAndTouchOptions) (*GetResult, error) { + return nil, nil +} + +func (_ *Collection) GetAnyReplica(_ string, _ *GetAnyReplicaOptions) (*GetReplicaResult, error) { + return nil, nil +} + +func (_ *Collection) Insert(_ string, _ interface{}, _ *InsertOptions) (*MutationResult, error) { + return nil, nil +} + +func (_ *Collection) List(_ string) *CouchbaseList { + return nil +} + +func (_ *Collection) LookupIn(_ string, _ []LookupInSpec, _ *LookupInOptions) (*LookupInResult, error) { + return nil, nil +} + +func (_ *Collection) Map(_ string) *CouchbaseMap { + return nil +} + +func (_ *Collection) MutateIn(_ string, _ []MutateInSpec, _ *MutateInOptions) (*MutateInResult, error) { + return nil, nil +} + +func (_ *Collection) Name() string { + return "" +} + +func (_ *Collection) Queue(_ string) *CouchbaseQueue { + return nil +} + +func (_ *Collection) Remove(_ string, _ *RemoveOptions) (*MutationResult, error) { + return nil, nil +} + +func (_ *Collection) Replace(_ string, _ interface{}, _ *ReplaceOptions) (*MutationResult, error) { + return nil, nil +} + +func (_ *Collection) ScopeName() string { + return "" +} + +func (_ *Collection) Set(_ string) *CouchbaseSet { + return nil +} + +func (_ *Collection) Touch(_ string, _ time.Duration, _ *TouchOptions) (*MutationResult, error) { + return nil, nil +} + +func (_ *Collection) Unlock(_ string, _ Cas, _ *UnlockOptions) error { + return nil +} + +func (_ *Collection) Upsert(_ string, _ interface{}, _ *UpsertOptions) (*MutationResult, error) { + return nil, nil +} + +type CollectionManager struct{} + +func (_ *CollectionManager) CreateCollection(_ CollectionSpec, _ *CreateCollectionOptions) error { + return nil +} + +func (_ *CollectionManager) CreateScope(_ string, _ *CreateScopeOptions) error { + return nil +} + +func (_ *CollectionManager) DropCollection(_ CollectionSpec, _ *DropCollectionOptions) error { + return nil +} + +func (_ *CollectionManager) DropScope(_ string, _ *DropScopeOptions) error { + return nil +} + +func (_ *CollectionManager) GetAllScopes(_ *GetAllScopesOptions) ([]ScopeSpec, error) { + return nil, nil +} + +type CollectionSpec struct { + Name string + ScopeName string + MaxExpiry time.Duration +} + +type CompressionMode string + +type ConflictResolutionType string + +type ConnectAnalyticsLinkOptions struct { + LinkName string + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type CouchbaseList struct{} + +func (_ *CouchbaseList) Append(_ interface{}) error { + return nil +} + +func (_ *CouchbaseList) At(_ int, _ interface{}) error { + return nil +} + +func (_ *CouchbaseList) Clear() error { + return nil +} + +func (_ *CouchbaseList) IndexOf(_ interface{}) (int, error) { + return 0, nil +} + +func (_ *CouchbaseList) Iterator() ([]interface{}, error) { + return nil, nil +} + +func (_ *CouchbaseList) Prepend(_ interface{}) error { + return nil +} + +func (_ *CouchbaseList) RemoveAt(_ int) error { + return nil +} + +func (_ *CouchbaseList) Size() (int, error) { + return 0, nil +} + +type CouchbaseMap struct{} + +func (_ *CouchbaseMap) Add(_ string, _ interface{}) error { + return nil +} + +func (_ *CouchbaseMap) At(_ string, _ interface{}) error { + return nil +} + +func (_ *CouchbaseMap) Clear() error { + return nil +} + +func (_ *CouchbaseMap) Exists(_ string) (bool, error) { + return false, nil +} + +func (_ *CouchbaseMap) Iterator() (map[string]interface{}, error) { + return nil, nil +} + +func (_ *CouchbaseMap) Keys() ([]string, error) { + return nil, nil +} + +func (_ *CouchbaseMap) Remove(_ string) error { + return nil +} + +func (_ *CouchbaseMap) Size() (int, error) { + return 0, nil +} + +func (_ *CouchbaseMap) Values() ([]interface{}, error) { + return nil, nil +} + +type CouchbaseQueue struct{} + +func (_ *CouchbaseQueue) Clear() error { + return nil +} + +func (_ *CouchbaseQueue) Iterator() ([]interface{}, error) { + return nil, nil +} + +func (_ *CouchbaseQueue) Pop(_ interface{}) error { + return nil +} + +func (_ *CouchbaseQueue) Push(_ interface{}) error { + return nil +} + +func (_ *CouchbaseQueue) Size() (int, error) { + return 0, nil +} + +type CouchbaseSet struct{} + +func (_ *CouchbaseSet) Add(_ interface{}) error { + return nil +} + +func (_ *CouchbaseSet) Clear() error { + return nil +} + +func (_ *CouchbaseSet) Contains(_ string) (bool, error) { + return false, nil +} + +func (_ *CouchbaseSet) Iterator() ([]interface{}, error) { + return nil, nil +} + +func (_ *CouchbaseSet) Remove(_ string) error { + return nil +} + +func (_ *CouchbaseSet) Size() (int, error) { + return 0, nil +} + +func (_ *CouchbaseSet) Values() ([]interface{}, error) { + return nil, nil +} + +type CounterResult struct { + MutationResult MutationResult +} + +func (_ CounterResult) Cas() Cas { + return 0 +} + +func (_ CounterResult) Content() uint64 { + return 0 +} + +func (_ CounterResult) MutationToken() *MutationToken { + return nil +} + +type CreateAnalyticsDatasetOptions struct { + IgnoreIfExists bool + Condition string + DataverseName string + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type CreateAnalyticsDataverseOptions struct { + IgnoreIfExists bool + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type CreateAnalyticsIndexOptions struct { + IgnoreIfExists bool + DataverseName string + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type CreateBucketOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type CreateBucketSettings struct { + BucketSettings BucketSettings + ConflictResolutionType ConflictResolutionType +} + +type CreateCollectionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type CreatePrimaryQueryIndexOptions struct { + IgnoreIfExists bool + Deferred bool + CustomName string + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type CreateQueryIndexOptions struct { + IgnoreIfExists bool + Deferred bool + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type CreateScopeOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DecrementOptions struct { + Timeout time.Duration + Expiry time.Duration + Initial int64 + Delta uint64 + DurabilityLevel DurabilityLevel + PersistTo uint + ReplicateTo uint + Cas Cas + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type DesignDocument struct { + Name string + Views map[string]View +} + +type DesignDocumentNamespace uint + +type DiagnosticsOptions struct { + ReportID string +} + +type DiagnosticsResult struct { + ID string + Services map[string][]EndPointDiagnostics + State ClusterState +} + +func (_ *DiagnosticsResult) MarshalJSON() ([]byte, error) { + return nil, nil +} + +type DisconnectAnalyticsLinkOptions struct { + LinkName string + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropAnalyticsDatasetOptions struct { + IgnoreIfNotExists bool + DataverseName string + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropAnalyticsDataverseOptions struct { + IgnoreIfNotExists bool + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropAnalyticsIndexOptions struct { + IgnoreIfNotExists bool + DataverseName string + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropBucketOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropCollectionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropDesignDocumentOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropGroupOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropPrimaryQueryIndexOptions struct { + IgnoreIfNotExists bool + CustomName string + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropQueryIndexOptions struct { + IgnoreIfNotExists bool + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropScopeOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type DropUserOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + DomainName string +} + +type DurabilityLevel uint8 + +type EndPointDiagnostics struct { + Type ServiceType + ID string + Local string + Remote string + LastActivity time.Time + State EndpointState + Namespace string +} + +type EndpointPingReport struct { + ID string + Local string + Remote string + State PingState + Error string + Namespace string + Latency time.Duration +} + +type EndpointState uint + +type EvictionPolicyType string + +type ExistsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type ExistsResult struct { + Result Result +} + +func (_ *ExistsResult) Cas() Cas { + return 0 +} + +func (_ *ExistsResult) Exists() bool { + return false +} + +type FlushBucketOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetAllAnalyticsDatasetsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetAllAnalyticsIndexesOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetAllBucketsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetAllDesignDocumentsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetAllGroupsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetAllQueryIndexesOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetAllReplicaOptions struct { + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type GetAllReplicasResult struct{} + +func (_ *GetAllReplicasResult) Close() error { + return nil +} + +func (_ *GetAllReplicasResult) Next() *GetReplicaResult { + return nil +} + +type GetAllScopesOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetAllSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetAllUsersOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + DomainName string +} + +type GetAndLockOptions struct { + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type GetAndTouchOptions struct { + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type GetAnyReplicaOptions struct { + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type GetBucketOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetDesignDocumentOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetGroupOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetIndexedDocumentsCountOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetOptions struct { + WithExpiry bool + Project []string + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type GetPendingMutationsAnalyticsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetReplicaResult struct { + GetResult GetResult +} + +func (_ *GetReplicaResult) Cas() Cas { + return 0 +} + +func (_ *GetReplicaResult) Content(_ interface{}) error { + return nil +} + +func (_ *GetReplicaResult) Expiry() *time.Duration { + return nil +} + +func (_ *GetReplicaResult) ExpiryTime() time.Time { + return time.Time{} +} + +func (_ *GetReplicaResult) IsReplica() bool { + return false +} + +type GetResult struct { + Result Result +} + +func (_ *GetResult) Cas() Cas { + return 0 +} + +func (_ *GetResult) Content(_ interface{}) error { + return nil +} + +func (_ *GetResult) Expiry() *time.Duration { + return nil +} + +func (_ *GetResult) ExpiryTime() time.Time { + return time.Time{} +} + +type GetRolesOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type GetUserOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + DomainName string +} + +type Group struct { + Name string + Description string + Roles []Role + LDAPGroupReference string +} + +type IncrementOptions struct { + Timeout time.Duration + Expiry time.Duration + Initial int64 + Delta uint64 + DurabilityLevel DurabilityLevel + PersistTo uint + ReplicateTo uint + Cas Cas + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type InsertOptions struct { + Expiry time.Duration + PersistTo uint + ReplicateTo uint + DurabilityLevel DurabilityLevel + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type InternalBucket struct{} + +func (_ *InternalBucket) IORouter() (interface{}, error) { + return nil, nil +} + +type LookupInOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + AccessDeleted bool + User []byte + } +} + +type LookupInResult struct { + Result Result +} + +func (_ *LookupInResult) Cas() Cas { + return 0 +} + +func (_ *LookupInResult) ContentAt(_ uint, _ interface{}) error { + return nil +} + +func (_ *LookupInResult) Exists(_ uint) bool { + return false +} + +type LookupInSpec struct{} + +type MutateInOptions struct { + Expiry time.Duration + Cas Cas + PersistTo uint + ReplicateTo uint + DurabilityLevel DurabilityLevel + StoreSemantic StoreSemantics + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + AccessDeleted bool + User []byte + } +} + +type MutateInResult struct { + MutationResult MutationResult +} + +func (_ MutateInResult) ContentAt(_ uint, _ interface{}) error { + return nil +} + +func (_ MutateInResult) MutationToken() *MutationToken { + return nil +} + +func (_ *MutateInResult) Cas() Cas { + return 0 +} + +type MutateInSpec struct{} + +type MutationResult struct { + Result Result +} + +func (_ MutationResult) MutationToken() *MutationToken { + return nil +} + +func (_ *MutationResult) Cas() Cas { + return 0 +} + +type MutationState struct{} + +func (_ *MutationState) Add(_ ...MutationToken) {} + +func (_ *MutationState) Internal() *MutationStateInternal { + return nil +} + +func (_ *MutationState) MarshalJSON() ([]byte, error) { + return nil, nil +} + +func (_ *MutationState) UnmarshalJSON(_ []byte) error { + return nil +} + +type MutationStateInternal struct{} + +func (_ *MutationStateInternal) Add(_ string, _ ...interface{}) {} + +func (_ *MutationStateInternal) Tokens() []MutationToken { + return nil +} + +type MutationToken struct{} + +func (_ MutationToken) BucketName() string { + return "" +} + +func (_ MutationToken) PartitionID() uint64 { + return 0 +} + +func (_ MutationToken) PartitionUUID() uint64 { + return 0 +} + +func (_ MutationToken) SequenceNumber() uint64 { + return 0 +} + +type Origin struct { + Type string + Name string +} + +type PauseIngestSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type PingOptions struct { + ServiceTypes []ServiceType + ReportID string + Timeout time.Duration +} + +type PingResult struct { + ID string + Services map[ServiceType][]EndpointPingReport +} + +func (_ *PingResult) MarshalJSON() ([]byte, error) { + return nil, nil +} + +type PingState uint + +type PrependOptions struct { + Timeout time.Duration + DurabilityLevel DurabilityLevel + PersistTo uint + ReplicateTo uint + Cas Cas + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type PublishDesignDocumentOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type QueryIndex struct { + Name string + IsPrimary bool + Type QueryIndexType + State string + Keyspace string + Namespace string + IndexKey []string + Condition string +} + +type QueryIndexManager struct{} + +func (_ *QueryIndexManager) BuildDeferredIndexes(_ string, _ *BuildDeferredQueryIndexOptions) ([]string, error) { + return nil, nil +} + +func (_ *QueryIndexManager) CreateIndex(_ string, _ string, _ []string, _ *CreateQueryIndexOptions) error { + return nil +} + +func (_ *QueryIndexManager) CreatePrimaryIndex(_ string, _ *CreatePrimaryQueryIndexOptions) error { + return nil +} + +func (_ *QueryIndexManager) DropIndex(_ string, _ string, _ *DropQueryIndexOptions) error { + return nil +} + +func (_ *QueryIndexManager) DropPrimaryIndex(_ string, _ *DropPrimaryQueryIndexOptions) error { + return nil +} + +func (_ *QueryIndexManager) GetAllIndexes(_ string, _ *GetAllQueryIndexesOptions) ([]QueryIndex, error) { + return nil, nil +} + +func (_ *QueryIndexManager) WatchIndexes(_ string, _ []string, _ time.Duration, _ *WatchQueryIndexOptions) error { + return nil +} + +type QueryIndexType string + +type QueryMetaData struct { + RequestID string + ClientContextID string + Status QueryStatus + Metrics QueryMetrics + Signature interface{} + Warnings []QueryWarning + Profile interface{} +} + +type QueryMetrics struct { + ElapsedTime time.Duration + ExecutionTime time.Duration + ResultCount uint64 + ResultSize uint64 + MutationCount uint64 + SortCount uint64 + ErrorCount uint64 + WarningCount uint64 +} + +type QueryOptions struct { + ScanConsistency QueryScanConsistency + ConsistentWith *MutationState + Profile QueryProfileMode + ScanCap uint32 + PipelineBatch uint32 + PipelineCap uint32 + ScanWait time.Duration + Readonly bool + MaxParallelism uint32 + ClientContextID string + PositionalParameters []interface{} + NamedParameters map[string]interface{} + Metrics bool + Raw map[string]interface{} + Adhoc bool + Timeout time.Duration + RetryStrategy RetryStrategy + FlexIndex bool +} + +type QueryProfileMode string + +type QueryResult struct{} + +func (_ *QueryResult) Close() error { + return nil +} + +func (_ *QueryResult) Err() error { + return nil +} + +func (_ *QueryResult) MetaData() (*QueryMetaData, error) { + return nil, nil +} + +func (_ *QueryResult) Next() bool { + return false +} + +func (_ *QueryResult) One(_ interface{}) error { + return nil +} + +func (_ *QueryResult) Raw() *QueryResultRaw { + return nil +} + +func (_ *QueryResult) Row(_ interface{}) error { + return nil +} + +type QueryResultRaw struct{} + +func (_ *QueryResultRaw) Close() error { + return nil +} + +func (_ *QueryResultRaw) Err() error { + return nil +} + +func (_ *QueryResultRaw) MetaData() ([]byte, error) { + return nil, nil +} + +func (_ *QueryResultRaw) NextBytes() []byte { + return nil +} + +type QueryScanConsistency uint + +type QueryStatus string + +type QueryWarning struct { + Code uint32 + Message string +} + +type RemoveOptions struct { + Cas Cas + PersistTo uint + ReplicateTo uint + DurabilityLevel DurabilityLevel + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type ReplaceOptions struct { + Expiry time.Duration + Cas Cas + PersistTo uint + ReplicateTo uint + DurabilityLevel DurabilityLevel + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type Result struct{} + +func (_ *Result) Cas() Cas { + return 0 +} + +type ResumeIngestSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type RetryAction interface { + Duration() time.Duration +} + +type RetryReason interface { + AllowsNonIdempotentRetry() bool + AlwaysRetry() bool + Description() string +} + +type RetryRequest interface { + Idempotent() bool + Identifier() string + RetryAttempts() uint32 + RetryReasons() []RetryReason +} + +type RetryStrategy interface { + RetryAfter(_ RetryRequest, _ RetryReason) RetryAction +} + +type Role struct { + Name string + Bucket string + Scope string + Collection string +} + +type RoleAndDescription struct { + Role Role + DisplayName string + Description string +} + +type RoleAndOrigins struct { + Role Role + Origins []Origin +} + +type Scope struct{} + +func (_ *Scope) AnalyticsQuery(_ string, _ *AnalyticsOptions) (*AnalyticsResult, error) { + return nil, nil +} + +func (_ *Scope) BucketName() string { + return "" +} + +func (_ *Scope) Collection(_ string) *Collection { + return nil +} + +func (_ *Scope) Name() string { + return "" +} + +func (_ *Scope) Query(_ string, _ *QueryOptions) (*QueryResult, error) { + return nil, nil +} + +type ScopeSpec struct { + Name string + Collections []CollectionSpec +} + +type SearchDateRangeFacetResult struct { + Name string + Start string + End string + Count int +} + +type SearchFacetResult struct { + Name string + Field string + Total uint64 + Missing uint64 + Other uint64 + Terms []SearchTermFacetResult + NumericRanges []SearchNumericRangeFacetResult + DateRanges []SearchDateRangeFacetResult +} + +type SearchHighlightOptions struct { + Style SearchHighlightStyle + Fields []string +} + +type SearchHighlightStyle string + +type SearchIndex struct { + UUID string + Name string + SourceName string + Type string + Params map[string]interface{} + SourceUUID string + SourceParams map[string]interface{} + SourceType string + PlanParams map[string]interface{} +} + +type SearchIndexManager struct{} + +func (_ *SearchIndexManager) AllowQuerying(_ string, _ *AllowQueryingSearchIndexOptions) error { + return nil +} + +func (_ *SearchIndexManager) AnalyzeDocument(_ string, _ interface{}, _ *AnalyzeDocumentOptions) ([]interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) DisallowQuerying(_ string, _ *AllowQueryingSearchIndexOptions) error { + return nil +} + +func (_ *SearchIndexManager) DropIndex(_ string, _ *DropSearchIndexOptions) error { + return nil +} + +func (_ *SearchIndexManager) FreezePlan(_ string, _ *AllowQueryingSearchIndexOptions) error { + return nil +} + +func (_ *SearchIndexManager) GetAllIndexes(_ *GetAllSearchIndexOptions) ([]SearchIndex, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetIndex(_ string, _ *GetSearchIndexOptions) (*SearchIndex, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetIndexedDocumentsCount(_ string, _ *GetIndexedDocumentsCountOptions) (uint64, error) { + return 0, nil +} + +func (_ *SearchIndexManager) PauseIngest(_ string, _ *PauseIngestSearchIndexOptions) error { + return nil +} + +func (_ *SearchIndexManager) ResumeIngest(_ string, _ *ResumeIngestSearchIndexOptions) error { + return nil +} + +func (_ *SearchIndexManager) UnfreezePlan(_ string, _ *AllowQueryingSearchIndexOptions) error { + return nil +} + +func (_ *SearchIndexManager) UpsertIndex(_ SearchIndex, _ *UpsertSearchIndexOptions) error { + return nil +} + +type SearchMetaData struct { + Metrics SearchMetrics + Errors map[string]string +} + +type SearchMetrics struct { + Took time.Duration + TotalRows uint64 + MaxScore float64 + TotalPartitionCount uint64 + SuccessPartitionCount uint64 + ErrorPartitionCount uint64 +} + +type SearchNumericRangeFacetResult struct { + Name string + Min float64 + Max float64 + Count int +} + +type SearchOptions struct { + ScanConsistency SearchScanConsistency + Limit uint32 + Skip uint32 + Explain bool + Highlight *SearchHighlightOptions + Fields []string + Sort []interface{} + Facets map[string]interface{} + ConsistentWith *MutationState + Raw map[string]interface{} + Timeout time.Duration + RetryStrategy RetryStrategy + DisableScoring bool +} + +type SearchResult struct{} + +func (_ *SearchResult) Close() error { + return nil +} + +func (_ *SearchResult) Err() error { + return nil +} + +func (_ *SearchResult) Facets() (map[string]SearchFacetResult, error) { + return nil, nil +} + +func (_ *SearchResult) MetaData() (*SearchMetaData, error) { + return nil, nil +} + +func (_ *SearchResult) Next() bool { + return false +} + +func (_ *SearchResult) Raw() *SearchResultRaw { + return nil +} + +func (_ *SearchResult) Row() SearchRow { + return SearchRow{} +} + +type SearchResultRaw struct{} + +func (_ *SearchResultRaw) Close() error { + return nil +} + +func (_ *SearchResultRaw) Err() error { + return nil +} + +func (_ *SearchResultRaw) MetaData() ([]byte, error) { + return nil, nil +} + +func (_ *SearchResultRaw) NextBytes() []byte { + return nil +} + +type SearchRow struct { + Index string + ID string + Score float64 + Explanation interface{} + Locations map[string]map[string][]SearchRowLocation + Fragments map[string][]string +} + +func (_ *SearchRow) Fields(_ interface{}) error { + return nil +} + +type SearchRowLocation struct { + Position uint32 + Start uint32 + End uint32 + ArrayPositions []uint32 +} + +type SearchScanConsistency uint + +type SearchTermFacetResult struct { + Term string + Count int +} + +type ServiceType int + +type StoreSemantics uint8 + +type TouchOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type Transcoder interface { + Decode(_ []byte, _ uint32, _ interface{}) error + Encode(_ interface{}) ([]byte, uint32, error) +} + +type UnlockOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type UpdateBucketOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type UpsertDesignDocumentOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type UpsertGroupOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type UpsertOptions struct { + Expiry time.Duration + PersistTo uint + ReplicateTo uint + DurabilityLevel DurabilityLevel + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + Internal struct { + User []byte + } +} + +type UpsertSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type UpsertUserOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + DomainName string +} + +type User struct { + Username string + DisplayName string + Roles []Role + Groups []string + Password string +} + +type UserAndMetadata struct { + User User + Domain AuthDomain + EffectiveRoles []RoleAndOrigins + ExternalGroups []string + PasswordChanged time.Time +} + +type UserManager struct{} + +func (_ *UserManager) DropGroup(_ string, _ *DropGroupOptions) error { + return nil +} + +func (_ *UserManager) DropUser(_ string, _ *DropUserOptions) error { + return nil +} + +func (_ *UserManager) GetAllGroups(_ *GetAllGroupsOptions) ([]Group, error) { + return nil, nil +} + +func (_ *UserManager) GetAllUsers(_ *GetAllUsersOptions) ([]UserAndMetadata, error) { + return nil, nil +} + +func (_ *UserManager) GetGroup(_ string, _ *GetGroupOptions) (*Group, error) { + return nil, nil +} + +func (_ *UserManager) GetRoles(_ *GetRolesOptions) ([]RoleAndDescription, error) { + return nil, nil +} + +func (_ *UserManager) GetUser(_ string, _ *GetUserOptions) (*UserAndMetadata, error) { + return nil, nil +} + +func (_ *UserManager) UpsertGroup(_ Group, _ *UpsertGroupOptions) error { + return nil +} + +func (_ *UserManager) UpsertUser(_ User, _ *UpsertUserOptions) error { + return nil +} + +type View struct { + Map string + Reduce string +} + +type ViewErrorMode uint + +type ViewIndexManager struct{} + +func (_ *ViewIndexManager) DropDesignDocument(_ string, _ DesignDocumentNamespace, _ *DropDesignDocumentOptions) error { + return nil +} + +func (_ *ViewIndexManager) GetAllDesignDocuments(_ DesignDocumentNamespace, _ *GetAllDesignDocumentsOptions) ([]DesignDocument, error) { + return nil, nil +} + +func (_ *ViewIndexManager) GetDesignDocument(_ string, _ DesignDocumentNamespace, _ *GetDesignDocumentOptions) (*DesignDocument, error) { + return nil, nil +} + +func (_ *ViewIndexManager) PublishDesignDocument(_ string, _ *PublishDesignDocumentOptions) error { + return nil +} + +func (_ *ViewIndexManager) UpsertDesignDocument(_ DesignDocument, _ DesignDocumentNamespace, _ *UpsertDesignDocumentOptions) error { + return nil +} + +type ViewMetaData struct { + TotalRows uint64 + Debug interface{} +} + +type ViewOptions struct { + ScanConsistency ViewScanConsistency + Skip uint32 + Limit uint32 + Order ViewOrdering + Reduce bool + Group bool + GroupLevel uint32 + Key interface{} + Keys []interface{} + StartKey interface{} + EndKey interface{} + InclusiveEnd bool + StartKeyDocID string + EndKeyDocID string + OnError ViewErrorMode + Debug bool + Raw map[string]string + Namespace DesignDocumentNamespace + Timeout time.Duration + RetryStrategy RetryStrategy +} + +type ViewOrdering uint + +type ViewResult struct{} + +func (_ *ViewResult) Close() error { + return nil +} + +func (_ *ViewResult) Err() error { + return nil +} + +func (_ *ViewResult) MetaData() (*ViewMetaData, error) { + return nil, nil +} + +func (_ *ViewResult) Next() bool { + return false +} + +func (_ *ViewResult) Raw() *ViewResultRaw { + return nil +} + +func (_ *ViewResult) Row() ViewRow { + return ViewRow{} +} + +type ViewResultRaw struct{} + +func (_ *ViewResultRaw) Close() error { + return nil +} + +func (_ *ViewResultRaw) Err() error { + return nil +} + +func (_ *ViewResultRaw) MetaData() ([]byte, error) { + return nil, nil +} + +func (_ *ViewResultRaw) NextBytes() []byte { + return nil +} + +type ViewRow struct { + ID string +} + +func (_ *ViewRow) Key(_ interface{}) error { + return nil +} + +func (_ *ViewRow) Value(_ interface{}) error { + return nil +} + +type ViewScanConsistency uint + +type WaitUntilReadyOptions struct { + DesiredState ClusterState + ServiceTypes []ServiceType +} + +type WatchQueryIndexOptions struct { + WatchPrimary bool + RetryStrategy RetryStrategy +} diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/primitive/stub.go b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/primitive/stub.go index 6f07aaff4ee..3349209245a 100644 --- a/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/primitive/stub.go +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/primitive/stub.go @@ -7,8 +7,6 @@ // Package primitive is a stub of go.mongodb.org/mongo-driver/bson/primitive, generated by depstubber. package primitive -import () - type D []E func (_ D) Map() M { diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/gopkg.in/couchbase/gocb.v1/stub.go b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/gopkg.in/couchbase/gocb.v1/stub.go new file mode 100644 index 00000000000..4de2e52e229 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/gopkg.in/couchbase/gocb.v1/stub.go @@ -0,0 +1,1273 @@ +// Code generated by depstubber. DO NOT EDIT. +// This is a simple stub for gopkg.in/couchbase/gocb.v1, strictly for use in testing. + +// See the LICENSE file for information about the licensing of the original library. +// Source: gopkg.in/couchbase/gocb.v1 (exports: Bucket,Cluster; functions: ) + +// Package gocb is a stub of gopkg.in/couchbase/gocb.v1, generated by depstubber. +package gocb + +import ( + time "time" +) + +type AnalyticsDeferredResultHandle interface { + Close() error + Next(_ interface{}) bool + NextBytes() []byte + One(_ interface{}) error + Status() (string, error) +} + +type AnalyticsIngestOptions struct{} + +func (_ *AnalyticsIngestOptions) AnalyticsTimeout(_ time.Duration) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) DataConverter(_ DataConverterFunction) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) IdGenerator(_ IdGeneratorFunction) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) IgnoreIngestError(_ bool) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) IngestMethod(_ interface{}) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) KVRetryBehavior(_ QueryRetryBehavior) *AnalyticsIngestOptions { + return nil +} + +func (_ *AnalyticsIngestOptions) KVRetryOn(_ []error) *AnalyticsIngestOptions { + return nil +} + +type AnalyticsQuery struct{} + +func (_ *AnalyticsQuery) ContextId(_ string) *AnalyticsQuery { + return nil +} + +func (_ *AnalyticsQuery) Deferred(_ bool) *AnalyticsQuery { + return nil +} + +func (_ *AnalyticsQuery) Pretty(_ bool) *AnalyticsQuery { + return nil +} + +func (_ *AnalyticsQuery) Priority(_ bool) *AnalyticsQuery { + return nil +} + +func (_ *AnalyticsQuery) RawParam(_ string, _ interface{}) *AnalyticsQuery { + return nil +} + +func (_ *AnalyticsQuery) ServerSideTimeout(_ time.Duration) *AnalyticsQuery { + return nil +} + +type AnalyticsResultMetrics struct { + ElapsedTime time.Duration + ExecutionTime time.Duration + ResultCount uint + ResultSize uint + MutationCount uint + SortCount uint + ErrorCount uint + WarningCount uint + ProcessedObjects uint +} + +type AnalyticsResults interface { + ClientContextId() string + Close() error + Handle() AnalyticsDeferredResultHandle + Metrics() AnalyticsResultMetrics + Next(_ interface{}) bool + NextBytes() []byte + One(_ interface{}) error + RequestId() string + Signature() interface{} + Status() string + Warnings() []AnalyticsWarning +} + +type AnalyticsWarning struct { + Code uint32 + Message string +} + +type AuthCredsRequest struct { + Service ServiceType + Endpoint string + Bucket string +} + +type AuthDomain string + +type Authenticator interface { + Credentials(_ AuthCredsRequest) ([]UserPassPair, error) +} + +type Bucket struct{} + +func (_ *Bucket) AnalyticsIngest(_ *AnalyticsQuery, _ []interface{}, _ *AnalyticsIngestOptions) error { + return nil +} + +func (_ *Bucket) AnalyticsTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) Append(_ string, _ string) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) AppendDura(_ string, _ string, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) AppendMt(_ string, _ string) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) BulkOperationTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) Close() error { + return nil +} + +func (_ *Bucket) Counter(_ string, _ int64, _ int64, _ uint32) (uint64, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) CounterDura(_ string, _ int64, _ int64, _ uint32, _ uint, _ uint) (uint64, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) CounterMt(_ string, _ int64, _ int64, _ uint32) (uint64, Cas, MutationToken, error) { + return 0, 0, MutationToken{}, nil +} + +func (_ *Bucket) Diagnostics() (*DiagnosticReport, error) { + return nil, nil +} + +func (_ *Bucket) Do(_ []BulkOp) error { + return nil +} + +func (_ *Bucket) DurabilityPollTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) DurabilityTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) ExecuteAnalyticsQuery(_ *AnalyticsQuery, _ interface{}) (AnalyticsResults, error) { + return nil, nil +} + +func (_ *Bucket) ExecuteN1qlQuery(_ *N1qlQuery, _ interface{}) (QueryResults, error) { + return nil, nil +} + +func (_ *Bucket) ExecuteSearchQuery(_ *SearchQuery) (SearchResults, error) { + return nil, nil +} + +func (_ *Bucket) ExecuteSpatialQuery(_ *SpatialQuery) (ViewResults, error) { + return nil, nil +} + +func (_ *Bucket) ExecuteViewQuery(_ *ViewQuery) (ViewResults, error) { + return nil, nil +} + +func (_ *Bucket) Get(_ string, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) GetAndLock(_ string, _ uint32, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) GetAndTouch(_ string, _ uint32, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) GetReplica(_ string, _ interface{}, _ int) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) Insert(_ string, _ interface{}, _ uint32) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) InsertDura(_ string, _ interface{}, _ uint32, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) InsertMt(_ string, _ interface{}, _ uint32) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) Internal() *BucketInternal { + return nil +} + +func (_ *Bucket) InvalidateQueryCache() {} + +func (_ *Bucket) IoRouter() interface{} { + return nil +} + +func (_ *Bucket) ListAppend(_ string, _ interface{}, _ bool) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ListGet(_ string, _ uint, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ListPrepend(_ string, _ interface{}, _ bool) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ListRemove(_ string, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ListSet(_ string, _ uint, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ListSize(_ string) (uint, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) LookupIn(_ string) *LookupInBuilder { + return nil +} + +func (_ *Bucket) LookupInEx(_ string, _ SubdocDocFlag) *LookupInBuilder { + return nil +} + +func (_ *Bucket) Manager(_ string, _ string) *BucketManager { + return nil +} + +func (_ *Bucket) MapAdd(_ string, _ string, _ interface{}, _ bool) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) MapGet(_ string, _ string, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) MapRemove(_ string, _ string) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) MapSize(_ string) (uint, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) MutateIn(_ string, _ Cas, _ uint32) *MutateInBuilder { + return nil +} + +func (_ *Bucket) MutateInEx(_ string, _ SubdocDocFlag, _ Cas, _ uint32) *MutateInBuilder { + return nil +} + +func (_ *Bucket) MutateInExDura(_ string, _ SubdocDocFlag, _ Cas, _ uint32, _ uint, _ uint) *MutateInBuilder { + return nil +} + +func (_ *Bucket) N1qlTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) Name() string { + return "" +} + +func (_ *Bucket) OperationTimeout() time.Duration { + return 0 +} + +func (_ *Bucket) Ping(_ []ServiceType) (*PingReport, error) { + return nil, nil +} + +func (_ *Bucket) Prepend(_ string, _ string) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) PrependDura(_ string, _ string, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) PrependMt(_ string, _ string) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) QueuePop(_ string, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) QueuePush(_ string, _ interface{}, _ bool) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) QueueSize(_ string) (uint, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) Remove(_ string, _ Cas) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) RemoveDura(_ string, _ Cas, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) RemoveMt(_ string, _ Cas) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) Replace(_ string, _ interface{}, _ Cas, _ uint32) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ReplaceDura(_ string, _ interface{}, _ Cas, _ uint32, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) ReplaceMt(_ string, _ interface{}, _ Cas, _ uint32) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) SetAdd(_ string, _ interface{}, _ bool) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) SetAnalyticsQueryRetryBehavior(_ QueryRetryBehavior) {} + +func (_ *Bucket) SetAnalyticsTimeout(_ time.Duration) {} + +func (_ *Bucket) SetBulkOperationTimeout(_ time.Duration) {} + +func (_ *Bucket) SetDurabilityPollTimeout(_ time.Duration) {} + +func (_ *Bucket) SetDurabilityTimeout(_ time.Duration) {} + +func (_ *Bucket) SetExists(_ string, _ interface{}) (bool, Cas, error) { + return false, 0, nil +} + +func (_ *Bucket) SetN1qlTimeout(_ time.Duration) {} + +func (_ *Bucket) SetOperationTimeout(_ time.Duration) {} + +func (_ *Bucket) SetRemove(_ string, _ interface{}) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) SetSearchQueryRetryBehavior(_ QueryRetryBehavior) {} + +func (_ *Bucket) SetSize(_ string) (uint, Cas, error) { + return 0, 0, nil +} + +func (_ *Bucket) SetTranscoder(_ Transcoder) {} + +func (_ *Bucket) SetViewTimeout(_ time.Duration) {} + +func (_ *Bucket) Stats(_ string) (ServerStats, error) { + return nil, nil +} + +func (_ *Bucket) Touch(_ string, _ Cas, _ uint32) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) TouchDura(_ string, _ Cas, _ uint32, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) UUID() string { + return "" +} + +func (_ *Bucket) Unlock(_ string, _ Cas) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) Upsert(_ string, _ interface{}, _ uint32) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) UpsertDura(_ string, _ interface{}, _ uint32, _ uint, _ uint) (Cas, error) { + return 0, nil +} + +func (_ *Bucket) UpsertMt(_ string, _ interface{}, _ uint32) (Cas, MutationToken, error) { + return 0, MutationToken{}, nil +} + +func (_ *Bucket) ViewTimeout() time.Duration { + return 0 +} + +type BucketInternal struct{} + +func (_ *BucketInternal) GetRandom(_ interface{}) (string, Cas, error) { + return "", 0, nil +} + +func (_ *BucketInternal) RemoveMeta(_ string, _ []byte, _ []byte, _ byte, _ uint32, _ uint32, _ uint32, _ uint64, _ uint64) (Cas, error) { + return 0, nil +} + +func (_ *BucketInternal) UpsertMeta(_ string, _ []byte, _ []byte, _ byte, _ uint32, _ uint32, _ uint32, _ uint64, _ uint64) (Cas, error) { + return 0, nil +} + +type BucketManager struct{} + +func (_ *BucketManager) BuildDeferredIndexes() ([]string, error) { + return nil, nil +} + +func (_ *BucketManager) CreateIndex(_ string, _ []string, _ bool, _ bool) error { + return nil +} + +func (_ *BucketManager) CreatePrimaryIndex(_ string, _ bool, _ bool) error { + return nil +} + +func (_ *BucketManager) DropIndex(_ string, _ bool) error { + return nil +} + +func (_ *BucketManager) DropPrimaryIndex(_ string, _ bool) error { + return nil +} + +func (_ *BucketManager) Flush() error { + return nil +} + +func (_ *BucketManager) GetDesignDocument(_ string) (*DesignDocument, error) { + return nil, nil +} + +func (_ *BucketManager) GetDesignDocuments() ([]*DesignDocument, error) { + return nil, nil +} + +func (_ *BucketManager) GetIndexes() ([]IndexInfo, error) { + return nil, nil +} + +func (_ *BucketManager) InsertDesignDocument(_ *DesignDocument) error { + return nil +} + +func (_ *BucketManager) RemoveDesignDocument(_ string) error { + return nil +} + +func (_ *BucketManager) UpsertDesignDocument(_ *DesignDocument) error { + return nil +} + +func (_ *BucketManager) WatchIndexes(_ []string, _ bool, _ time.Duration) error { + return nil +} + +type BucketSettings struct { + FlushEnabled bool + IndexReplicas bool + Name string + Password string + Quota int + Replicas int + Type BucketType +} + +type BucketType int + +type BulkOp interface{} + +type Cas uint64 + +type Cluster struct{} + +func (_ *Cluster) AnalyticsTimeout() time.Duration { + return 0 +} + +func (_ *Cluster) Authenticate(_ Authenticator) error { + return nil +} + +func (_ *Cluster) Close() error { + return nil +} + +func (_ *Cluster) ConnectTimeout() time.Duration { + return 0 +} + +func (_ *Cluster) EnhancedErrors() bool { + return false +} + +func (_ *Cluster) ExecuteAnalyticsQuery(_ *AnalyticsQuery, _ interface{}) (AnalyticsResults, error) { + return nil, nil +} + +func (_ *Cluster) ExecuteN1qlQuery(_ *N1qlQuery, _ interface{}) (QueryResults, error) { + return nil, nil +} + +func (_ *Cluster) ExecuteSearchQuery(_ *SearchQuery) (SearchResults, error) { + return nil, nil +} + +func (_ *Cluster) FtsTimeout() time.Duration { + return 0 +} + +func (_ *Cluster) InvalidateQueryCache() {} + +func (_ *Cluster) Manager(_ string, _ string) *ClusterManager { + return nil +} + +func (_ *Cluster) N1qlTimeout() time.Duration { + return 0 +} + +func (_ *Cluster) NmvRetryDelay() time.Duration { + return 0 +} + +func (_ *Cluster) OpenBucket(_ string, _ string) (*Bucket, error) { + return nil, nil +} + +func (_ *Cluster) OpenBucketWithMt(_ string, _ string) (*Bucket, error) { + return nil, nil +} + +func (_ *Cluster) OpenStreamingBucket(_ string, _ string, _ string) (*StreamingBucket, error) { + return nil, nil +} + +func (_ *Cluster) ServerConnectTimeout() time.Duration { + return 0 +} + +func (_ *Cluster) SetAnalyticsTimeout(_ time.Duration) {} + +func (_ *Cluster) SetConnectTimeout(_ time.Duration) {} + +func (_ *Cluster) SetEnhancedErrors(_ bool) {} + +func (_ *Cluster) SetFtsTimeout(_ time.Duration) {} + +func (_ *Cluster) SetN1qlTimeout(_ time.Duration) {} + +func (_ *Cluster) SetNmvRetryDelay(_ time.Duration) {} + +func (_ *Cluster) SetServerConnectTimeout(_ time.Duration) {} + +func (_ *Cluster) SetTracer(_ interface{}) {} + +type ClusterManager struct{} + +func (_ *ClusterManager) GetBuckets() ([]*BucketSettings, error) { + return nil, nil +} + +func (_ *ClusterManager) GetUser(_ AuthDomain, _ string) (*User, error) { + return nil, nil +} + +func (_ *ClusterManager) GetUsers(_ AuthDomain) ([]*User, error) { + return nil, nil +} + +func (_ *ClusterManager) InsertBucket(_ *BucketSettings) error { + return nil +} + +func (_ *ClusterManager) Internal() *ClusterManagerInternal { + return nil +} + +func (_ *ClusterManager) RemoveBucket(_ string) error { + return nil +} + +func (_ *ClusterManager) RemoveUser(_ AuthDomain, _ string) error { + return nil +} + +func (_ *ClusterManager) SearchIndexManager() *SearchIndexManager { + return nil +} + +func (_ *ClusterManager) UpdateBucket(_ *BucketSettings) error { + return nil +} + +func (_ *ClusterManager) UpsertUser(_ AuthDomain, _ string, _ *UserSettings) error { + return nil +} + +type ClusterManagerInternal struct{} + +func (_ *ClusterManagerInternal) GetNodesMetadata() ([]NodeMetadata, error) { + return nil, nil +} + +type ConsistencyMode int + +type DataConverterFunction func([]byte) (interface{}, error) + +type DesignDocument struct { + Name string + Views map[string]View + SpatialViews map[string]View +} + +type DiagConnState int + +type DiagnosticEntry struct { + Service ServiceType + State DiagConnState + LocalAddr string + RemoteAddr string + LastActivity time.Time +} + +type DiagnosticReport struct { + ConfigRev int64 + Services []DiagnosticEntry +} + +func (_ *DiagnosticReport) MarshalJSON() ([]byte, error) { + return nil, nil +} + +type DocumentFragment struct{} + +func (_ *DocumentFragment) Cas() Cas { + return 0 +} + +func (_ *DocumentFragment) Content(_ string, _ interface{}) error { + return nil +} + +func (_ *DocumentFragment) ContentByIndex(_ int, _ interface{}) error { + return nil +} + +func (_ *DocumentFragment) Exists(_ string) bool { + return false +} + +func (_ *DocumentFragment) MutationToken() MutationToken { + return MutationToken{} +} + +type IdGeneratorFunction func(interface{}) (string, error) + +type IndexInfo struct { + Name string + IsPrimary bool + Type IndexType + State string + Keyspace string + Namespace string + IndexKey []string +} + +type IndexType string + +type LookupInBuilder struct{} + +func (_ *LookupInBuilder) Execute() (*DocumentFragment, error) { + return nil, nil +} + +func (_ *LookupInBuilder) Exists(_ string) *LookupInBuilder { + return nil +} + +func (_ *LookupInBuilder) ExistsEx(_ string, _ SubdocFlag) *LookupInBuilder { + return nil +} + +func (_ *LookupInBuilder) Get(_ string) *LookupInBuilder { + return nil +} + +func (_ *LookupInBuilder) GetCount(_ string) *LookupInBuilder { + return nil +} + +func (_ *LookupInBuilder) GetCountEx(_ string, _ SubdocFlag) *LookupInBuilder { + return nil +} + +func (_ *LookupInBuilder) GetEx(_ string, _ SubdocFlag) *LookupInBuilder { + return nil +} + +type MutateInBuilder struct{} + +func (_ *MutateInBuilder) ArrayAddUnique(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayAddUniqueEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayAppend(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayAppendEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayAppendMulti(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayAppendMultiEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayInsert(_ string, _ interface{}) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayInsertEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayInsertMulti(_ string, _ interface{}) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayInsertMultiEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayPrepend(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayPrependEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayPrependMulti(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ArrayPrependMultiEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) Counter(_ string, _ int64, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) CounterEx(_ string, _ int64, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) Execute() (*DocumentFragment, error) { + return nil, nil +} + +func (_ *MutateInBuilder) Insert(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) InsertEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) Remove(_ string) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) RemoveEx(_ string, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) Replace(_ string, _ interface{}) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) ReplaceEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) Upsert(_ string, _ interface{}, _ bool) *MutateInBuilder { + return nil +} + +func (_ *MutateInBuilder) UpsertEx(_ string, _ interface{}, _ SubdocFlag) *MutateInBuilder { + return nil +} + +type MutationState struct{} + +func (_ *MutationState) Add(_ ...MutationToken) {} + +func (_ *MutationState) MarshalJSON() ([]byte, error) { + return nil, nil +} + +func (_ *MutationState) UnmarshalJSON(_ []byte) error { + return nil +} + +type MutationToken struct{} + +type N1qlQuery struct{} + +func (_ *N1qlQuery) AdHoc(_ bool) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) Consistency(_ ConsistencyMode) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) ConsistentWith(_ *MutationState) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) Custom(_ string, _ interface{}) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) PipelineBatch(_ int) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) PipelineCap(_ int) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) Profile(_ QueryProfileType) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) ReadOnly(_ bool) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) ScanCap(_ int) *N1qlQuery { + return nil +} + +func (_ *N1qlQuery) Timeout(_ time.Duration) *N1qlQuery { + return nil +} + +type NodeMetadata struct { + ClusterCompatibility int + ClusterMembership string + CouchAPIBase string + Hostname string + InterestingStats map[string]float64 + MCDMemoryAllocated float64 + MCDMemoryReserved float64 + MemoryFree float64 + MemoryTotal float64 + OS string + Ports map[string]int + Status string + Uptime int + Version string + ThisNode bool +} + +type PingReport struct { + Services []PingServiceEntry +} + +func (_ *PingReport) MarshalJSON() ([]byte, error) { + return nil, nil +} + +type PingServiceEntry struct { + Service ServiceType + Endpoint string + Success bool + Latency time.Duration +} + +type QueryProfileType string + +type QueryResultMetrics struct { + ElapsedTime time.Duration + ExecutionTime time.Duration + ResultCount uint + ResultSize uint + MutationCount uint + SortCount uint + ErrorCount uint + WarningCount uint +} + +type QueryResults interface { + ClientContextId() string + Close() error + Metrics() QueryResultMetrics + Next(_ interface{}) bool + NextBytes() []byte + One(_ interface{}) error + Profile() interface{} + RequestId() string + SourceEndpoint() string +} + +type QueryRetryBehavior interface { + CanRetry(_ uint) bool + NextInterval(_ uint) time.Duration +} + +type SearchHighlightStyle string + +type SearchIndexDefinitionBuilder struct{} + +func (_ *SearchIndexDefinitionBuilder) AddField(_ string, _ interface{}) *SearchIndexDefinitionBuilder { + return nil +} + +type SearchIndexManager struct{} + +func (_ *SearchIndexManager) CreateIndex(_ SearchIndexDefinitionBuilder) error { + return nil +} + +func (_ *SearchIndexManager) DeleteIndex(_ string) (bool, error) { + return false, nil +} + +func (_ *SearchIndexManager) GetAllIndexDefinitions() ([]interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetAllIndexPartitionInfo() (interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetAllIndexStats() (interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetIndexDefinition(_ string) (interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetIndexPartitionIndexedDocumentCount(_ string) (int, error) { + return 0, nil +} + +func (_ *SearchIndexManager) GetIndexPartitionInfo(_ string) (interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetIndexStats(_ string) (interface{}, error) { + return nil, nil +} + +func (_ *SearchIndexManager) GetIndexedDocumentCount(_ string) (int, error) { + return 0, nil +} + +func (_ *SearchIndexManager) SetIndexIngestion(_ string, _ string) (bool, error) { + return false, nil +} + +func (_ *SearchIndexManager) SetIndexPlanFreeze(_ string, _ string) (bool, error) { + return false, nil +} + +func (_ *SearchIndexManager) SetIndexQuerying(_ string, _ string) (bool, error) { + return false, nil +} + +type SearchQuery struct{} + +func (_ *SearchQuery) AddFacet(_ string, _ interface{}) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Consistency(_ ConsistencyMode) *SearchQuery { + return nil +} + +func (_ *SearchQuery) ConsistentWith(_ *MutationState) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Explain(_ bool) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Fields(_ ...string) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Highlight(_ SearchHighlightStyle, _ ...string) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Limit(_ int) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Skip(_ int) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Sort(_ ...interface{}) *SearchQuery { + return nil +} + +func (_ *SearchQuery) Timeout(_ time.Duration) *SearchQuery { + return nil +} + +type SearchResultDateFacet struct { + Name string + Min string + Max string + Count int +} + +type SearchResultFacet struct { + Field string + Total int + Missing int + Other int + Terms []SearchResultTermFacet + NumericRanges []SearchResultNumericFacet + DateRanges []SearchResultDateFacet +} + +type SearchResultHit struct { + Index string + Id string + Score float64 + Explanation map[string]interface{} + Locations map[string]map[string][]SearchResultLocation + Fragments map[string][]string + Fields map[string]string + AllFields map[string]interface{} +} + +type SearchResultLocation struct { + Position int + Start int + End int + ArrayPositions []uint +} + +type SearchResultNumericFacet struct { + Name string + Min float64 + Max float64 + Count int +} + +type SearchResultStatus struct { + Total int + Failed int + Successful int + Errors interface{} +} + +type SearchResultTermFacet struct { + Term string + Count int +} + +type SearchResults interface { + Errors() []string + Facets() map[string]SearchResultFacet + Hits() []SearchResultHit + MaxScore() float64 + Status() SearchResultStatus + Took() time.Duration + TotalHits() int +} + +type ServerStats map[string]map[string]string + +type ServiceType int + +type SortOrder int + +type SpatialQuery struct{} + +func (_ *SpatialQuery) Bbox(_ []float64) *SpatialQuery { + return nil +} + +func (_ *SpatialQuery) Custom(_ string, _ string) *SpatialQuery { + return nil +} + +func (_ *SpatialQuery) Development(_ bool) *SpatialQuery { + return nil +} + +func (_ *SpatialQuery) Limit(_ uint) *SpatialQuery { + return nil +} + +func (_ *SpatialQuery) Skip(_ uint) *SpatialQuery { + return nil +} + +func (_ *SpatialQuery) Stale(_ StaleMode) *SpatialQuery { + return nil +} + +type StaleMode int + +type StreamingBucket struct{} + +func (_ *StreamingBucket) IoRouter() interface{} { + return nil +} + +type SubdocDocFlag uint8 + +type SubdocFlag uint8 + +type Transcoder interface { + Decode(_ []byte, _ uint32, _ interface{}) error + Encode(_ interface{}) ([]byte, uint32, error) +} + +type User struct { + Id string + Name string + Type string + Roles []UserRole +} + +type UserPassPair struct { + Username string + Password string +} + +type UserRole struct { + Role string + BucketName string +} + +type UserSettings struct { + Name string + Password string + Roles []UserRole +} + +type View struct { + Map string + Reduce string +} + +type ViewQuery struct{} + +func (_ *ViewQuery) Custom(_ string, _ string) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Development(_ bool) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Group(_ bool) *ViewQuery { + return nil +} + +func (_ *ViewQuery) GroupLevel(_ uint) *ViewQuery { + return nil +} + +func (_ *ViewQuery) IdRange(_ string, _ string) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Key(_ interface{}) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Keys(_ []interface{}) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Limit(_ uint) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Order(_ SortOrder) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Range(_ interface{}, _ interface{}, _ bool) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Reduce(_ bool) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Skip(_ uint) *ViewQuery { + return nil +} + +func (_ *ViewQuery) Stale(_ StaleMode) *ViewQuery { + return nil +} + +type ViewResults interface { + Close() error + Next(_ interface{}) bool + NextBytes() []byte + One(_ interface{}) error +} diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/modules.txt b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/modules.txt index bcea2f371ea..efe6455326a 100644 --- a/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/modules.txt +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/modules.txt @@ -1,3 +1,27 @@ # go.mongodb.org/mongo-driver v1.3.2 ## explicit go.mongodb.org/mongo-driver +# github.com/couchbase/gocb/v2 v2.2.0 +## explicit +github.com/couchbase/gocb/v2 +# github.com/google/uuid v1.1.4 +## explicit +github.com/google/uuid +# github.com/opentracing/opentracing-go v1.2.0 +## explicit +github.com/opentracing/opentracing-go +# gopkg.in/couchbase/gocb.v1 v1.6.7 +## explicit +gopkg.in/couchbase/gocb.v1 +# gopkg.in/couchbase/gocbcore.v7 v7.1.18 +## explicit +gopkg.in/couchbase/gocbcore.v7 +# gopkg.in/couchbaselabs/gocbconnstr.v1 v1.0.4 +## explicit +gopkg.in/couchbaselabs/gocbconnstr.v1 +# gopkg.in/couchbaselabs/gojcbmock.v1 v1.0.4 +## explicit +gopkg.in/couchbaselabs/gojcbmock.v1 +# gopkg.in/couchbaselabs/jsonx.v1 v1.0.0 +## explicit +gopkg.in/couchbaselabs/jsonx.v1