diff --git a/go/ql/lib/change-notes/2025-02-21-database-local-source-models.md b/go/ql/lib/change-notes/2025-02-21-database-local-source-models.md new file mode 100644 index 000000000000..2c6ea9a39eae --- /dev/null +++ b/go/ql/lib/change-notes/2025-02-21-database-local-source-models.md @@ -0,0 +1,8 @@ +--- +category: minorAnalysis +--- +* Local source models for APIs reading from databases have been added for the following libraries and ORMs: + - `github.com/couchbase/gocb` + - `github.com/gogf/gf/database/gdb` + - `github.com/mastermind/squirrel` + - `github.com/uptrace/bun` \ No newline at end of file diff --git a/go/ql/lib/ext/github.com.couchbase.gocb.model.yml b/go/ql/lib/ext/github.com.couchbase.gocb.model.yml index d17b53dd6da9..0881a2c966b6 100644 --- a/go/ql/lib/ext/github.com.couchbase.gocb.model.yml +++ b/go/ql/lib/ext/github.com.couchbase.gocb.model.yml @@ -9,6 +9,32 @@ extensions: - ["gocb2", "github.com/couchbase/gocb/v2"] - ["gocb2", "gopkg.in/couchbase/gocb.v2"] - ["gocb2", "github.com/couchbaselabs/gocb/v2"] + - addsTo: + pack: codeql/go-all + extensible: sourceModel + data: + - ["group:gocb1", "Cluster", True, "ExecuteAnalyticsQuery", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb1", "Cluster", True, "ExecuteN1qlQuery", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb1", "Cluster", True, "ExecuteSearchQuery", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Cluster", True, "AnalyticsQuery", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Cluster", True, "Query", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Collection", True, "Get", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Collection", True, "GetAndLock", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Collection", True, "GetAndTouch", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Collection", True, "GetAnyReplica", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Collection", True, "LookupIn", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Collection", True, "LookupInAllReplicas", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Collection", True, "LookupInAnyReplica", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Collection", True, "Scan", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Scope", True, "AnalyticsQuery", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "Scope", True, "Query", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "TransactionAttemptContext", True, "Get", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "TransactionAttemptContext", True, "GetReplicaFromPreferredServerGroup", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "TransactionAttemptContext", True, "Insert", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "TransactionAttemptContext", True, "Query", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "TransactionAttemptContext", True, "Replace", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "ViewIndexManager", True, "GetAllDesignDocuments", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:gocb2", "ViewIndexManager", True, "GetDesignDocument", "", "", "ReturnValue[0]", "database", "manual"] - addsTo: pack: codeql/go-all extensible: sinkModel @@ -27,6 +53,9 @@ extensions: data: - ["group:gocb1", "", False, "NewAnalyticsQuery", "", "", "Argument[0]", "ReturnValue", "taint", "manual"] - ["group:gocb1", "", False, "NewN1qlQuery", "", "", "Argument[0]", "ReturnValue", "taint", "manual"] + - ["group:gocb1", "AnalyticsResults", True, "One", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb1", "AnalyticsResults", True, "Next", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb1", "AnalyticsResults", True, "NextBytes", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] - ["group:gocb1", "AnalyticsQuery", True, "ContextId", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] - ["group:gocb1", "AnalyticsQuery", True, "Deferred", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] - ["group:gocb1", "AnalyticsQuery", True, "Pretty", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] @@ -43,3 +72,31 @@ extensions: - ["group:gocb1", "N1qlQuery", True, "ReadOnly", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] - ["group:gocb1", "N1qlQuery", True, "ScanCap", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] - ["group:gocb1", "N1qlQuery", True, "Timeout", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb1", "QueryResults", True, "One", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb1", "QueryResults", True, "Next", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb1", "QueryResults", True, "NextBytes", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb1", "SearchResults", True, "Hits", "", "", "Argument[receiver]", "ReturnValue.ArrayElement", "taint", "manual"] + - ["group:gocb2", "AnalyticsResult", True, "One", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb2", "AnalyticsResult", True, "Raw", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb2", "AnalyticsResult", True, "Row", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb2", "AnalyticsResultRaw", True, "NextBytes", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb2", "GetResult", True, "Content", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb2", "LookupInResult", True, "ContentAt", "", "", "Argument[receiver]", "Argument[1]", "taint", "manual"] + - ["group:gocb2", "LookupInReplicaResult", True, "ContentAt", "", "", "Argument[receiver]", "Argument[1]", "taint", "manual"] + - ["group:gocb2", "LookupInAllReplicasResult", True, "Next", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb2", "MutateInResult", True, "ContentAt", "", "", "Argument[receiver]", "Argument[1]", "taint", "manual"] + - ["group:gocb2", "QueryResult", True, "One", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb2", "QueryResult", True, "Raw", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb2", "QueryResult", True, "Row", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb2", "QueryResultRaw", True, "NextBytes", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb2", "ScanResult", True, "Next", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb2", "ScanResultItem", True, "Content", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb2", "SearchResult", True, "Raw", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb2", "SearchResult", True, "Row", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb2", "SearchResultRaw", True, "NextBytes", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb2", "TransactionGetResult", True, "Content", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb2", "TransactionQueryResult", True, "One", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb2", "TransactionQueryResult", True, "Row", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["group:gocb2", "ViewResult", True, "Raw", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb2", "ViewResult", True, "Row", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["group:gocb2", "ViewResultRaw", True, "NextBytes", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"] diff --git a/go/ql/lib/ext/github.com.gogf.gf.database.gdb.model.yml b/go/ql/lib/ext/github.com.gogf.gf.database.gdb.model.yml index 030656c6eb8a..a667507009c4 100644 --- a/go/ql/lib/ext/github.com.gogf.gf.database.gdb.model.yml +++ b/go/ql/lib/ext/github.com.gogf.gf.database.gdb.model.yml @@ -55,3 +55,54 @@ extensions: - ["github.com/gogf/gf/database/gdb", "Tx", True, "Prepare", "", "", "Argument[0]", "sql-injection", "manual"] - ["github.com/gogf/gf/database/gdb", "Tx", True, "Query", "", "", "Argument[0]", "sql-injection", "manual"] - ["github.com/gogf/gf/database/gdb", "Tx", True, "Raw", "", "", "Argument[0]", "sql-injection", "manual"] + - addsTo: + pack: codeql/go-all + extensible: sourceModel + data: + # These models are for v1. Some of them hold for v2, but we should model v2 properly. + - ["github.com/gogf/gf/database/gdb", "DB", True, "DoExec", "", "", "ReturnValue[0]", "database", "manual"] + - ["github.com/gogf/gf/database/gdb", "DB", True, "DoGetAll", "", "", "ReturnValue[0]", "database", "manual"] + - ["github.com/gogf/gf/database/gdb", "DB", True, "DoQuery", "", "", "ReturnValue[0]", "database", "manual"] + - ["github.com/gogf/gf/database/gdb", "DB", True, "GetAll", "", "", "ReturnValue[0]", "database", "manual"] + - ["github.com/gogf/gf/database/gdb", "DB", True, "GetOne", "", "", "ReturnValue[0]", "database", "manual"] + - ["github.com/gogf/gf/database/gdb", "DB", True, "GetValue", "", "", "ReturnValue[0]", "database", "manual"] + - ["github.com/gogf/gf/database/gdb", "DB", True, "Query", "", "", "ReturnValue[0]", "database", "manual"] + - ["github.com/gogf/gf/database/gdb", "DB", True, "Raw", "", "", "ReturnValue[0]", "database", "manual"] + - ["github.com/gogf/gf/database/gdb", "DB", True, "GetScan", "", "", "Argument[0]", "database", "manual"] + - ["github.com/gogf/gf/database/gdb", "DB", True, "GetStruct", "", "", "Argument[0]", "database", "manual"] + - ["github.com/gogf/gf/database/gdb", "DB", True, "GetStructs", "", "", "Argument[0]", "database", "manual"] + - ["github.com/gogf/gf/database/gdb", "Model", True, "Raw", "", "", "ReturnValue[0]", "database", "manual"] + - addsTo: + pack: codeql/go-all + extensible: summaryModel + data: + - ["github.com/gogf/gf/database/gdb", "Model", True, "All", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Model", True, "Array", "", "", "Argument[receiver]", "ReturnValue[0].ArrayElement", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Model", True, "FindAll", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Model", True, "FindArray", "", "", "Argument[receiver]", "ReturnValue[0].ArrayElement", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Model", True, "FindOne", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Model", True, "FindValue", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Model", True, "FindScan", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Model", True, "One", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Record", True, "GMap", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Record", True, "Interface", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Record", True, "Json", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Record", True, "Map", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Record", True, "Struct", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Record", True, "Xml", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "Array", "", "", "Argument[receiver]", "ReturnValue.ArrayElement", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "Chunk", "", "", "Argument[receiver]", "ReturnValue.ArrayElement", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "Interface", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "Json", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "List", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "MapKeyInt", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "MapKeyStr", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "MapKeyUint", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "MapKeyValue", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "RecordKeyInt", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "RecordKeyStr", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "RecordKeyUint", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "RecordKeyValue", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "ScanList", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "Structs", "", "", "Argument[receiver]", "Argument[0]", "taint", "manual"] + - ["github.com/gogf/gf/database/gdb", "Result", True, "Xml", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] diff --git a/go/ql/lib/ext/github.com.mastermind.squirrel.model.yml b/go/ql/lib/ext/github.com.mastermind.squirrel.model.yml index 6f3c5830e457..d3d11c48d551 100644 --- a/go/ql/lib/ext/github.com.mastermind.squirrel.model.yml +++ b/go/ql/lib/ext/github.com.mastermind.squirrel.model.yml @@ -6,6 +6,38 @@ extensions: - ["squirrel", "github.com/Masterminds/squirrel"] - ["squirrel", "gopkg.in/Masterminds/squirrel"] - ["squirrel", "github.com/lann/squirrel"] + - addsTo: + pack: codeql/go-all + extensible: sourceModel + data: + - ["group:squirrel", "", True, "QueryContextWith", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "", True, "QueryRowContextWith", "", "", "ReturnValue", "database", "manual"] + - ["group:squirrel", "", True, "QueryRowWith", "", "", "ReturnValue", "database", "manual"] + - ["group:squirrel", "", True, "QueryWith", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "DeleteBuilder", True, "Query", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "DeleteBuilder", True, "QueryContext", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "DeleteBuilder", True, "QueryRow", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "DeleteBuilder", True, "QueryRowContext", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "InsertBuilder", True, "Query", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "InsertBuilder", True, "QueryContext", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "InsertBuilder", True, "QueryRow", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "InsertBuilder", True, "QueryRowContext", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "QueryRower", True, "QueryRow", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "QueryRowerContext", True, "QueryRowContext", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "Queryer", True, "Query", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "QueryerContext", True, "QueryContext", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "SelectBuilder", True, "Query", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "SelectBuilder", True, "QueryContext", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "SelectBuilder", True, "QueryRow", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "SelectBuilder", True, "QueryRowContext", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "StdSql", True, "Query", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "StdSql", True, "QueryRow", "", "", "ReturnValue", "database", "manual"] + - ["group:squirrel", "StdSqlCtx", True, "QueryContext", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "StdSqlCtx", True, "QueryRowContext", "", "", "ReturnValue", "database", "manual"] + - ["group:squirrel", "UpdateBuilder", True, "Query", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "UpdateBuilder", True, "QueryContext", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "UpdateBuilder", True, "QueryRow", "", "", "ReturnValue[0]", "database", "manual"] + - ["group:squirrel", "UpdateBuilder", True, "QueryRowContext", "", "", "ReturnValue[0]", "database", "manual"] - addsTo: pack: codeql/go-all extensible: sinkModel diff --git a/go/ql/lib/ext/github.com.uptrace.bun.model.yml b/go/ql/lib/ext/github.com.uptrace.bun.model.yml index a08adb07973d..6d56db783206 100644 --- a/go/ql/lib/ext/github.com.uptrace.bun.model.yml +++ b/go/ql/lib/ext/github.com.uptrace.bun.model.yml @@ -1,4 +1,26 @@ extensions: + - addsTo: + pack: codeql/go-all + extensible: sourceModel + data: + - ["github.com/uptrace/bun", "AddColumnQuery", True, "Model", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "CreateIndexQuery", True, "Model", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "CreateTableQuery", True, "Model", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "DeleteQuery", True, "Model", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "DropIndexQuery", True, "Model", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "DropTableQuery", True, "Model", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "InsertQuery", True, "Model", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "MergeQuery", True, "Model", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "SelectQuery", True, "Model", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "TruncateQuery", True, "Model", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "UpdateQuery", True, "Model", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "DeleteQuery", True, "Scan", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "InsertQuery", True, "Scan", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "MergeQuery", True, "Scan", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "RawQuery", True, "Scan", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "SelectQuery", True, "Scan", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "TruncateQuery", True, "Scan", "", "", "Argument[0]", "database", "manual"] + - ["github.com/uptrace/bun", "UpdateQuery", True, "Scan", "", "", "Argument[0]", "database", "manual"] - addsTo: pack: codeql/go-all extensible: sinkModel diff --git a/go/ql/lib/go.qll b/go/ql/lib/go.qll index df725017dc85..51ff4916e16f 100644 --- a/go/ql/lib/go.qll +++ b/go/ql/lib/go.qll @@ -57,6 +57,7 @@ import semmle.go.frameworks.Protobuf import semmle.go.frameworks.Revel import semmle.go.frameworks.Spew import semmle.go.frameworks.SQL +import semmle.go.frameworks.Squirrel import semmle.go.frameworks.Stdlib import semmle.go.frameworks.SystemCommandExecutors import semmle.go.frameworks.Testing diff --git a/go/ql/lib/semmle/go/frameworks/Squirrel.qll b/go/ql/lib/semmle/go/frameworks/Squirrel.qll new file mode 100644 index 000000000000..b8fec0507919 --- /dev/null +++ b/go/ql/lib/semmle/go/frameworks/Squirrel.qll @@ -0,0 +1,85 @@ +/** + * Provides classes modeling security-relevant aspects of the `squirrel` ORM package. + */ + +import go + +/** + * Provides classes modeling security-relevant aspects of the `squirrel` ORM package. + */ +module Squirrel { + private string packagePath() { + result = + package([ + "github.com/Masterminds/squirrel", + "github.com/lann/squirrel", + "gopkg.in/Masterminds/squirrel", + ], "") + } + + private class RowScan extends TaintTracking::FunctionModel, Method { + FunctionInput inp; + FunctionOutput outp; + + RowScan() { + // signature: func (rs *RowScanner) Scan(dest ...interface{}) error + this.hasQualifiedName(packagePath(), "Row", "Scan") and + inp.isReceiver() and + outp.isParameter(_) + } + + override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) { + input = inp and output = outp + } + } + + private class RowScannerScan extends TaintTracking::FunctionModel, Method { + FunctionInput inp; + FunctionOutput outp; + + RowScannerScan() { + // signature: func (rs *RowScanner) Scan(dest ...interface{}) error + this.hasQualifiedName(packagePath(), "RowScanner", "Scan") and + inp.isReceiver() and + outp.isParameter(_) + } + + override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) { + input = inp and output = outp + } + } + + private class BuilderScan extends TaintTracking::FunctionModel, Method { + FunctionInput inp; + FunctionOutput outp; + + BuilderScan() { + // signature: func (rs *InsertBuilder) Scan(dest ...interface{}) error + this.hasQualifiedName(packagePath(), + ["DeleteBuilder", "InsertBuilder", "SelectBuilder", "UpdateBuilder"], "Scan") and + inp.isReceiver() and + outp.isParameter(_) + } + + override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) { + input = inp and output = outp + } + } + + private class BuilderScanContext extends TaintTracking::FunctionModel, Method { + FunctionInput inp; + FunctionOutput outp; + + BuilderScanContext() { + // signature: func (rs *InsertBuilder) ScanContext(ctx context.Context, dest ...interface{}) error + this.hasQualifiedName(packagePath(), + ["DeleteBuilder", "InsertBuilder", "SelectBuilder", "UpdateBuilder"], "ScanContext") and + inp.isReceiver() and + exists(int i | i > 0 | outp.isParameter(i)) + } + + override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) { + input = inp and output = outp + } + } +} diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/go.mod b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/go.mod index 36491d136fac..551b1d18a5ec 100644 --- a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/go.mod +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/go.mod @@ -6,4 +6,5 @@ require ( gorm.io/gorm v1.23.0 github.com/jmoiron/sqlx v1.4.0 go.mongodb.org/mongo-driver/mongo v1.17.2 + github.com/nonexistent/sources v0.0.0-20250300000000-000000000000 ) diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/source.ext.yml b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/source.ext.yml index 853b9e9a719f..5e7e11e1b313 100644 --- a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/source.ext.yml +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/source.ext.yml @@ -3,4 +3,9 @@ extensions: pack: codeql/threat-models extensible: threatModelConfiguration data: - - ["database", true, 0] \ No newline at end of file + - ["database", true, 0] + - addsTo: + pack: codeql/go-all + extensible: sourceModel + data: + - ["github.com/nonexistent/sources", "", False, "Source", "", "", "ReturnValue", "database", "manual"] \ No newline at end of file diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test.ext.yml b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test.ext.yml index 00f4b3659c37..45623fd20ad2 100644 --- a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test.ext.yml +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test.ext.yml @@ -5,3 +5,9 @@ extensions: extensible: threatModelConfiguration data: - ["database", true, 0] + + - addsTo: + pack: codeql/go-all + extensible: sourceModel + data: + - ["github.com/nonexistent/sources", "", False, "Source", "", "", "ReturnValue", "database", "manual"] \ No newline at end of file diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test.go b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test.go new file mode 100644 index 000000000000..2b2cd05d41c1 --- /dev/null +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test.go @@ -0,0 +1,36 @@ +package test + +import ( + "fmt" + + gocb "github.com/couchbase/gocb/v2" + "github.com/gogf/gf/database/gdb" +) + +func gogf(g gdb.DB) { + u1, err := g.GetOne("SELECT user from users") // $source + + if err != nil { + return + } + + fmt.Println(u1) +} + +func couchbase(coll *gocb.Collection) { + type User struct { + Name string + } + + var user User + + result, err := coll.Get("documentID", nil) // $source + + if err != nil { + return + } + + result.Content(&user) + + fmt.Println(user) +} diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test_Masterminds_squirrel.go b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test_Masterminds_squirrel.go new file mode 100644 index 000000000000..cc1418e884cf --- /dev/null +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test_Masterminds_squirrel.go @@ -0,0 +1,291 @@ +package test + +//go:generate depstubber -vendor github.com/Masterminds/squirrel DeleteBuilder,InsertBuilder,QueryRower,QueryRowerContext,Queryer,QueryerContext,SelectBuilder,StdSql,StdSqlCtx,UpdateBuilder QueryContextWith,QueryRowContextWith,QueryRowWith,QueryWith + +import ( + "context" + + "github.com/Masterminds/squirrel" + src "github.com/nonexistent/sources" +) + +func test_Masterminds_squirrel_QueryRower(ctx context.Context, db squirrel.QueryRower, sqlizer squirrel.Sqlizer) { + scanner := db.QueryRow("") // $ source + + var r1, r2, r3 string + scanner.Scan(&r1, &r2, &r3) + + sink(r1) // $ hasTaintFlow="r1" + sink(r2) // $ hasTaintFlow="r2" + sink(r3) // $ hasTaintFlow="r3" + + scanner2 := squirrel.QueryRowWith(db, sqlizer) // $ source + + var r4, r5, r6 string + scanner2.Scan(&r4, &r5, &r6) + + sink(r4) // $ hasTaintFlow="r4" + sink(r5) // $ hasTaintFlow="r5" + sink(r6) // $ hasTaintFlow="r6" +} + +func test_Masterminds_squirrel_QueryRowerContext(ctx context.Context, db squirrel.QueryRowerContext, sqlizer squirrel.Sqlizer) { + scanner := db.QueryRowContext(ctx, "") // $ source + + var r1, r2, r3 string + scanner.Scan(&r1, &r2, &r3) + + sink(r1) // $ hasTaintFlow="r1" + sink(r2) // $ hasTaintFlow="r2" + sink(r3) // $ hasTaintFlow="r3" + + scanner2 := squirrel.QueryRowContextWith(ctx, db, sqlizer) // $ source + + var r4, r5, r6 string + scanner2.Scan(&r4, &r5, &r6) + + sink(r4) // $ hasTaintFlow="r4" + sink(r5) // $ hasTaintFlow="r5" + sink(r6) // $ hasTaintFlow="r6" +} + +func test_Masterminds_squirrel_Queryer(ctx context.Context, db squirrel.Queryer, sqlizer squirrel.Sqlizer) { + v1, err := db.Query("") // $ source + if err != nil { + return + } + sink(v1) // $ hasTaintFlow="v1" + + v2, err := squirrel.QueryWith(db, sqlizer) // $ source + if err != nil { + return + } + sink(v2) // $ hasTaintFlow="v2" +} + +func test_Masterminds_squirrel_QueryerContext(ctx context.Context, db squirrel.QueryerContext, sqlizer squirrel.Sqlizer) { + v1, err := db.QueryContext(ctx, "") // $ source + if err != nil { + return + } + sink(v1) // $ hasTaintFlow="v1" + + v2, err := squirrel.QueryContextWith(ctx, db, sqlizer) // $ source + if err != nil { + return + } + sink(v2) // $ hasTaintFlow="v2" +} + +// StdSqlCtx extends StdSql so we can test both with a StdSqlCtx +func test_Masterminds_squirrel_StdSql_StdSqlCtx(ctx context.Context, std squirrel.StdSqlCtx) { + v1, err := std.Query("") // $ source + if err != nil { + return + } + sink(v1) // $ hasTaintFlow="v1" + + v2, err := std.QueryContext(ctx, "") // $ source + if err != nil { + return + } + + sink(v2) // $ hasTaintFlow="v2" + + s3 := std.QueryRow("") // $ source + + if err != nil { + return + } + var r31, r32, r33 string + s3.Scan(&r31, &r32, &r33) + + sink(r31) // $ hasTaintFlow="r31" + sink(r32) // $ hasTaintFlow="r32" + sink(r33) // $ hasTaintFlow="r33" + + s4 := std.QueryRowContext(ctx, "") // $ source + + var r41, r42, r43 string + s4.Scan(&r41, &r42, &r43) + + sink(r41) // $ hasTaintFlow="r41" + sink(r42) // $ hasTaintFlow="r42" + sink(r43) // $ hasTaintFlow="r43" +} + +func test_Masterminds_squirrel_DeleteBuilder(ctx context.Context, builder squirrel.DeleteBuilder) { + v1, err := builder.Query() // $ source + if err != nil { + return + } + sink(v1) // $ hasTaintFlow="v1" + + v2, err := builder.QueryContext(ctx) // $ source + if err != nil { + return + } + sink(v2) // $ hasTaintFlow="v2" + + s3 := builder.QueryRowContext(ctx) // $ source + + var r31, r32, r33 string + s3.Scan(&r31, &r32, &r33) + + sink(r31) // $ hasTaintFlow="r31" + sink(r32) // $ hasTaintFlow="r32" + sink(r33) // $ hasTaintFlow="r33" + + builder2 := src.Source[squirrel.DeleteBuilder]() // $ source + + var r41, r42, r43 string + builder2.ScanContext(ctx, &r41, &r42, &r43) + + sink(r41) // $ hasTaintFlow="r41" + sink(r42) // $ hasTaintFlow="r42" + sink(r43) // $ hasTaintFlow="r43" +} + +func test_Masterminds_squirrel_InsertBuilder(ctx context.Context, builder squirrel.InsertBuilder) { + v1, err := builder.Query() // $ source + if err != nil { + return + } + sink(v1) // $ hasTaintFlow="v1" + + v2, err := builder.QueryContext(ctx) // $ source + if err != nil { + return + } + sink(v2) // $ hasTaintFlow="v2" + + s3 := builder.QueryRow() // $ source + + var r31, r32, r33 string + s3.Scan(&r31, &r32, &r33) + + sink(r31) // $ hasTaintFlow="r31" + sink(r32) // $ hasTaintFlow="r32" + sink(r33) // $ hasTaintFlow="r33" + + s4 := builder.QueryRowContext(ctx) // $ source + + var r41, r42, r43 string + s4.Scan(&r41, &r42, &r43) + + sink(r41) // $ hasTaintFlow="r41" + sink(r42) // $ hasTaintFlow="r42" + sink(r43) // $ hasTaintFlow="r43" + + builder2 := src.Source[squirrel.InsertBuilder]() // $ source + + var r51, r52, r53 string + builder2.Scan(&r51, &r52, &r53) + + sink(r51) // $ hasTaintFlow="r51" + sink(r52) // $ hasTaintFlow="r52" + sink(r53) // $ hasTaintFlow="r53" + + var r61, r62, r63 string + builder2.ScanContext(ctx, &r61, &r62, &r63) + + sink(r61) // $ hasTaintFlow="r61" + sink(r62) // $ hasTaintFlow="r62" + sink(r63) // $ hasTaintFlow="r63" +} + +func test_Masterminds_squirrel_SelectBuilder(ctx context.Context, builder squirrel.SelectBuilder) { + v1, err := builder.Query() // $ source + if err != nil { + return + } + sink(v1) // $ hasTaintFlow="v1" + + v2, err := builder.QueryContext(ctx) // $ source + if err != nil { + return + } + sink(v2) // $ hasTaintFlow="v2" + + s3 := builder.QueryRow() // $ source + + var r31, r32, r33 string + s3.Scan(&r31, &r32, &r33) + + sink(r31) // $ hasTaintFlow="r31" + sink(r32) // $ hasTaintFlow="r32" + sink(r33) // $ hasTaintFlow="r33" + + s4 := builder.QueryRowContext(ctx) // $ source + + var r41, r42, r43 string + s4.Scan(&r41, &r42, &r43) + + sink(r41) // $ hasTaintFlow="r41" + sink(r42) // $ hasTaintFlow="r42" + sink(r43) // $ hasTaintFlow="r43" + + builder2 := src.Source[squirrel.SelectBuilder]() // $ source + + var r51, r52, r53 string + builder2.Scan(&r51, &r52, &r53) + + sink(r51) // $ hasTaintFlow="r51" + sink(r52) // $ hasTaintFlow="r52" + sink(r53) // $ hasTaintFlow="r53" + + var r61, r62, r63 string + builder2.ScanContext(ctx, &r61, &r62, &r63) + + sink(r61) // $ hasTaintFlow="r61" + sink(r62) // $ hasTaintFlow="r62" + sink(r63) // $ hasTaintFlow="r63" +} + +func test_Masterminds_squirrel_UpdateBuilder(ctx context.Context, builder squirrel.UpdateBuilder) { + v1, err := builder.Query() // $ source + if err != nil { + return + } + sink(v1) // $ hasTaintFlow="v1" + + v2, err := builder.QueryContext(ctx) // $ source + if err != nil { + return + } + sink(v2) // $ hasTaintFlow="v2" + + s3 := builder.QueryRow() // $ source + + var r31, r32, r33 string + s3.Scan(&r31, &r32, &r33) + + sink(r31) // $ hasTaintFlow="r31" + sink(r32) // $ hasTaintFlow="r32" + sink(r33) // $ hasTaintFlow="r33" + + s4 := builder.QueryRowContext(ctx) // $ source + + var r41, r42, r43 string + s4.Scan(&r41, &r42, &r43) + + sink(r41) // $ hasTaintFlow="r41" + sink(r42) // $ hasTaintFlow="r42" + sink(r43) // $ hasTaintFlow="r43" + + builder2 := src.Source[squirrel.UpdateBuilder]() // $ source + + var r51, r52, r53 string + builder2.Scan(&r51, &r52, &r53) + + sink(r51) // $ hasTaintFlow="r51" + sink(r52) // $ hasTaintFlow="r52" + sink(r53) // $ hasTaintFlow="r53" + + var r61, r62, r63 string + builder2.ScanContext(ctx, &r61, &r62, &r63) + + sink(r61) // $ hasTaintFlow="r61" + sink(r62) // $ hasTaintFlow="r62" + sink(r63) // $ hasTaintFlow="r63" +} diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test_couchbase_gocb_v1.go b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test_couchbase_gocb_v1.go new file mode 100644 index 000000000000..57e5dc26bbbd --- /dev/null +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test_couchbase_gocb_v1.go @@ -0,0 +1,54 @@ +package test + +import "github.com/couchbase/gocb" + +func test_couchbase_gocb_v1_Cluster(cluster *gocb.Cluster, aq *gocb.AnalyticsQuery, n1ql *gocb.N1qlQuery, sq *gocb.SearchQuery) { + // Analytics + r1, err := cluster.ExecuteAnalyticsQuery(aq, nil) // $ source + + if err != nil { + return + } + + var user1, user2 User + + r1.One(&user1) + sink(user1) // $ hasTaintFlow="user1" + + for r1.Next(user2) { + sink(user2) // $ hasTaintFlow="user2" + } + + var b1 []byte + b1 = r1.NextBytes() + sink(b1) // $ hasTaintFlow="b1" + + // N1QL + r2, err := cluster.ExecuteN1qlQuery(n1ql, nil) // $ source + + if err != nil { + return + } + + var user3, user4 User + + r2.One(&user3) + sink(user3) // $ hasTaintFlow="user3" + + for r2.Next(user4) { + sink(user4) // $ hasTaintFlow="user4" + } + + var b2 []byte + b2 = r2.NextBytes() + sink(b2) // $ hasTaintFlow="b2" + + // Search + r3, err := cluster.ExecuteSearchQuery(sq) // $ source + + if err != nil { + return + } + + sink(r3) // $ hasTaintFlow="r3" +} diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test_couchbase_gocb_v2.go b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test_couchbase_gocb_v2.go new file mode 100644 index 000000000000..3309403688e4 --- /dev/null +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/test_couchbase_gocb_v2.go @@ -0,0 +1,247 @@ +package test + +//go:generate depstubber -vendor github.com/couchbase/gocb/v2 Cluster,Scope,Collection,TransactionAttemptContext,ViewIndexManager + +import "github.com/couchbase/gocb/v2" + +func test_couchbase_gocb_v2_Cluster(cluster *gocb.Cluster) { + r1, err := cluster.AnalyticsQuery("SELECT * FROM `travel-sample`", nil) // $ source + + if err != nil { + return + } + + for r1.Next() { + var name1, name2 string + + r1.One(&name1) + + sink(name1) // $ hasTaintFlow="name1" + + r1.Row(&name2) + sink(name2) // $ hasTaintFlow="name2" + + b := r1.Raw().NextBytes() + sink(b) // $ hasTaintFlow="b" + } + + r2, err := cluster.Query("SELECT * FROM `travel-sample`", nil) // $ source + + if err != nil { + return + } + + for r2.Next() { + var name1, name2 string + + r2.One(&name1) + + sink(name1) // $ hasTaintFlow="name1" + + r2.Row(&name2) + sink(name2) // $ hasTaintFlow="name2" + + b := r2.Raw().NextBytes() + sink(b) // $ hasTaintFlow="b" + } +} + +func test_couchbase_gocb_v2_Scope(scope *gocb.Scope) { + r1, err := scope.Query("SELECT * FROM `travel-sample`", nil) // $ source + + if err != nil { + return + } + + for r1.Next() { + var name1, name2 string + + r1.One(&name1) + + sink(name1) // $ hasTaintFlow="name1" + + r1.Row(&name2) + sink(name2) // $ hasTaintFlow="name2" + + b := r1.Raw().NextBytes() + sink(b) // $ hasTaintFlow="b" + } + + r2, err := scope.Query("SELECT * FROM `travel-sample`", nil) // $ source + + if err != nil { + return + } + + for r2.Next() { + var name1, name2 string + + r2.One(&name1) + + sink(name1) // $ hasTaintFlow="name1" + + r2.Row(&name2) + sink(name2) // $ hasTaintFlow="name2" + + b := r2.Raw().NextBytes() + sink(b) // $ hasTaintFlow="b" + } +} + +func test_couchbase_gocb_v2_Collection(coll *gocb.Collection) { + type User struct { + Name string + } + + var user User + + r1, err := coll.Get("documentID", nil) // $ source + + if err != nil { + return + } + + r1.Content(&user) + + sink(user) // $ hasTaintFlow="user" + + r2, err := coll.GetAndLock("documentID", 30, nil) // $ source + + if err != nil { + return + } + + sink(r2) // $ hasTaintFlow="r2" + + r3, err := coll.GetAndTouch("documentID", 30, nil) // $ source + + if err != nil { + return + } + + var user3 User + r3.Content(&user3) + sink(user3) // $ hasTaintFlow="user3" + + r4, err := coll.GetAnyReplica("documentID", nil) // $ source + + if err != nil { + return + } + + sink(r4) // $ hasTaintFlow="r4" + + r5, err := coll.LookupIn("documentID", []gocb.LookupInSpec{}, nil) // $ source + + if err != nil { + return + } + + var user5 User + r5.ContentAt(0, &user5) + sink(user5) // $ hasTaintFlow="user5" + + r6, err := coll.LookupInAllReplicas("documentID", []gocb.LookupInSpec{}, nil) // $ source + + if err != nil { + return + } + + var user6 User + r6.Next().ContentAt(0, &user6) + sink(user6) // $ hasTaintFlow="user6" + + r7, err := coll.LookupInAnyReplica("documentID", []gocb.LookupInSpec{}, nil) // $ source + + if err != nil { + return + } + + var user7 User + r7.ContentAt(0, &user7) + sink(user7) // $ hasTaintFlow="user7" + + r8, err := coll.Scan(nil, nil) // $ source + + if err != nil { + return + } + + var user8 User + r8.Next().Content(&user8) + sink(user8) // $ hasTaintFlow="user8" +} + +func test_couchbase_gocb_v2_TransactionAttemptContext(tam *gocb.TransactionAttemptContext, coll *gocb.Collection) { + r1, err := tam.Get(coll, "documentID") // $ source + + if err != nil { + return + } + + var user User + r1.Content(&user) + + sink(user) // $ hasTaintFlow="user" + + r2, err := tam.GetReplicaFromPreferredServerGroup(coll, "documentID") // $ source + + if err != nil { + return + } + + var user2 User + r2.Content(&user2) + sink(user2) // $ hasTaintFlow="user2" + + var user3 User + + r3, err := tam.Insert(coll, "documentID", &user3) // $ source + if err != nil { + return + } + + var user4 User + r3.Content(&user4) + sink(user4) // $ hasTaintFlow="user4" + + r4, err := tam.Query("SELECT * FROM `travel-sample`", nil) // $ source + if err != nil { + return + } + + for r4.Next() { + var user5 User + r4.One(&user5) + sink(user5) // $ hasTaintFlow="user5" + + var user6 User + r4.Row(&user6) + sink(user6) // $ hasTaintFlow="user6" + } + + r5, err := tam.Replace(r3, user4) // $ source + if err != nil { + return + } + + sink(r5) // $ hasTaintFlow="r5" +} + +func test_couchbase_gocb_v2_ViewIndexManager(v *gocb.ViewIndexManager) { + doc, err := v.GetDesignDocument("name", 0, nil) // $ source + + if err != nil { + return + } + + sink(doc) // $ hasTaintFlow="doc" + + docs, err := v.GetAllDesignDocuments(0, nil) // $ source + + if err != nil { + return + } + + sink(docs) // $ hasTaintFlow="docs" +} diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/Masterminds/squirrel/stub.go b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/Masterminds/squirrel/stub.go new file mode 100644 index 000000000000..5b77477bb682 --- /dev/null +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/Masterminds/squirrel/stub.go @@ -0,0 +1,501 @@ +// Code generated by depstubber. DO NOT EDIT. +// This is a simple stub for github.com/Masterminds/squirrel, strictly for use in testing. + +// See the LICENSE file for information about the licensing of the original library. +// Source: github.com/Masterminds/squirrel (exports: DeleteBuilder,InsertBuilder,QueryRower,QueryRowerContext,Queryer,QueryerContext,SelectBuilder,StdSql,StdSqlCtx,UpdateBuilder; functions: QueryContextWith,QueryRowContextWith,QueryRowWith,QueryWith) + +// Package squirrel is a stub of github.com/Masterminds/squirrel, generated by depstubber. +package squirrel + +import ( + context "context" + sql "database/sql" +) + +type BaseRunner interface { + Exec(_ string, _ ...interface{}) (sql.Result, error) + Query(_ string, _ ...interface{}) (*sql.Rows, error) +} + +type DeleteBuilder struct{} + +func (_ DeleteBuilder) Exec() (sql.Result, error) { + return nil, nil +} + +func (_ DeleteBuilder) ExecContext(_ context.Context) (sql.Result, error) { + return nil, nil +} + +func (_ DeleteBuilder) From(_ string) DeleteBuilder { + return DeleteBuilder{} +} + +func (_ DeleteBuilder) Limit(_ uint64) DeleteBuilder { + return DeleteBuilder{} +} + +func (_ DeleteBuilder) MustSql() (string, []interface{}) { + return "", nil +} + +func (_ DeleteBuilder) Offset(_ uint64) DeleteBuilder { + return DeleteBuilder{} +} + +func (_ DeleteBuilder) OrderBy(_ ...string) DeleteBuilder { + return DeleteBuilder{} +} + +func (_ DeleteBuilder) PlaceholderFormat(_ PlaceholderFormat) DeleteBuilder { + return DeleteBuilder{} +} + +func (_ DeleteBuilder) Prefix(_ string, _ ...interface{}) DeleteBuilder { + return DeleteBuilder{} +} + +func (_ DeleteBuilder) PrefixExpr(_ Sqlizer) DeleteBuilder { + return DeleteBuilder{} +} + +func (_ DeleteBuilder) Query() (*sql.Rows, error) { + return nil, nil +} + +func (_ DeleteBuilder) QueryContext(_ context.Context) (*sql.Rows, error) { + return nil, nil +} + +func (_ DeleteBuilder) QueryRowContext(_ context.Context) RowScanner { + return nil +} + +func (_ DeleteBuilder) RunWith(_ BaseRunner) DeleteBuilder { + return DeleteBuilder{} +} + +func (_ DeleteBuilder) ScanContext(_ context.Context, _ ...interface{}) error { + return nil +} + +func (_ DeleteBuilder) Suffix(_ string, _ ...interface{}) DeleteBuilder { + return DeleteBuilder{} +} + +func (_ DeleteBuilder) SuffixExpr(_ Sqlizer) DeleteBuilder { + return DeleteBuilder{} +} + +func (_ DeleteBuilder) ToSql() (string, []interface{}, error) { + return "", nil, nil +} + +func (_ DeleteBuilder) Where(_ interface{}, _ ...interface{}) DeleteBuilder { + return DeleteBuilder{} +} + +type InsertBuilder struct{} + +func (_ InsertBuilder) Columns(_ ...string) InsertBuilder { + return InsertBuilder{} +} + +func (_ InsertBuilder) Exec() (sql.Result, error) { + return nil, nil +} + +func (_ InsertBuilder) ExecContext(_ context.Context) (sql.Result, error) { + return nil, nil +} + +func (_ InsertBuilder) Into(_ string) InsertBuilder { + return InsertBuilder{} +} + +func (_ InsertBuilder) MustSql() (string, []interface{}) { + return "", nil +} + +func (_ InsertBuilder) Options(_ ...string) InsertBuilder { + return InsertBuilder{} +} + +func (_ InsertBuilder) PlaceholderFormat(_ PlaceholderFormat) InsertBuilder { + return InsertBuilder{} +} + +func (_ InsertBuilder) Prefix(_ string, _ ...interface{}) InsertBuilder { + return InsertBuilder{} +} + +func (_ InsertBuilder) PrefixExpr(_ Sqlizer) InsertBuilder { + return InsertBuilder{} +} + +func (_ InsertBuilder) Query() (*sql.Rows, error) { + return nil, nil +} + +func (_ InsertBuilder) QueryContext(_ context.Context) (*sql.Rows, error) { + return nil, nil +} + +func (_ InsertBuilder) QueryRow() RowScanner { + return nil +} + +func (_ InsertBuilder) QueryRowContext(_ context.Context) RowScanner { + return nil +} + +func (_ InsertBuilder) RunWith(_ BaseRunner) InsertBuilder { + return InsertBuilder{} +} + +func (_ InsertBuilder) Scan(_ ...interface{}) error { + return nil +} + +func (_ InsertBuilder) ScanContext(_ context.Context, _ ...interface{}) error { + return nil +} + +func (_ InsertBuilder) Select(_ SelectBuilder) InsertBuilder { + return InsertBuilder{} +} + +func (_ InsertBuilder) SetMap(_ map[string]interface{}) InsertBuilder { + return InsertBuilder{} +} + +func (_ InsertBuilder) Suffix(_ string, _ ...interface{}) InsertBuilder { + return InsertBuilder{} +} + +func (_ InsertBuilder) SuffixExpr(_ Sqlizer) InsertBuilder { + return InsertBuilder{} +} + +func (_ InsertBuilder) ToSql() (string, []interface{}, error) { + return "", nil, nil +} + +func (_ InsertBuilder) Values(_ ...interface{}) InsertBuilder { + return InsertBuilder{} +} + +type PlaceholderFormat interface { + ReplacePlaceholders(_ string) (string, error) +} + +func QueryContextWith(_ context.Context, _ QueryerContext, _ Sqlizer) (*sql.Rows, error) { + return nil, nil +} + +func QueryRowContextWith(_ context.Context, _ QueryRowerContext, _ Sqlizer) RowScanner { + return nil +} + +func QueryRowWith(_ QueryRower, _ Sqlizer) RowScanner { + return nil +} + +type QueryRower interface { + QueryRow(_ string, _ ...interface{}) RowScanner +} + +type QueryRowerContext interface { + QueryRowContext(_ context.Context, _ string, _ ...interface{}) RowScanner +} + +func QueryWith(_ Queryer, _ Sqlizer) (*sql.Rows, error) { + return nil, nil +} + +type Queryer interface { + Query(_ string, _ ...interface{}) (*sql.Rows, error) +} + +type QueryerContext interface { + QueryContext(_ context.Context, _ string, _ ...interface{}) (*sql.Rows, error) +} + +type RowScanner interface { + Scan(_ ...interface{}) error +} + +type SelectBuilder struct{} + +func (_ SelectBuilder) Column(_ interface{}, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) Columns(_ ...string) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) CrossJoin(_ string, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) Distinct() SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) Exec() (sql.Result, error) { + return nil, nil +} + +func (_ SelectBuilder) ExecContext(_ context.Context) (sql.Result, error) { + return nil, nil +} + +func (_ SelectBuilder) From(_ string) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) FromSelect(_ SelectBuilder, _ string) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) GroupBy(_ ...string) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) Having(_ interface{}, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) InnerJoin(_ string, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) Join(_ string, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) JoinClause(_ interface{}, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) LeftJoin(_ string, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) Limit(_ uint64) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) MustSql() (string, []interface{}) { + return "", nil +} + +func (_ SelectBuilder) Offset(_ uint64) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) Options(_ ...string) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) OrderBy(_ ...string) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) OrderByClause(_ interface{}, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) PlaceholderFormat(_ PlaceholderFormat) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) Prefix(_ string, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) PrefixExpr(_ Sqlizer) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) Query() (*sql.Rows, error) { + return nil, nil +} + +func (_ SelectBuilder) QueryContext(_ context.Context) (*sql.Rows, error) { + return nil, nil +} + +func (_ SelectBuilder) QueryRow() RowScanner { + return nil +} + +func (_ SelectBuilder) QueryRowContext(_ context.Context) RowScanner { + return nil +} + +func (_ SelectBuilder) RemoveColumns() SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) RemoveLimit() SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) RemoveOffset() SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) RightJoin(_ string, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) RunWith(_ BaseRunner) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) Scan(_ ...interface{}) error { + return nil +} + +func (_ SelectBuilder) ScanContext(_ context.Context, _ ...interface{}) error { + return nil +} + +func (_ SelectBuilder) Suffix(_ string, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) SuffixExpr(_ Sqlizer) SelectBuilder { + return SelectBuilder{} +} + +func (_ SelectBuilder) ToSql() (string, []interface{}, error) { + return "", nil, nil +} + +func (_ SelectBuilder) Where(_ interface{}, _ ...interface{}) SelectBuilder { + return SelectBuilder{} +} + +type Sqlizer interface { + ToSql() (string, []interface{}, error) +} + +type StdSql interface { + Exec(_ string, _ ...interface{}) (sql.Result, error) + Query(_ string, _ ...interface{}) (*sql.Rows, error) + QueryRow(_ string, _ ...interface{}) *sql.Row +} + +type StdSqlCtx interface { + Exec(_ string, _ ...interface{}) (sql.Result, error) + ExecContext(_ context.Context, _ string, _ ...interface{}) (sql.Result, error) + Query(_ string, _ ...interface{}) (*sql.Rows, error) + QueryContext(_ context.Context, _ string, _ ...interface{}) (*sql.Rows, error) + QueryRow(_ string, _ ...interface{}) *sql.Row + QueryRowContext(_ context.Context, _ string, _ ...interface{}) *sql.Row +} + +type UpdateBuilder struct{} + +func (_ UpdateBuilder) Exec() (sql.Result, error) { + return nil, nil +} + +func (_ UpdateBuilder) ExecContext(_ context.Context) (sql.Result, error) { + return nil, nil +} + +func (_ UpdateBuilder) From(_ string) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) FromSelect(_ SelectBuilder, _ string) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) Limit(_ uint64) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) MustSql() (string, []interface{}) { + return "", nil +} + +func (_ UpdateBuilder) Offset(_ uint64) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) OrderBy(_ ...string) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) PlaceholderFormat(_ PlaceholderFormat) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) Prefix(_ string, _ ...interface{}) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) PrefixExpr(_ Sqlizer) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) Query() (*sql.Rows, error) { + return nil, nil +} + +func (_ UpdateBuilder) QueryContext(_ context.Context) (*sql.Rows, error) { + return nil, nil +} + +func (_ UpdateBuilder) QueryRow() RowScanner { + return nil +} + +func (_ UpdateBuilder) QueryRowContext(_ context.Context) RowScanner { + return nil +} + +func (_ UpdateBuilder) RunWith(_ BaseRunner) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) Scan(_ ...interface{}) error { + return nil +} + +func (_ UpdateBuilder) ScanContext(_ context.Context, _ ...interface{}) error { + return nil +} + +func (_ UpdateBuilder) Set(_ string, _ interface{}) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) SetMap(_ map[string]interface{}) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) Suffix(_ string, _ ...interface{}) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) SuffixExpr(_ Sqlizer) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) Table(_ string) UpdateBuilder { + return UpdateBuilder{} +} + +func (_ UpdateBuilder) ToSql() (string, []interface{}, error) { + return "", nil, nil +} + +func (_ UpdateBuilder) Where(_ interface{}, _ ...interface{}) UpdateBuilder { + return UpdateBuilder{} +} diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/couchbase/gocb/stub.go b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/couchbase/gocb/stub.go new file mode 100644 index 000000000000..58b61190f496 --- /dev/null +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/couchbase/gocb/stub.go @@ -0,0 +1,107 @@ +package gocb + +import "time" + +type Cluster struct{} + +func (c *Cluster) ExecuteAnalyticsQuery(q *AnalyticsQuery, options *AnalyticsOptions) (AnalyticsResult, error) { + return nil, nil +} + +func (c *Cluster) ExecuteN1qlQuery(q *N1qlQuery, params interface{}) (QueryResults, error) { + return nil, nil +} + +func (c *Cluster) ExecuteSearchQuery(q *SearchQuery) (SearchResult, error) { + return nil, nil +} + +type AnalyticsOptions struct{} + +type AnalyticsResult interface { + One(valuePtr interface{}) error + Next(valuePtr interface{}) bool + NextBytes() []byte + Close() error +} + +type AnalyticsQuery struct{} + +type N1qlQuery struct{} + +type QueryResults interface { + One(valuePtr interface{}) error + Next(valuePtr interface{}) bool + NextBytes() []byte + Close() error +} + +type SearchQuery struct{} + +type SearchResult interface { + Status() SearchResultStatus + Errors() []string + TotalHits() int + Hits() []SearchResultHit + Facets() map[string]SearchResultFacet + Took() time.Duration + MaxScore() float64 +} + +type SearchResultDateFacet struct { + Name string `json:"name,omitempty"` + Min string `json:"min,omitempty"` + Max string `json:"max,omitempty"` + Count int `json:"count,omitempty"` +} + +type SearchResultFacet struct { + Field string `json:"field,omitempty"` + Total int `json:"total,omitempty"` + Missing int `json:"missing,omitempty"` + Other int `json:"other,omitempty"` + Terms []SearchResultTermFacet `json:"terms,omitempty"` + NumericRanges []SearchResultNumericFacet `json:"numeric_ranges,omitempty"` + DateRanges []SearchResultDateFacet `json:"date_ranges,omitempty"` +} + +type SearchResultHit struct { + Index string `json:"index,omitempty"` + Id string `json:"id,omitempty"` + Score float64 `json:"score,omitempty"` + Explanation map[string]interface{} `json:"explanation,omitempty"` + Locations map[string]map[string][]SearchResultLocation `json:"locations,omitempty"` + Fragments map[string][]string `json:"fragments,omitempty"` + // Deprecated: See AllFields + Fields map[string]string `json:"-"` + // AllFields is to avoid making a breaking change changing the type of Fields. Only + // fields in the response that are of type string will be put into Fields, all + // field types will be placed into AllFields. + AllFields map[string]interface{} `json:"fields,omitempty"` +} + +type SearchResultLocation struct { + Position int `json:"position,omitempty"` + Start int `json:"start,omitempty"` + End int `json:"end,omitempty"` + ArrayPositions []uint `json:"array_positions,omitempty"` +} + +type SearchResultNumericFacet struct { + Name string `json:"name,omitempty"` + Min float64 `json:"min,omitempty"` + Max float64 `json:"max,omitempty"` + Count int `json:"count,omitempty"` +} + +type SearchResultStatus struct { + Total int `json:"total,omitempty"` + Failed int `json:"failed,omitempty"` + Successful int `json:"successful,omitempty"` + Errors interface{} `json:"errors,omitempty"` +} + +type SearchResultTermFacet struct { + Term string `json:"term,omitempty"` + Count int `json:"count,omitempty"` +} diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/couchbase/gocb/v2/stub.go b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/couchbase/gocb/v2/stub.go new file mode 100644 index 000000000000..e51d4d780ede --- /dev/null +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/couchbase/gocb/v2/stub.go @@ -0,0 +1,3073 @@ +// 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,Collection,TransactionAttemptContext,ViewIndexManager; functions: ) + +// Package gocb is a stub of github.com/couchbase/gocb/v2, generated by depstubber. +package gocb + +import ( + context "context" + time "time" +) + +type AllowQueryingSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +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) CreateLink(_ AnalyticsLink, _ *CreateAnalyticsLinkOptions) 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) DropLink(_ string, _ string, _ *DropAnalyticsLinkOptions) error { + return nil +} + +func (_ *AnalyticsIndexManager) GetAllDatasets(_ *GetAllAnalyticsDatasetsOptions) ([]AnalyticsDataset, error) { + return nil, nil +} + +func (_ *AnalyticsIndexManager) GetAllIndexes(_ *GetAllAnalyticsIndexesOptions) ([]AnalyticsIndex, error) { + return nil, nil +} + +func (_ *AnalyticsIndexManager) GetLinks(_ *GetAnalyticsLinksOptions) ([]AnalyticsLink, error) { + return nil, nil +} + +func (_ *AnalyticsIndexManager) GetPendingMutations(_ *GetPendingMutationsAnalyticsOptions) (map[string]map[string]int, error) { + return nil, nil +} + +func (_ *AnalyticsIndexManager) ReplaceLink(_ AnalyticsLink, _ *ReplaceAnalyticsLinkOptions) error { + return nil +} + +type AnalyticsLink interface { + DataverseName() string + FormEncode() ([]byte, error) + LinkType() AnalyticsLinkType + Name() string + Validate() error +} + +type AnalyticsLinkType string + +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 + ParentSpan RequestSpan + Context context.Context + Internal struct { + User string + } +} + +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 + ParentSpan RequestSpan + Context context.Context +} + +type AppendOptions struct { + Timeout time.Duration + DurabilityLevel DurabilityLevel + PersistTo uint + ReplicateTo uint + Cas Cas + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context + Internal struct { + User string + } +} + +type AttemptFunc func(*TransactionAttemptContext) error + +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) CollectionsV2() *CollectionManagerV2 { + 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 + StorageBackend StorageBackend + HistoryRetentionCollectionDefault HistoryRetentionCollectionDefault + HistoryRetentionBytes uint64 + HistoryRetentionDuration time.Duration +} + +type BucketType string + +type BuildDeferredQueryIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + ScopeName string + CollectionName string + Context context.Context +} + +type BulkOp interface{} + +type BulkOpOptions struct { + Timeout time.Duration + Transcoder Transcoder + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type Capability uint32 + +type CapabilityStatus uint32 + +type Cas uint64 + +type ChangePasswordOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +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) EventingFunctions() *EventingFunctionManager { + return nil +} + +func (_ *Cluster) Internal() *InternalCluster { + return 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) Search(_ string, _ SearchRequest, _ *SearchOptions) (*SearchResult, error) { + return nil, nil +} + +func (_ *Cluster) SearchIndexes() *SearchIndexManager { + return nil +} + +func (_ *Cluster) SearchQuery(_ string, _ interface{}, _ *SearchOptions) (*SearchResult, error) { + return nil, nil +} + +func (_ *Cluster) Transactions() *Transactions { + return 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) LookupInAllReplicas(_ string, _ []LookupInSpec, _ *LookupInAllReplicaOptions) (*LookupInAllReplicasResult, error) { + return nil, nil +} + +func (_ *Collection) LookupInAnyReplica(_ string, _ []LookupInSpec, _ *LookupInAnyReplicaOptions) (*LookupInReplicaResult, 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) QueryIndexes() *CollectionQueryIndexManager { + return nil +} + +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) Scan(_ ScanType, _ *ScanOptions) (*ScanResult, 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 CollectionHistorySettings struct { + Enabled bool +} + +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 +} + +func (_ *CollectionManager) UpdateCollection(_ CollectionSpec, _ *UpdateCollectionOptions) error { + return nil +} + +type CollectionManagerV2 struct{} + +func (_ *CollectionManagerV2) CreateCollection(_ string, _ string, _ *CreateCollectionSettings, _ *CreateCollectionOptions) error { + return nil +} + +func (_ *CollectionManagerV2) CreateScope(_ string, _ *CreateScopeOptions) error { + return nil +} + +func (_ *CollectionManagerV2) DropCollection(_ string, _ string, _ *DropCollectionOptions) error { + return nil +} + +func (_ *CollectionManagerV2) DropScope(_ string, _ *DropScopeOptions) error { + return nil +} + +func (_ *CollectionManagerV2) GetAllScopes(_ *GetAllScopesOptions) ([]ScopeSpec, error) { + return nil, nil +} + +func (_ *CollectionManagerV2) UpdateCollection(_ string, _ string, _ UpdateCollectionSettings, _ *UpdateCollectionOptions) error { + return nil +} + +type CollectionQueryIndexManager struct{} + +func (_ *CollectionQueryIndexManager) BuildDeferredIndexes(_ *BuildDeferredQueryIndexOptions) ([]string, error) { + return nil, nil +} + +func (_ *CollectionQueryIndexManager) CreateIndex(_ string, _ []string, _ *CreateQueryIndexOptions) error { + return nil +} + +func (_ *CollectionQueryIndexManager) CreatePrimaryIndex(_ *CreatePrimaryQueryIndexOptions) error { + return nil +} + +func (_ *CollectionQueryIndexManager) DropIndex(_ string, _ *DropQueryIndexOptions) error { + return nil +} + +func (_ *CollectionQueryIndexManager) DropPrimaryIndex(_ *DropPrimaryQueryIndexOptions) error { + return nil +} + +func (_ *CollectionQueryIndexManager) GetAllIndexes(_ *GetAllQueryIndexesOptions) ([]QueryIndex, error) { + return nil, nil +} + +func (_ *CollectionQueryIndexManager) WatchIndexes(_ []string, _ time.Duration, _ *WatchQueryIndexOptions) error { + return nil +} + +type CollectionSpec struct { + Name string + ScopeName string + MaxExpiry time.Duration + History *CollectionHistorySettings +} + +type CompressionMode string + +type ConflictResolutionType string + +type ConnectAnalyticsLinkOptions struct { + LinkName string + DataverseName string + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +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 + ParentSpan RequestSpan + Context context.Context +} + +type CreateAnalyticsDataverseOptions struct { + IgnoreIfExists bool + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type CreateAnalyticsIndexOptions struct { + IgnoreIfExists bool + DataverseName string + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type CreateAnalyticsLinkOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type CreateBucketOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type CreateBucketSettings struct { + BucketSettings BucketSettings + ConflictResolutionType ConflictResolutionType +} + +type CreateCollectionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type CreateCollectionSettings struct { + MaxExpiry time.Duration + History *CollectionHistorySettings +} + +type CreatePrimaryQueryIndexOptions struct { + IgnoreIfExists bool + Deferred bool + CustomName string + NumReplicas int + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + ScopeName string + CollectionName string + Context context.Context +} + +type CreateQueryIndexOptions struct { + IgnoreIfExists bool + Deferred bool + NumReplicas int + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + ScopeName string + CollectionName string + Context context.Context +} + +type CreateScopeOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DecrementOptions struct { + Timeout time.Duration + Expiry time.Duration + Initial int64 + Delta uint64 + DurabilityLevel DurabilityLevel + PersistTo uint + ReplicateTo uint + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Cas Cas + Context context.Context + Internal struct { + User string + } +} + +type DeployEventingFunctionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +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 DisallowQueryingSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DisconnectAnalyticsLinkOptions struct { + LinkName string + DataverseName string + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropAnalyticsDatasetOptions struct { + IgnoreIfNotExists bool + DataverseName string + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropAnalyticsDataverseOptions struct { + IgnoreIfNotExists bool + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropAnalyticsIndexOptions struct { + IgnoreIfNotExists bool + DataverseName string + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropAnalyticsLinkOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropBucketOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropCollectionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropDesignDocumentOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropEventingFunctionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropGroupOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropPrimaryQueryIndexOptions struct { + IgnoreIfNotExists bool + CustomName string + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + ScopeName string + CollectionName string + Context context.Context +} + +type DropQueryIndexOptions struct { + IgnoreIfNotExists bool + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + ScopeName string + CollectionName string + Context context.Context +} + +type DropScopeOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type DropUserOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + DomainName string + ParentSpan RequestSpan + Context context.Context +} + +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 EventingFunction struct { + Name string + Code string + Version string + EnforceSchema bool + HandlerUUID int + FunctionInstanceID string + MetadataKeyspace EventingFunctionKeyspace + SourceKeyspace EventingFunctionKeyspace + BucketBindings []EventingFunctionBucketBinding + UrlBindings []EventingFunctionUrlBinding + ConstantBindings []EventingFunctionConstantBinding + Settings EventingFunctionSettings +} + +func (_ *EventingFunction) MarshalJSON() ([]byte, error) { + return nil, nil +} + +func (_ *EventingFunction) UnmarshalJSON(_ []byte) error { + return nil +} + +type EventingFunctionBucketAccess string + +type EventingFunctionBucketBinding struct { + Alias string + Name EventingFunctionKeyspace + Access EventingFunctionBucketAccess +} + +type EventingFunctionConstantBinding struct { + Alias string + Literal string +} + +type EventingFunctionDCPBoundary string + +type EventingFunctionDeploymentStatus bool + +type EventingFunctionKeyspace struct { + Bucket string + Scope string + Collection string +} + +type EventingFunctionLanguageCompatibility string + +type EventingFunctionLogLevel string + +type EventingFunctionManager struct{} + +func (_ *EventingFunctionManager) DeployFunction(_ string, _ *DeployEventingFunctionOptions) error { + return nil +} + +func (_ *EventingFunctionManager) DropFunction(_ string, _ *DropEventingFunctionOptions) error { + return nil +} + +func (_ *EventingFunctionManager) FunctionsStatus(_ *EventingFunctionsStatusOptions) (*EventingStatus, error) { + return nil, nil +} + +func (_ *EventingFunctionManager) GetAllFunctions(_ *GetAllEventingFunctionsOptions) ([]EventingFunction, error) { + return nil, nil +} + +func (_ *EventingFunctionManager) GetFunction(_ string, _ *GetEventingFunctionOptions) (*EventingFunction, error) { + return nil, nil +} + +func (_ *EventingFunctionManager) PauseFunction(_ string, _ *PauseEventingFunctionOptions) error { + return nil +} + +func (_ *EventingFunctionManager) ResumeFunction(_ string, _ *ResumeEventingFunctionOptions) error { + return nil +} + +func (_ *EventingFunctionManager) UndeployFunction(_ string, _ *UndeployEventingFunctionOptions) error { + return nil +} + +func (_ *EventingFunctionManager) UpsertFunction(_ EventingFunction, _ *UpsertEventingFunctionOptions) error { + return nil +} + +type EventingFunctionProcessingStatus bool + +type EventingFunctionSettings struct { + CPPWorkerThreadCount int + DCPStreamBoundary EventingFunctionDCPBoundary + Description string + DeploymentStatus EventingFunctionDeploymentStatus + ProcessingStatus EventingFunctionProcessingStatus + LanguageCompatibility EventingFunctionLanguageCompatibility + LogLevel EventingFunctionLogLevel + ExecutionTimeout time.Duration + LCBInstCapacity int + LCBRetryCount int + LCBTimeout time.Duration + QueryConsistency QueryScanConsistency + NumTimerPartitions int + SockBatchSize int + TickDuration time.Duration + TimerContextSize int + UserPrefix string + BucketCacheSize int + BucketCacheAge int + CurlMaxAllowedRespSize int + QueryPrepareAll bool + WorkerCount int + HandlerHeaders []string + HandlerFooters []string + EnableAppLogRotation bool + AppLogDir string + AppLogMaxSize int + AppLogMaxFiles int + CheckpointInterval time.Duration +} + +type EventingFunctionState struct { + Name string + Status EventingFunctionStatus + NumBootstrappingNodes int + NumDeployedNodes int + DeploymentStatus EventingFunctionDeploymentStatus + ProcessingStatus EventingFunctionProcessingStatus +} + +type EventingFunctionStatus string + +type EventingFunctionUrlAuth interface { + Key() string + Method() string + Password() string + Username() string +} + +type EventingFunctionUrlBinding struct { + Hostname string + Alias string + Auth EventingFunctionUrlAuth + AllowCookies bool + ValidateSSLCertificate bool +} + +type EventingFunctionsStatusOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type EventingStatus struct { + NumEventingNodes int + Functions []EventingFunctionState +} + +func (_ *EventingStatus) UnmarshalJSON(_ []byte) error { + return nil +} + +type EvictionPolicyType string + +type ExistsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context + Internal struct { + User string + } +} + +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 + ParentSpan RequestSpan + Context context.Context +} + +type FreezePlanSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetAllAnalyticsDatasetsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetAllAnalyticsIndexesOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetAllBucketsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetAllDesignDocumentsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetAllEventingFunctionsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetAllGroupsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetAllQueryIndexesOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + ScopeName string + CollectionName string + Context context.Context +} + +type GetAllReplicaOptions struct { + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + ReadPreference ReadPreference + Context context.Context + Internal struct { + User string + } +} + +type GetAllReplicasResult struct{} + +func (_ *GetAllReplicasResult) Close() error { + return nil +} + +func (_ *GetAllReplicasResult) Next() *GetReplicaResult { + return nil +} + +type GetAllScopesOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetAllSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetAllUsersOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + DomainName string + ParentSpan RequestSpan + Context context.Context +} + +type GetAnalyticsLinksOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Dataverse string + LinkType AnalyticsLinkType + Name string + Context context.Context +} + +type GetAndLockOptions struct { + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context + Internal struct { + User string + } +} + +type GetAndTouchOptions struct { + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context + Internal struct { + User string + } +} + +type GetAnyReplicaOptions struct { + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + ReadPreference ReadPreference + Context context.Context + Internal struct { + User string + } +} + +type GetBucketOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetDesignDocumentOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetEventingFunctionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetGroupOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetIndexedDocumentsCountOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetNodesMetadataOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetOptions struct { + WithExpiry bool + Project []string + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context + Internal struct { + User string + } +} + +type GetPendingMutationsAnalyticsOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +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 + ParentSpan RequestSpan + Context context.Context +} + +type GetSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type GetUserOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + DomainName string + ParentSpan RequestSpan + Context context.Context +} + +type Group struct { + Name string + Description string + Roles []Role + LDAPGroupReference string +} + +type HistoryRetentionCollectionDefault uint8 + +type IncrementOptions struct { + Timeout time.Duration + Expiry time.Duration + Initial int64 + Delta uint64 + DurabilityLevel DurabilityLevel + PersistTo uint + ReplicateTo uint + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Cas Cas + Context context.Context + Internal struct { + User string + } +} + +type InsertOptions struct { + Expiry time.Duration + PersistTo uint + ReplicateTo uint + DurabilityLevel DurabilityLevel + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context + Internal struct { + User string + } +} + +type InternalBucket struct{} + +func (_ *InternalBucket) CapabilityStatus(_ Capability) (CapabilityStatus, error) { + return 0, nil +} + +func (_ *InternalBucket) IORouter() (interface{}, error) { + return nil, nil +} + +type InternalCluster struct{} + +func (_ *InternalCluster) GetNodesMetadata(_ *GetNodesMetadataOptions) ([]NodeMetadata, error) { + return nil, nil +} + +type InternalTransactionAttemptContext struct{} + +func (_ *InternalTransactionAttemptContext) IsExpired() bool { + return false +} + +type LogLevel int + +type LookupInAllReplicaOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + ReadPreference ReadPreference + Context context.Context + Internal struct { + DocFlags SubdocDocFlag + User string + } +} + +type LookupInAllReplicasResult struct{} + +func (_ *LookupInAllReplicasResult) Close() error { + return nil +} + +func (_ *LookupInAllReplicasResult) Next() *LookupInReplicaResult { + return nil +} + +type LookupInAnyReplicaOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + ReadPreference ReadPreference + Context context.Context + Internal struct { + DocFlags SubdocDocFlag + User string + } +} + +type LookupInOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context + Internal struct { + DocFlags SubdocDocFlag + User string + } +} + +type LookupInReplicaResult struct { + LookupInResult *LookupInResult +} + +func (_ LookupInReplicaResult) Cas() Cas { + return 0 +} + +func (_ LookupInReplicaResult) ContentAt(_ uint, _ interface{}) error { + return nil +} + +func (_ LookupInReplicaResult) Exists(_ uint) bool { + return false +} + +func (_ *LookupInReplicaResult) IsReplica() bool { + return false +} + +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 + ParentSpan RequestSpan + PreserveExpiry bool + Context context.Context + Internal struct { + DocFlags SubdocDocFlag + User string + } +} + +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 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 Origin struct { + Type string + Name string +} + +type PauseEventingFunctionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type PauseIngestSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type PingOptions struct { + ServiceTypes []ServiceType + ReportID string + Timeout time.Duration + ParentSpan RequestSpan + Context context.Context +} + +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 + ParentSpan RequestSpan + Context context.Context + Internal struct { + User string + } +} + +type PublishDesignDocumentOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type QueryIndex struct { + Name string + IsPrimary bool + Type QueryIndexType + State string + Keyspace string + Namespace string + IndexKey []string + Condition string + Partition string + CollectionName string + ScopeName string + BucketName 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 + PreserveExpiry bool + ParentSpan RequestSpan + Context context.Context + AsTransaction *SingleQueryTransactionOptions + UseReplica QueryUseReplicaLevel + Internal struct { + User string + Endpoint string + } +} + +type QueryProfileMode string + +type QueryResult struct{} + +func (_ *QueryResult) Close() error { + return nil +} + +func (_ *QueryResult) Err() error { + return nil +} + +func (_ *QueryResult) Internal() *QueryResultInternal { + 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 QueryResultInternal struct{} + +func (_ *QueryResultInternal) Endpoint() string { + return "" +} + +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 QueryUseReplicaLevel uint + +type QueryWarning struct { + Code uint32 + Message string +} + +type ReadPreference uint8 + +type RemoveOptions struct { + Cas Cas + PersistTo uint + ReplicateTo uint + DurabilityLevel DurabilityLevel + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context + Internal struct { + User string + } +} + +type ReplaceAnalyticsLinkOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type ReplaceOptions struct { + Expiry time.Duration + Cas Cas + PersistTo uint + ReplicateTo uint + DurabilityLevel DurabilityLevel + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + PreserveExpiry bool + Context context.Context + Internal struct { + User string + } +} + +type RequestSpan interface { + AddEvent(_ string, _ time.Time) + Context() RequestSpanContext + End() + SetAttribute(_ string, _ interface{}) +} + +type RequestSpanContext interface{} + +type Result struct{} + +func (_ *Result) Cas() Cas { + return 0 +} + +type ResumeEventingFunctionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type ResumeIngestSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +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 ScanOptions struct { + Transcoder Transcoder + Timeout time.Duration + ParentSpan RequestSpan + Context context.Context + IDsOnly bool + ConsistentWith *MutationState + BatchByteLimit *uint32 + BatchItemLimit *uint32 + Concurrency uint16 + Internal struct { + User string + } +} + +type ScanResult struct{} + +func (_ *ScanResult) Close() error { + return nil +} + +func (_ *ScanResult) Err() error { + return nil +} + +func (_ *ScanResult) Next() *ScanResultItem { + return nil +} + +type ScanResultItem struct { + Result Result +} + +func (_ *ScanResultItem) Cas() Cas { + return 0 +} + +func (_ *ScanResultItem) Content(_ interface{}) error { + return nil +} + +func (_ *ScanResultItem) ExpiryTime() time.Time { + return time.Time{} +} + +func (_ *ScanResultItem) ID() string { + return "" +} + +func (_ *ScanResultItem) IDOnly() bool { + return false +} + +type ScanType interface{} + +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) EventingFunctions() *ScopeEventingFunctionManager { + return nil +} + +func (_ *Scope) Name() string { + return "" +} + +func (_ *Scope) Query(_ string, _ *QueryOptions) (*QueryResult, error) { + return nil, nil +} + +func (_ *Scope) Search(_ string, _ SearchRequest, _ *SearchOptions) (*SearchResult, error) { + return nil, nil +} + +func (_ *Scope) SearchIndexes() *ScopeSearchIndexManager { + return nil +} + +type ScopeEventingFunctionManager struct{} + +func (_ *ScopeEventingFunctionManager) DeployFunction(_ string, _ *DeployEventingFunctionOptions) error { + return nil +} + +func (_ *ScopeEventingFunctionManager) DropFunction(_ string, _ *DropEventingFunctionOptions) error { + return nil +} + +func (_ *ScopeEventingFunctionManager) FunctionsStatus(_ *EventingFunctionsStatusOptions) (*EventingStatus, error) { + return nil, nil +} + +func (_ *ScopeEventingFunctionManager) GetAllFunctions(_ *GetAllEventingFunctionsOptions) ([]EventingFunction, error) { + return nil, nil +} + +func (_ *ScopeEventingFunctionManager) GetFunction(_ string, _ *GetEventingFunctionOptions) (*EventingFunction, error) { + return nil, nil +} + +func (_ *ScopeEventingFunctionManager) PauseFunction(_ string, _ *PauseEventingFunctionOptions) error { + return nil +} + +func (_ *ScopeEventingFunctionManager) ResumeFunction(_ string, _ *ResumeEventingFunctionOptions) error { + return nil +} + +func (_ *ScopeEventingFunctionManager) UndeployFunction(_ string, _ *UndeployEventingFunctionOptions) error { + return nil +} + +func (_ *ScopeEventingFunctionManager) UpsertFunction(_ EventingFunction, _ *UpsertEventingFunctionOptions) error { + return nil +} + +type ScopeSearchIndexManager struct{} + +func (_ *ScopeSearchIndexManager) AllowQuerying(_ string, _ *AllowQueryingSearchIndexOptions) error { + return nil +} + +func (_ *ScopeSearchIndexManager) AnalyzeDocument(_ string, _ interface{}, _ *AnalyzeDocumentOptions) ([]interface{}, error) { + return nil, nil +} + +func (_ *ScopeSearchIndexManager) DisallowQuerying(_ string, _ *DisallowQueryingSearchIndexOptions) error { + return nil +} + +func (_ *ScopeSearchIndexManager) DropIndex(_ string, _ *DropSearchIndexOptions) error { + return nil +} + +func (_ *ScopeSearchIndexManager) FreezePlan(_ string, _ *FreezePlanSearchIndexOptions) error { + return nil +} + +func (_ *ScopeSearchIndexManager) GetAllIndexes(_ *GetAllSearchIndexOptions) ([]SearchIndex, error) { + return nil, nil +} + +func (_ *ScopeSearchIndexManager) GetIndex(_ string, _ *GetSearchIndexOptions) (*SearchIndex, error) { + return nil, nil +} + +func (_ *ScopeSearchIndexManager) GetIndexedDocumentsCount(_ string, _ *GetIndexedDocumentsCountOptions) (uint64, error) { + return 0, nil +} + +func (_ *ScopeSearchIndexManager) PauseIngest(_ string, _ *PauseIngestSearchIndexOptions) error { + return nil +} + +func (_ *ScopeSearchIndexManager) ResumeIngest(_ string, _ *ResumeIngestSearchIndexOptions) error { + return nil +} + +func (_ *ScopeSearchIndexManager) UnfreezePlan(_ string, _ *UnfreezePlanSearchIndexOptions) error { + return nil +} + +func (_ *ScopeSearchIndexManager) UpsertIndex(_ SearchIndex, _ *UpsertSearchIndexOptions) error { + return 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{} +} + +func (_ *SearchIndex) MarshalJSON() ([]byte, error) { + return nil, nil +} + +func (_ *SearchIndex) UnmarshalJSON(_ []byte) error { + return nil +} + +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 + Collections []string + ParentSpan RequestSpan + Context context.Context + IncludeLocations bool + Internal struct { + User string + } +} + +type SearchRequest struct { + SearchQuery interface{} + VectorSearch interface{} +} + +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 SingleQueryTransactionOptions struct { + DurabilityLevel DurabilityLevel + Internal struct { + Hooks TransactionHooks + } +} + +type StorageBackend string + +type StoreSemantics uint8 + +type SubdocDocFlag uint8 + +type TouchOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context + Internal struct { + User string + } +} + +type TransactionAttemptContext struct{} + +func (_ *TransactionAttemptContext) Get(_ *Collection, _ string) (*TransactionGetResult, error) { + return nil, nil +} + +func (_ *TransactionAttemptContext) GetReplicaFromPreferredServerGroup(_ *Collection, _ string) (*TransactionGetResult, error) { + return nil, nil +} + +func (_ *TransactionAttemptContext) Insert(_ *Collection, _ string, _ interface{}) (*TransactionGetResult, error) { + return nil, nil +} + +func (_ *TransactionAttemptContext) Internal() *InternalTransactionAttemptContext { + return nil +} + +func (_ *TransactionAttemptContext) Query(_ string, _ *TransactionQueryOptions) (*TransactionQueryResult, error) { + return nil, nil +} + +func (_ *TransactionAttemptContext) Remove(_ *TransactionGetResult) error { + return nil +} + +func (_ *TransactionAttemptContext) Replace(_ *TransactionGetResult, _ interface{}) (*TransactionGetResult, error) { + return nil, nil +} + +type TransactionAttemptState int + +type TransactionCleanupAttempt struct { + Success bool + IsReqular bool + AttemptID string + AtrID string + AtrCollectionName string + AtrScopeName string + AtrBucketName string + Request *TransactionCleanupRequest +} + +type TransactionCleanupRequest struct { + AttemptID string + AtrID string + AtrCollectionName string + AtrScopeName string + AtrBucketName string + Inserts []TransactionDocRecord + Replaces []TransactionDocRecord + Removes []TransactionDocRecord + State TransactionAttemptState + ForwardCompat map[string][]TransactionsForwardCompatibilityEntry +} + +type TransactionDocRecord struct { + CollectionName string + ScopeName string + BucketName string + ID string +} + +type TransactionGetResult struct{} + +func (_ *TransactionGetResult) Content(_ interface{}) error { + return nil +} + +type TransactionHooks interface { + AfterATRAborted(_ TransactionAttemptContext) error + AfterATRCommit(_ TransactionAttemptContext) error + AfterATRComplete(_ TransactionAttemptContext) error + AfterATRPending(_ TransactionAttemptContext) error + AfterATRRolledBack(_ TransactionAttemptContext) error + AfterDocCommitted(_ TransactionAttemptContext, _ string) error + AfterDocCommittedBeforeSavingCAS(_ TransactionAttemptContext, _ string) error + AfterDocRemovedPostRetry(_ TransactionAttemptContext, _ string) error + AfterDocRemovedPreRetry(_ TransactionAttemptContext, _ string) error + AfterDocsCommitted(_ TransactionAttemptContext) error + AfterDocsRemoved(_ TransactionAttemptContext) error + AfterGetComplete(_ TransactionAttemptContext, _ string) error + AfterQuery(_ TransactionAttemptContext, _ string) error + AfterRemoveStagedInsert(_ TransactionAttemptContext, _ string) error + AfterRollbackDeleteInserted(_ TransactionAttemptContext, _ string) error + AfterRollbackReplaceOrRemove(_ TransactionAttemptContext, _ string) error + AfterStagedInsertComplete(_ TransactionAttemptContext, _ string) error + AfterStagedRemoveComplete(_ TransactionAttemptContext, _ string) error + AfterStagedReplaceComplete(_ TransactionAttemptContext, _ string) error + BeforeATRAborted(_ TransactionAttemptContext) error + BeforeATRCommit(_ TransactionAttemptContext) error + BeforeATRCommitAmbiguityResolution(_ TransactionAttemptContext) error + BeforeATRComplete(_ TransactionAttemptContext) error + BeforeATRPending(_ TransactionAttemptContext) error + BeforeATRRolledBack(_ TransactionAttemptContext) error + BeforeCheckATREntryForBlockingDoc(_ TransactionAttemptContext, _ string) error + BeforeDocCommitted(_ TransactionAttemptContext, _ string) error + BeforeDocGet(_ TransactionAttemptContext, _ string) error + BeforeDocRemoved(_ TransactionAttemptContext, _ string) error + BeforeDocRolledBack(_ TransactionAttemptContext, _ string) error + BeforeGetDocInExistsDuringStagedInsert(_ TransactionAttemptContext, _ string) error + BeforeQuery(_ TransactionAttemptContext, _ string) error + BeforeRemoveStagedInsert(_ TransactionAttemptContext, _ string) error + BeforeRemovingDocDuringStagedInsert(_ TransactionAttemptContext, _ string) error + BeforeRollbackDeleteInserted(_ TransactionAttemptContext, _ string) error + BeforeStagedInsert(_ TransactionAttemptContext, _ string) error + BeforeStagedRemove(_ TransactionAttemptContext, _ string) error + BeforeStagedReplace(_ TransactionAttemptContext, _ string) error + HasExpiredClientSideHook(_ TransactionAttemptContext, _ string, _ string) (bool, error) + RandomATRIDForVbucket(_ TransactionAttemptContext) (string, error) +} + +type TransactionLogItem struct { + Level LogLevel +} + +func (_ TransactionLogItem) String() string { + return "" +} + +type TransactionOptions struct { + DurabilityLevel DurabilityLevel + Timeout time.Duration + MetadataCollection *Collection + Internal struct { + Hooks TransactionHooks + } +} + +type TransactionQueryOptions struct { + ScanConsistency QueryScanConsistency + Profile QueryProfileMode + ScanCap uint32 + PipelineBatch uint32 + PipelineCap uint32 + ScanWait time.Duration + Readonly bool + ClientContextID string + PositionalParameters []interface{} + NamedParameters map[string]interface{} + FlexIndex bool + Raw map[string]interface{} + Prepared bool + Scope *Scope +} + +type TransactionQueryResult struct{} + +func (_ *TransactionQueryResult) MetaData() (*QueryMetaData, error) { + return nil, nil +} + +func (_ *TransactionQueryResult) Next() bool { + return false +} + +func (_ *TransactionQueryResult) One(_ interface{}) error { + return nil +} + +func (_ *TransactionQueryResult) Row(_ interface{}) error { + return nil +} + +type TransactionResult struct { + TransactionID string + UnstagingComplete bool + Logs []TransactionLogItem +} + +type Transactions struct{} + +func (_ *Transactions) Internal() *TransactionsInternal { + return nil +} + +func (_ *Transactions) Run(_ AttemptFunc, _ *TransactionOptions) (*TransactionResult, error) { + return nil, nil +} + +type TransactionsForwardCompatibilityEntry struct { + ProtocolVersion string + ProtocolExtension string + Behaviour string + RetryInterval int +} + +type TransactionsInternal struct{} + +func (_ *TransactionsInternal) CleanupLocations() []interface{} { + return nil +} + +func (_ *TransactionsInternal) CleanupQueueLength() int32 { + return 0 +} + +func (_ *TransactionsInternal) ClientCleanupEnabled() bool { + return false +} + +func (_ *TransactionsInternal) ForceCleanupQueue() []TransactionCleanupAttempt { + return nil +} + +type Transcoder interface { + Decode(_ []byte, _ uint32, _ interface{}) error + Encode(_ interface{}) ([]byte, uint32, error) +} + +type UndeployEventingFunctionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type UnfreezePlanSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type UnlockOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context + Internal struct { + User string + } +} + +type UpdateBucketOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type UpdateCollectionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type UpdateCollectionSettings struct { + MaxExpiry time.Duration + History *CollectionHistorySettings +} + +type UpsertDesignDocumentOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type UpsertEventingFunctionOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type UpsertGroupOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type UpsertOptions struct { + Expiry time.Duration + PersistTo uint + ReplicateTo uint + DurabilityLevel DurabilityLevel + Transcoder Transcoder + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + PreserveExpiry bool + Context context.Context + Internal struct { + User string + } +} + +type UpsertSearchIndexOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + ParentSpan RequestSpan + Context context.Context +} + +type UpsertUserOptions struct { + Timeout time.Duration + RetryStrategy RetryStrategy + DomainName string + ParentSpan RequestSpan + Context context.Context +} + +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) ChangePassword(_ string, _ *ChangePasswordOptions) error { + return nil +} + +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 + ParentSpan RequestSpan + Raw map[string]string + Namespace DesignDocumentNamespace + Timeout time.Duration + RetryStrategy RetryStrategy + Context context.Context + Internal struct { + User string + } +} + +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 + Context context.Context + RetryStrategy RetryStrategy +} + +type WatchQueryIndexOptions struct { + WatchPrimary bool + RetryStrategy RetryStrategy + ParentSpan RequestSpan + ScopeName string + CollectionName string + Context context.Context +} diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/gogf/gf/database/gdb/stub.go b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/gogf/gf/database/gdb/stub.go new file mode 100644 index 000000000000..a537cccd8cb3 --- /dev/null +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/gogf/gf/database/gdb/stub.go @@ -0,0 +1,60 @@ +package gdb + +import ( + "context" + "database/sql" +) + +type DB interface { + Query(sql string, args ...interface{}) (*sql.Rows, error) + Exec(sql string, args ...interface{}) (sql.Result, error) + + DoGetAll(ctx context.Context, link Link, sql string, args ...interface{}) (result Result, err error) + DoUpdate(ctx context.Context, link Link, table string, data interface{}, condition string, args ...interface{}) (result sql.Result, err error) + DoDelete(ctx context.Context, link Link, table string, condition string, args ...interface{}) (result sql.Result, err error) + DoQuery(ctx context.Context, link Link, sql string, args ...interface{}) (rows *sql.Rows, err error) + DoExec(ctx context.Context, link Link, sql string, args ...interface{}) (result sql.Result, err error) + DoCommit(ctx context.Context, link Link, sql string, args []interface{}) (newSql string, newArgs []interface{}, err error) + + GetAll(sql string, args ...interface{}) (Result, error) + GetOne(sql string, args ...interface{}) (Record, error) + GetValue(sql string, args ...interface{}) (Value, error) + GetArray(sql string, args ...interface{}) ([]Value, error) + GetCount(sql string, args ...interface{}) (int, error) + GetScan(objPointer interface{}, sql string, args ...interface{}) error + Union(unions ...*Model) *Model + UnionAll(unions ...*Model) *Model + + Master(schema ...string) (*sql.DB, error) + Slave(schema ...string) (*sql.DB, error) + + PingMaster() error + PingSlave() error + + Begin() (*TX, error) + Transaction(ctx context.Context, f func(ctx context.Context, tx *TX) error) error +} + +func New(group ...string) (DB, error) { + return nil, nil +} + +type Link interface { + Query(sql string, args ...interface{}) (*sql.Rows, error) + Exec(sql string, args ...interface{}) (sql.Result, error) + Prepare(sql string) (*sql.Stmt, error) + QueryContext(ctx context.Context, sql string, args ...interface{}) (*sql.Rows, error) + ExecContext(ctx context.Context, sql string, args ...interface{}) (sql.Result, error) + PrepareContext(ctx context.Context, sql string) (*sql.Stmt, error) + IsTransaction() bool +} + +type Model struct{} + +type Record map[string]Value + +type Result []Record + +type Value interface{} + +type TX struct{} diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/nonexistent/sources/stub.go b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/nonexistent/sources/stub.go new file mode 100644 index 000000000000..a691fe06dc85 --- /dev/null +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/github.com/nonexistent/sources/stub.go @@ -0,0 +1,5 @@ +package nonexistent + +func Source[T any]() T { + return *new(T) +} diff --git a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/modules.txt b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/modules.txt index 333381508d66..13f1f8e8a845 100644 --- a/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/modules.txt +++ b/go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database/vendor/modules.txt @@ -7,3 +7,6 @@ github.com/jmoiron/sqlx # go.mongodb.org/mongo-driver/mongo v1.17.2 ## explicit go.mongodb.org/mongo-driver/mongo +# github.com/nonexistent/sources v0.0.0-20250300000000-000000000000 +## explicit +github.com/nonexistent/sources \ No newline at end of file diff --git a/go/ql/test/query-tests/Security/CWE-079/StoredXss.expected b/go/ql/test/query-tests/Security/CWE-079/StoredXss.expected index 89612f9722b7..81d828c39d06 100644 --- a/go/ql/test/query-tests/Security/CWE-079/StoredXss.expected +++ b/go/ql/test/query-tests/Security/CWE-079/StoredXss.expected @@ -10,6 +10,7 @@ edges | stored.go:59:30:59:33 | definition of path | stored.go:61:22:61:25 | path | provenance | | models | 1 | Source: database/sql; DB; true; Query; ; ; ReturnValue[0]; database; manual | +| 2 | Summary: database/sql; Rows; true; Scan; ; ; Argument[receiver]; Argument[0]; taint; manual | nodes | StoredXss.go:13:21:13:31 | call to Name | semmle.label | call to Name | | StoredXss.go:13:21:13:36 | ...+... | semmle.label | ...+... |