├── .appveyor
└── test.ps1
├── .github
└── ISSUE_TEMPLATE.md
├── .gitignore
├── .gitmodules
├── CONTRIBUTING.md
├── Jenkinsfile
├── LICENSE
├── Notes
├── CIAndVersions.md
└── StyleGuidelines.md
├── README.md
├── Tools
└── Touch.Server
│ ├── Main.cs
│ └── Options.cs
├── appveyor.yml
├── core_version.ini
├── jim_borden.gpg
├── packaging
└── nuget
│ ├── LICENSE.txt
│ ├── README.md
│ ├── do_clean.ps1
│ ├── do_package.ps1
│ └── logo.png
└── src
├── AssemblyInfo.props
├── Couchbase.Lite.Shared
├── API
│ ├── Conflict
│ │ ├── Conflict.cs
│ │ ├── ConflictResolver.cs
│ │ ├── DefaultConflictResolver.cs
│ │ └── IConflictResolver.cs
│ ├── DI
│ │ ├── CouchbaseDependencyAttribute.cs
│ │ ├── IDefaultDirectoryResolver.cs
│ │ ├── IMainThreadTaskScheduler.cs
│ │ ├── IProxy.cs
│ │ ├── IReachability.cs
│ │ ├── IRuntimePlatform.cs
│ │ └── Service.cs
│ ├── Database
│ │ ├── Collection.cs
│ │ ├── CollectionChangedEventArgs.cs
│ │ ├── Database.cs
│ │ ├── DatabaseChangedEventArgs.cs
│ │ ├── DatabaseConfiguration.cs
│ │ ├── DocumentChangedEventArgs.cs
│ │ ├── Interfaces
│ │ │ └── IChangeObservable.cs
│ │ ├── ListenerToken.cs
│ │ └── Scope.cs
│ ├── Document
│ │ ├── ArrayObject.cs
│ │ ├── Blob.cs
│ │ ├── DictionaryObject.cs
│ │ ├── Document+private.cs
│ │ ├── Document.cs
│ │ ├── DocumentFragment.cs
│ │ ├── IArray.cs
│ │ ├── IDictionaryObject.cs
│ │ ├── IFragment.cs
│ │ ├── IJSON.cs
│ │ ├── IMutableArray.cs
│ │ ├── IMutableDictionary.cs
│ │ ├── IMutableFragment.cs
│ │ ├── MutableArrayObject.cs
│ │ ├── MutableDictionaryObject.cs
│ │ └── MutableDocument.cs
│ ├── Info
│ │ ├── CouchbaseLiteErrorMessage.cs
│ │ ├── CouchbaseLiteErrorMessageNetOnly.cs
│ │ ├── Defaults.cs
│ │ └── Defaults_Deprecated.cs
│ ├── Log
│ │ ├── ConsoleLogger.cs
│ │ ├── FileLogger.cs
│ │ ├── ILogger.cs
│ │ └── Log.cs
│ ├── Query
│ │ ├── ArrayExpression.cs
│ │ ├── ArrayFunction.cs
│ │ ├── ArrayIndexConfiguration.cs
│ │ ├── Collation.cs
│ │ ├── DataSource.cs
│ │ ├── Expression.cs
│ │ ├── FullTextExpression.cs
│ │ ├── FullTextFunction.cs
│ │ ├── FullTextIndexConfiguration.cs
│ │ ├── Function.cs
│ │ ├── IArrayExpression.cs
│ │ ├── ICollation.cs
│ │ ├── IDataSource.cs
│ │ ├── IExpression.cs
│ │ ├── IFrom.cs
│ │ ├── IFromRouter.cs
│ │ ├── IFullTextExpression.cs
│ │ ├── IFullTextIndexExpression.cs
│ │ ├── IGroupBy.cs
│ │ ├── IGroupByRouter.cs
│ │ ├── IHaving.cs
│ │ ├── IHavingRouter.cs
│ │ ├── IIndex.cs
│ │ ├── IIndexExpression.cs
│ │ ├── IIndexItem.cs
│ │ ├── IIndexable.cs
│ │ ├── IJoin.cs
│ │ ├── IJoinRouter.cs
│ │ ├── ILimit.cs
│ │ ├── ILimitRouter.cs
│ │ ├── IMetaExpression.cs
│ │ ├── IOrderBy.cs
│ │ ├── IOrderByRouter.cs
│ │ ├── IPropertyExpression.cs
│ │ ├── IQuery.cs
│ │ ├── IQueryFactory.cs
│ │ ├── IQueryIndex.cs
│ │ ├── IResultSet.cs
│ │ ├── ISelect.cs
│ │ ├── ISelectResult.cs
│ │ ├── IVariableExpression.cs
│ │ ├── IWhere.cs
│ │ ├── IWhereRouter.cs
│ │ ├── IndexBuilder.cs
│ │ ├── IndexItem.cs
│ │ ├── Joins.cs
│ │ ├── Meta.cs
│ │ ├── Ordering.cs
│ │ ├── Parameters.cs
│ │ ├── QueryBuilder.cs
│ │ ├── Result.cs
│ │ ├── SelectResult.cs
│ │ └── ValueIndexConfiguration.cs
│ ├── RuntimeException.cs
│ └── Sync
│ │ ├── Authenticator.cs
│ │ ├── BackgroundMonitor.cs
│ │ ├── BasicAuthenticator.cs
│ │ ├── CollectionConfiguration.cs
│ │ ├── IEndpoint.cs
│ │ ├── ProxyAuthenticator.cs
│ │ ├── ReplicationActivityLevel.cs
│ │ ├── Replicator+Backgrounding.cs
│ │ ├── Replicator.cs
│ │ ├── ReplicatorConfiguration.cs
│ │ ├── ReplicatorProgress.cs
│ │ ├── ReplicatorStatus.cs
│ │ ├── ReplicatorStatusChangedEventArgs.cs
│ │ ├── SessionAuthenticator.cs
│ │ └── URLEndpoint.cs
├── Couchbase.Lite.Shared.projitems
├── Couchbase.Lite.Shared.shproj
├── Document
│ ├── BlobReadStream.cs
│ ├── BlobWriteStream.cs
│ ├── DataOps.cs
│ ├── DocContext.cs
│ ├── Fragment.cs
│ ├── InMemoryDictionary.cs
│ └── MRoot.cs
├── Linq
│ ├── IDocumentModel.cs
│ ├── ISelectResultContainer.cs
│ ├── LinqExtensionMethods.cs
│ ├── LiteCoreExpressionVisitor.cs
│ ├── LiteCoreOrderingExpressionVisitor.cs
│ ├── LiteCoreQueryExecutor.cs
│ ├── LiteCoreQueryModelVisitor.cs
│ ├── LiteCoreSelectExpressionVisitor.cs
│ ├── LiteCoreWhereExpressionVisitor.cs
│ └── NotSupportedExpressionVisitor.cs
├── Log
│ ├── Log.cs
│ ├── LogDomains.cs
│ ├── LogJsonString.cs
│ ├── LogTo.cs
│ └── SecureLogString.cs
├── Query
│ ├── DataSource.cs
│ ├── DatabaseQueryable.cs
│ ├── DatabaseSource.cs
│ ├── From.cs
│ ├── Having.cs
│ ├── IndexConfiguration.cs
│ ├── Join.cs
│ ├── LimitedQuery.cs
│ ├── LiveQuerier.cs
│ ├── NQuery.cs
│ ├── NullResultSet.cs
│ ├── QueryBase.cs
│ ├── QueryBinaryExpression.cs
│ ├── QueryCollation.cs
│ ├── QueryCompoundExpression.cs
│ ├── QueryConstantExpression.cs
│ ├── QueryExpression.cs
│ ├── QueryGroupBy.cs
│ ├── QueryIndex.cs
│ ├── QueryIndexItem.cs
│ ├── QueryOrdering.cs
│ ├── QueryResultContext.cs
│ ├── QueryResultSet.cs
│ ├── QuerySelectResult.cs
│ ├── QueryTernaryExpression.cs
│ ├── QueryTypeExpression.cs
│ ├── QueryUnaryExpression.cs
│ ├── Select.cs
│ ├── Where.cs
│ └── XQuery.cs
├── Serialization
│ ├── FLValueConverter.cs
│ ├── FleeceMutableArray.cs
│ ├── JsonFLValueReader.cs
│ ├── JsonFLValueWriter.cs
│ ├── MCollection.cs
│ ├── MContext.cs
│ ├── MDict.cs
│ └── MValue.cs
├── Support
│ ├── Android
│ │ ├── AndroidConsoleLogger.cs
│ │ ├── AndroidRuntimePlatform.cs
│ │ ├── DefaultDirectoryResolver.cs
│ │ ├── DotnetAndroidProxy.cs
│ │ └── MainThreadTaskScheduler.cs
│ ├── Freezer.cs
│ ├── IStoppable.cs
│ ├── IThreadSafety.cs
│ ├── SerialQueue.cs
│ ├── Status.cs
│ ├── ThreadSafety.cs
│ ├── WinUI
│ │ ├── DefaultDirectoryResolver.cs
│ │ ├── Reachability.cs
│ │ ├── WinUIConsoleLogger.cs
│ │ ├── WinUIProxy.cs
│ │ └── WinUIRuntimePlatform.cs
│ ├── iOS
│ │ ├── DefaultDirectoryResolver.cs
│ │ ├── IOSProxy.cs
│ │ ├── MainThreadTaskScheduler.cs
│ │ ├── iOSConsoleLogger.cs
│ │ ├── iOSReachability.cs
│ │ └── iOSRuntimePlatform.cs
│ └── netdesktop
│ │ ├── DefaultDirectoryResolver.cs
│ │ ├── DesktopConsoleLogger.cs
│ │ ├── LinuxProxy.cs
│ │ ├── MacProxy.cs
│ │ └── WindowsProxy.cs
├── Sync
│ ├── AuthOptionsDictionary.cs
│ ├── HTTPLogic.cs
│ ├── HttpMessageParser.cs
│ ├── Reachability.cs
│ ├── ReplicatorOptionsDictionary.cs
│ ├── WebSocketTransport.cs
│ └── WebSocketWrapper.cs
└── Util
│ ├── AtomicBool.cs
│ ├── CBDebug.cs
│ ├── DisposalWatchdog.cs
│ ├── Extensions.cs
│ ├── FilteredEvent.cs
│ ├── Misc.cs
│ ├── NonNullDictionary.cs
│ ├── OptionsDictionary.cs
│ └── RunOnce.cs
├── Couchbase.Lite.Support.Android
├── Activate.cs
├── Couchbase.Lite.Support.Android.csproj
└── Properties
│ └── AssemblyInfo.cs
├── Couchbase.Lite.Support.Apple
├── Activate.cs
└── iOS
│ └── Couchbase.Lite.Support.iOS.csproj
├── Couchbase.Lite.Support.NetDesktop
├── Activate.cs
├── Couchbase.Lite.Support.NetDesktop.csproj
└── desktop.props
├── Couchbase.Lite.Support.WinUI
├── Activate.cs
└── Couchbase.Lite.Support.WinUI.csproj
├── Couchbase.Lite.Tests.NetCore
├── C
│ └── tests
│ │ └── data
│ │ └── names_100.json
├── Couchbase.Lite.Tests.NetCore.csproj
├── Couchbase.Lite.Tests.NetCore.sln
├── coverage.xml
├── modify_packages.ps1
├── modify_packages.sh
└── replacedb
│ ├── android140-sqlite-noattachment.cblite2.zip
│ ├── android140-sqlite.cblite2.zip
│ └── android200-sqlite.cblite2.zip
├── Couchbase.Lite.Tests.Shared
├── ArrayIndexTest.cs
├── ArrayTest.cs
├── BlobTest.cs
├── C
│ └── tests
│ │ └── data
│ │ ├── SelfSigned.cer
│ │ ├── attachment.png
│ │ ├── certs.p12
│ │ ├── certs.pfx
│ │ ├── client-ca.der
│ │ ├── client.p12
│ │ ├── client.pfx
│ │ ├── create_new_chain.sh
│ │ ├── iTunesMusicLibrary.json
│ │ ├── names_100.json
│ │ ├── nested.json
│ │ ├── paths.json
│ │ ├── profiles_100.json
│ │ ├── sentences.json
│ │ └── states_titlecase.json
├── CSharpTest.cs
├── ConcurrencyTest.cs
├── Couchbase.Lite.Tests.Shared.projitems
├── Couchbase.Lite.Tests.Shared.shproj
├── CouchbaseTestFramework.cs
├── DatabaseEncryptionTest.cs
├── DatabaseTest.cs
├── DictionaryTest.cs
├── DocPerfTest.cs
├── DocumentTest.cs
├── FragmentTest.cs
├── LoadTest.cs
├── LogTest.cs
├── MigrationTest.cs
├── MmapTest.cs
├── NotificationTest.cs
├── P2PTest.cs
├── PerfTest.cs
├── PredictiveQueryTest.cs
├── QueryTest.cs
├── ReplicationTest.cs
├── SQLiteOptionsTest.cs
├── ScopeCollectionTest.cs
├── ScopesCollections.QueryTest.cs
├── ScopesCollections.ReplicationTest.cs
├── TLSIdentityTest.cs
├── TestCase.cs
├── TunesPerfTest.cs
├── URLEndpointListenerTest.cs
├── Util
│ ├── Benchmark.cs
│ ├── ForIssueAttribute.cs
│ ├── IMockConnectionErrorLogic.cs
│ ├── ImplementsTestSpecAttribute.cs
│ ├── MockConnection.cs
│ ├── Try.cs
│ ├── WaitAssert.cs
│ └── XunitLogger.cs
├── VersionVectorTests.cs
├── WebSocketTest.cs
├── replacedb
│ ├── android140-sqlite-noattachment.cblite2.zip
│ ├── android140-sqlite.cblite2.zip
│ └── android200-sqlite.cblite2.zip
└── xunit.runner.json
├── Couchbase.Lite.sln
├── Couchbase.Lite
├── Couchbase.Lite.csproj
└── Properties
│ └── AssemblyInfo.cs
├── LiteCore
├── LiteCore.sln
├── binding_list
│ └── c4.def
├── generate_bindings.ps1
├── parse
│ ├── config_c4.py
│ ├── config_fleece.py
│ ├── parse_API.py
│ ├── parse_enums.py
│ ├── parse_structs.py
│ ├── templates_c4
│ │ ├── C4ExternalKeyCallbacks.cs
│ │ ├── C4ExtraInfo_literal.cs
│ │ ├── C4ListenerConfig.cs
│ │ ├── C4PredictiveModel.cs
│ │ ├── C4ReplicationCollection.cs
│ │ ├── C4ReplicatorParameters.cs
│ │ ├── C4SocketFactory.cs
│ │ ├── C4TLSConfig.cs
│ │ ├── UIntPtr.cs
│ │ ├── bool.cs
│ │ ├── delegate.cs
│ │ ├── header.cs
│ │ └── string.cs
│ └── templates_fleece
│ │ ├── FLArrayIterator_literal.cs
│ │ ├── FLDictIterator_literal.cs
│ │ ├── FLDictKey_literal.cs
│ │ ├── UIntPtr.cs
│ │ ├── bool.cs
│ │ └── header.cs
└── src
│ └── LiteCore.Shared
│ ├── API
│ ├── CouchbaseLiteException.cs
│ └── NativeWrapper.cs
│ ├── Constants.cs
│ ├── Interop
│ ├── C4Base.cs
│ ├── C4Base_defs.cs
│ ├── C4Base_native.cs
│ ├── C4BlobStore.cs
│ ├── C4BlobStoreTypes_defs.cs
│ ├── C4BlobStore_native.cs
│ ├── C4BlobStore_native_safe.cs
│ ├── C4Certificate.cs
│ ├── C4CertificateTypes_defs.cs
│ ├── C4Certificate_native.cs
│ ├── C4Collection_native.cs
│ ├── C4Collection_native_safe.cs
│ ├── C4Database.cs
│ ├── C4DatabaseTypes_defs.cs
│ ├── C4Database_native.cs
│ ├── C4Database_native_safe.cs
│ ├── C4DocEnumerator.cs
│ ├── C4DocEnumeratorTypes_defs.cs
│ ├── C4Document+Fleece_native.cs
│ ├── C4Document+Fleece_native_safe.cs
│ ├── C4Document.cs
│ ├── C4DocumentTypes_defs.cs
│ ├── C4Document_native.cs
│ ├── C4Document_native_safe.cs
│ ├── C4Error_defs.cs
│ ├── C4Error_native.cs
│ ├── C4IndexTypes_defs.cs
│ ├── C4Index_native.cs
│ ├── C4Index_native_safe.cs
│ ├── C4Listener.cs
│ ├── C4ListenerTypes_defs.cs
│ ├── C4Listener_native.cs
│ ├── C4Log_defs.cs
│ ├── C4Log_native.cs
│ ├── C4Observer.cs
│ ├── C4Observer_native.cs
│ ├── C4Observer_native_safe.cs
│ ├── C4PredictiveQuery_defs.cs
│ ├── C4PredictiveQuery_native.cs
│ ├── C4Private.cs
│ ├── C4Query.cs
│ ├── C4QueryTypes_defs.cs
│ ├── C4Query_native.cs
│ ├── C4Query_native_safe.cs
│ ├── C4Replicator.cs
│ ├── C4ReplicatorTypes_defs.cs
│ ├── C4Replicator_native.cs
│ ├── C4Replicator_native_safe.cs
│ ├── C4Socket.cs
│ ├── C4SocketTypes_defs.cs
│ ├── C4Socket_native.cs
│ ├── C4Socket_native_safe.cs
│ ├── FLBase_defs.cs
│ ├── FLCollections_defs.cs
│ ├── FLCollections_native.cs
│ ├── FLDeepIterator_defs.cs
│ ├── FLDoc_native.cs
│ ├── FLEncoder_defs.cs
│ ├── FLEncoder_native.cs
│ ├── FLExpert_defs.cs
│ ├── FLExpert_native.cs
│ ├── FLJSON_native.cs
│ ├── FLKeyPath_defs.cs
│ ├── FLMutable_defs.cs
│ ├── FLMutable_native.cs
│ ├── FLSlice_defs.cs
│ ├── FLSlice_native.cs
│ ├── FLValue_defs.cs
│ ├── FLValue_native.cs
│ ├── Fleece.cs
│ ├── LiteCoreBridge.cs
│ ├── Misc_native.cs
│ ├── NativeActivate.cs
│ ├── NativeHandler.cs
│ ├── SQLiteStatus.cs
│ ├── bridge_literals.txt
│ ├── gen_bindings.py
│ ├── interfacer.ps1
│ ├── raw_literals.txt
│ └── templates
│ │ ├── C4SliceResult_bridge.template
│ │ ├── C4SliceResult_raw_return.template
│ │ ├── C4SliceResult_return.template
│ │ ├── C4Slice_bridge.template
│ │ ├── C4Slice_bridge_param.template
│ │ ├── C4Slice_raw.template
│ │ ├── C4Slice_raw_return.template
│ │ ├── C4Slice_return.template
│ │ ├── C4Slice_using.template
│ │ ├── C4StringResult_bridge.template
│ │ ├── C4StringResult_raw_return.template
│ │ ├── C4StringResult_return.template
│ │ ├── C4String[]_raw.template
│ │ ├── C4String_bridge.template
│ │ ├── C4String_bridge_param.template
│ │ ├── C4String_raw.template
│ │ ├── C4String_raw_return.template
│ │ ├── C4String_return.template
│ │ ├── C4String_using.template
│ │ ├── FLSliceResult_bridge.template
│ │ ├── FLSliceResult_return.template
│ │ ├── FLSlice_bridge.template
│ │ ├── FLSlice_bridge_param.template
│ │ ├── FLSlice_return.template
│ │ ├── FLSlice_using.template
│ │ ├── FLStringResult_bridge.template
│ │ ├── FLStringResult_ptr_raw.template
│ │ ├── FLStringResult_raw_return.template
│ │ ├── FLStringResult_return.template
│ │ ├── FLString_bridge.template
│ │ ├── FLString_bridge_param.template
│ │ ├── FLString_raw.template
│ │ ├── FLString_raw_return.template
│ │ ├── FLString_return.template
│ │ ├── FLString_using.template
│ │ ├── UIntPtr_bridge.template
│ │ ├── UIntPtr_bridge_param.template
│ │ ├── UIntPtr_return.template
│ │ ├── bool_raw.template
│ │ ├── byte_ptr_bridge.template
│ │ ├── byte_ptr_raw.template
│ │ └── byte_ptr_return.template
│ ├── LiteCore.Shared.projitems
│ ├── LiteCore.Shared.shproj
│ └── Util
│ ├── C4String.cs
│ ├── Hasher.cs
│ └── PerfTimer.cs
├── build
├── do_build.ps1
├── get_litecore_source.py
└── get_litecore_source_requirements.txt
└── global.json
/.appveyor/test.ps1:
--------------------------------------------------------------------------------
1 | Push-Location $PSScriptRoot\..\src\Couchbase.Lite.TestCoverage\
2 | dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
3 | if($LASTEXITCODE -ne 0) {
4 | exit $LASTEXITCODE
5 | }
6 |
7 | if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) {
8 | Pop-Location
9 | exit $LASTEXITCODE
10 | }
11 |
12 | Pop-Location
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
4 |
5 | ### Library Version
6 |
7 |
14 |
15 | ### .NET Runtime
16 |
17 |
23 |
24 | ### Operating System / Device Details
25 |
26 |
32 |
33 | ### Log Output
34 |
35 |
38 |
39 | ### Expected behavior
40 |
41 |
42 |
43 | ### Actual behavior
44 |
45 |
46 |
47 | ### Steps To Reproduce
48 |
49 |
50 |
51 | 1.
52 | 2.
53 | 3.
54 |
55 | ### Reproduction Project
56 |
57 |
60 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbase/couchbase-lite-net/b0ab43f00f27b520e8d6e627f56772d8e8898653/.gitmodules
--------------------------------------------------------------------------------
/Notes/CIAndVersions.md:
--------------------------------------------------------------------------------
1 | # A Guide to Couchbase Lite Versioning
2 |
3 | For version 2.0 we have yet again changed the way we are going to do our CI going forward. This is because the old way was causing too many manual steps and slowing down the process for us. The structure of the version numbers going forward will be the same, except with the small change that patch numbers are now going to be included even if they are 0:
4 |
5 | > |Major|.|Minor|.|Patch|\[.|Hotfix|\]\[-b|BuildNum|] (X.Y.Z.A-b####)
6 |
7 | Major, minor, patch, and hotfix are self-explanatory, and BuildNum is just an increasing count of builds generated by the CI server. If a build fails, that number is skipped.
8 |
9 | For 2.x our continuous integration server is no longer public. The reason for this is that we expect to be making biweekly pushes to our developer feed (http://nuget.mobile.couchbase.com/nuget/Developer/) which include the most stable bits from the past two weeks. All of the packages on the developer feed will be of the version form X.Y.Z-db###. DB in this case stands for developer build, and the numbers after will simply increase by one for each release. Due to a change in build and QE strategy, we will be "promoting" builds from now on from our internal feeds without any changes to the actual binaries. This has the side effect of the internal version (i.e. version in the logs) and the version in the Windows right click properties menu under details showing up in the form X.Y.Z-b#### (i.e. the build number it received when it was built). This is intentional, so don't worry. This ensures that once a build has received whatever validation it needs, that it is shipped bit for bit as is.
10 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 3.0.0.{build}
2 | branches:
3 | only:
4 | - master
5 |
6 | skip_tags: true
7 | environment:
8 | COVERALLS_REPO_TOKEN:
9 | secure: rYG0uD7eOutfMDvCi7Fe/W855aWp3b3/onQnk06bxp7EEKsYYdji5yD1euE8M37L
10 |
11 | init:
12 | - cmd: git config --global core.autocrlf true
13 |
14 | # Environment
15 | image: Visual Studio 2019
16 | clone_depth: 1
17 |
18 | install:
19 | - git submodule update --init --recursive
20 |
21 | build_script:
22 | # Fail fast if C# is broken
23 | - cmd: msbuild /t:Restore src/Couchbase.Lite/Couchbase.Lite.csproj /p:Configuration=Debug_Coverage
24 | - cmd: msbuild src/Couchbase.Lite/Couchbase.Lite.csproj /p:JUST_CSHARP=1 /p:Configuration=Debug_Coverage
25 | # x86 is unused
26 | - ps: |
27 | New-Item -Type Directory vendor/couchbase-lite-core/build_cmake/x86/RelWithDebInfo
28 | Push-Location vendor/couchbase-lite-core/build_cmake/x86/RelWithDebInfo
29 | New-Item -Type File LiteCore.dll
30 | New-Item -Type File LiteCore.pdb
31 | Pop-Location
32 |
33 | New-Item -Type Directory vendor/couchbase-lite-core/build_cmake/x64
34 | Push-Location vendor/couchbase-lite-core/build_cmake/x64
35 | cmake -G "Visual Studio 16 2019" -A x64 ..\..
36 | cmake --build . --target LiteCore --config RelWithDebInfo
37 | Pop-Location
38 | - cmd: msbuild /t:Restore src/Couchbase.Lite.TestCoverage/Couchbase.Lite.TestCoverage.csproj
39 | - cmd: msbuild src/Couchbase.Lite.TestCoverage/Couchbase.Lite.TestCoverage.sln
40 |
41 | test_script:
42 | - ps: .appveyor/test.ps1
--------------------------------------------------------------------------------
/core_version.ini:
--------------------------------------------------------------------------------
1 | [version]
2 | build = 4.0.0-38
3 |
4 | [hashes]
5 | ce = 6d3748cd6dd8466bd4ac3c07744357662dfc1894
6 | ee = 81151912cf26bcfd9258b638ed6ea1d098cadc46
7 |
--------------------------------------------------------------------------------
/jim_borden.gpg:
--------------------------------------------------------------------------------
1 | -----BEGIN PGP PUBLIC KEY BLOCK-----
2 | Version: GnuPG v1
3 |
4 | mQENBFS+x4wBCADdrcWEWdEUduBMSCsLc9J8T05IQsp352WQjgJo/jFpsJimD0db
5 | IzxXnBZofQscyKqoQoCBZjnwAX3ND1Fl8iuWDZBmKrVU0GQBSvAGeHRvVinX+Chn
6 | 4DIIGHkRgXIk4MjK0hHfYq2SPN6Y9E57lzasjWEqc7cNiz2GQbfVjD/8wVQfSX4V
7 | cJ4Q6HnXEiBwHdT4zwW+n74P8ceP5OK5Ui5p2jjU8V94LMnwKoxMRKW8SMrptMEd
8 | Sc5yG38UPq/BAo1dZxp5SfaYmb6DeI53IAP8dxXK2zSTpOb8AUNpofx06r64fQeo
9 | 8A3/SyQ7WVD8t5MU8DBR+y6VjUOeKUgUSUjPABEBAAG0JUppbSBCb3JkZW4gPGpp
10 | bS5ib3JkZW5AY291Y2hiYXNlLmNvbT6JATgEEwECACIFAlS+x4wCGwMGCwkIBwMC
11 | BhUIAgkKCwQWAgMBAh4BAheAAAoJEBlio68BlKjRK6UIALa+6CFxcVux+SzvrI+7
12 | 0TAjYNmCyP7GxvCth9nVfeRa0/hLl9ZPBfqQ0r+3NUCSbqdYU4LIlNiYcXqtmMUm
13 | KAtmaewkA/FeUGIraWhniJzM/BC4LhnWSNpJZDmCNnAhDNIQUvvJM2CIgHTZ96IX
14 | 8zDlsWphFO2ygaeVCThDGL917bRfFHMODBVB1rJh3kz1BD/Im5okeXNZh210eQIF
15 | VkSu38R+GEDW4H1mDyP7MljnS0WCOseJWKhltNuPsAsFVSRRHTiafQyqeLOgSFYH
16 | ifyGP25dtLLfREA04Sq94feqt88A/1Ch75RGopII//yw2MT4BzDNLX6BDUPmYfBL
17 | rui5AQ0EVL7HjAEIAMp+C9rSUQgx89nr2swZWlpv7l+EqOpvwd4PyfzUTJJtpV9x
18 | Dr4weCpug4zZO1N6NF9YNCTZw8aHVx2U7B4XA/iMcZyQDfqaGxAuugkZx9jvrog+
19 | AgTMKavAHsApEVSiZ67+shu1rN5qN3/9SCysfBqzqyaVTmVMX1k3R7b1LjiyRroy
20 | HU8vRkwPI80SqoHcwJf2XUG94t9sOlEiHNGeqjlzOLj2Z3EakXsmKGNFFhHCQwtb
21 | NbPTQNpZ3tfFPtl6Jfb0/O00HLufyPb/CpI3dcbFVFL9POoW+y2H5Ln6OGzAxTzp
22 | IlIMVv6tkyDGSkjDNuEyXt+h+OB4+4NNHbgQNE0AEQEAAYkBHwQYAQIACQUCVL7H
23 | jAIbDAAKCRAZYqOvAZSo0a1UB/4+6tcZTfCYcbev88FNdOFw2c0eFQhEaXNP+gBl
24 | RWJBmhkSjP3Jom5ik9JCMwHpnfd6oqQt0gHRhwo9fvtNbfUZbKHk79HuKn+5tE5y
25 | apxOD2oHSXHVI9KKTsuW2jq+XNpBGzH5Kdr7w0nS3xTYhoru2JY6K9qjsMLWGegJ
26 | nMiZ3CXLe98iN8ug2XoSvboH0nYs0KQCwyjsfSbAWZsgTW77PghOF4ysHbeKTsYg
27 | BdT5YxUxUktYbDwfcdPLHbgyhmsemr6zm3luke18TAjo6U4C8CO2e+q3Lf03/YNZ
28 | phXtUZr6lUGfAVcBN9A69pO94K89HddztiMf763vH27w5V4U
29 | =jSPu
30 | -----END PGP PUBLIC KEY BLOCK-----
31 |
--------------------------------------------------------------------------------
/packaging/nuget/LICENSE.txt:
--------------------------------------------------------------------------------
1 | This is a proprietary build. This license must be replaced by the real one at build time.
--------------------------------------------------------------------------------
/packaging/nuget/do_clean.ps1:
--------------------------------------------------------------------------------
1 | param(
2 | [Parameter(Mandatory=$true)][string]$apikey)
3 |
4 | $ErrorActionPreference = "Stop"
5 |
6 | $url="https://proget.sc.couchbase.com/nuget/CI/Packages()?`$format=json"
7 | $content=$(Invoke-WebRequest $url).Content
8 | $results = $(ConvertFrom-Json $content).d.results
9 | foreach($result in $results) {
10 | $ms = [long]$result.Published.Substring(7,13)
11 | $published = $(New-Object -Type DateTime -ArgumentList 1970, 1, 1, 0, 0, 0, 0).AddMilliseconds($ms)
12 |
13 | $now = $(Get-Date).ToUniversalTime()
14 | $limit = New-TimeSpan -Days 30
15 | if(($now - $published) -gt $limit) {
16 | Write-Host "Deleting $($result.Id)-$($result.Version)"
17 |
18 | # Nuget won't fail when deleting a non-existent package, and Internal is a strict subset of CI
19 | dotnet nuget delete --api-key $apikey --source https://proget.sc.couchbase.com/nuget/CI --non-interactive $result.Id $result.Version
20 | dotnet nuget delete --api-key $apikey --source https://proget.sc.couchbase.com/nuget/Internal --non-interactive $result.Id $result.Version
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/packaging/nuget/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbase/couchbase-lite-net/b0ab43f00f27b520e8d6e627f56772d8e8898653/packaging/nuget/logo.png
--------------------------------------------------------------------------------
/src/AssemblyInfo.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | Couchbase Lite .NET
4 | 0.0.0
5 | A lightweight, document-oriented (NoSQL), syncable database engine for .NET
6 | Copyright 2014-$([System.DateTime]::Now.ToString(yyyy))
7 | Couchbase, Inc.
8 | Couchbase
9 | LICENSE.txt
10 | https://github.com/couchbase/couchbase-lite-net
11 | logo.png
12 | README.md
13 | couchbase couchbase-mobile couchbase-lite sync database mobile netcore xamarin maui ios android windows linux mac osx nosql
14 | true
15 | $(MsBuildThisFileDirectory)packages
16 | True
17 | $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
18 | latest
19 | false
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Conflict/Conflict.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Conflict.cs
3 | //
4 | // Copyright (c) 2019 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System.Diagnostics;
20 |
21 | namespace Couchbase.Lite
22 | {
23 | ///
24 | /// Conflict contains information of the conflicted documents, including local and
25 | /// remote document’s content. The null content means that the document is deleted.
26 | ///
27 | public class Conflict
28 | {
29 | ///
30 | /// The conflict resolved document id.
31 | ///
32 | public string DocumentID { get; }
33 |
34 | ///
35 | /// The document in local database. If null, the document is deleted.
36 | ///
37 | public Document? LocalDocument { get; }
38 |
39 | ///
40 | /// The document in remote database. If null, the document is deleted.
41 | ///
42 | public Document? RemoteDocument { get; }
43 |
44 | internal Conflict(string docID, Document? localDoc, Document? remoteDoc)
45 | {
46 | Debug.Assert(localDoc != null || remoteDoc != null,
47 | "Local and remote document shouldn't be empty at same time, when resolving conflict.");
48 |
49 | DocumentID = docID;
50 | LocalDocument = localDoc;
51 | RemoteDocument = remoteDoc;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Conflict/ConflictResolver.cs:
--------------------------------------------------------------------------------
1 | //
2 | // ConflictResolver.cs
3 | //
4 | // Copyright (c) 2019 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite
20 | {
21 | ///
22 | /// ConflictResolver provides access to the default conflict resolver used by the replicator.
23 | ///
24 | public static class ConflictResolver
25 | {
26 | ///
27 | /// Access IConflictResolver.Default to get the singleton DefaultConflictResolver object.
28 | /// Then call methods on that instance.
29 | ///
30 | public static IConflictResolver Default { get; } = new DefaultConflictResolver();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Conflict/DefaultConflictResolver.cs:
--------------------------------------------------------------------------------
1 | //
2 | // DefaultConflictResolver.cs
3 | //
4 | // Copyright (c) 2019 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System;
20 |
21 | namespace Couchbase.Lite
22 | {
23 | internal sealed class DefaultConflictResolver : IConflictResolver
24 | {
25 | ///
26 | /// The callback default conflict resolve method, if conflict occurs.
27 | ///
28 | public Document? Resolve(Conflict conflict)
29 | {
30 | if (conflict.RemoteDocument == null || conflict.LocalDocument == null)
31 | return null;
32 |
33 | return conflict.LocalDocument.Timestamp > conflict.RemoteDocument.Timestamp
34 | ? conflict.LocalDocument
35 | : conflict.RemoteDocument;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/DI/CouchbaseDependencyAttribute.cs:
--------------------------------------------------------------------------------
1 | //
2 | // CouchbaseDependencyAttribute.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System;
20 | using System.Diagnostics.CodeAnalysis;
21 |
22 | namespace Couchbase.Lite.DI
23 | {
24 | ///
25 | /// An attribute to indicate that the specified class implements a dependency for
26 | /// Couchbase Lite (e.g.
27 | ///
28 | [ExcludeFromCodeCoverage]
29 | [AttributeUsage(AttributeTargets.Class)]
30 | public sealed class CouchbaseDependencyAttribute : Attribute
31 | {
32 | #region Properties
33 |
34 | ///
35 | /// Gets or sets if the dependency should be created when it is
36 | /// first requested (true) or immediately upon registration.
37 | ///
38 | public bool Lazy { get; set; }
39 |
40 | ///
41 | /// Gets or sets if the dependency is transient (i.e. should be created
42 | /// on each request)
43 | ///
44 | public bool Transient { get; set; }
45 |
46 | #endregion
47 | }
48 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/DI/IDefaultDirectoryResolver.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IDefaultPathResolver.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.DI
20 | {
21 |
22 | ///
23 | /// An interface for resolving the default directory for a Couchbase Lite database
24 | /// since we may be operating in a sandboxed environment
25 | ///
26 | public interface IDefaultDirectoryResolver
27 | {
28 | #region Public Methods
29 |
30 | ///
31 | /// Gets the default directory for a Couchbase Lite database to live in
32 | ///
33 | /// The default directory for a Couchbase Lite database to live in
34 | string DefaultDirectory();
35 |
36 | #endregion
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/DI/IMainThreadTaskScheduler.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IMainThreadTaskScheduler.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System.Threading.Tasks;
20 |
21 | namespace Couchbase.Lite.DI
22 | {
23 | ///
24 | /// An interface for an object that can behave as a
25 | /// that invokes its tasks on the UI (main) thread of an application. Not applicable
26 | /// for all platforms, as some do not have main threads set up in a way that is usable
27 | /// (e.g. .NET Core)
28 | ///
29 | public interface IMainThreadTaskScheduler
30 | {
31 | #region Properties
32 |
33 | ///
34 | /// Gets if the currently executing thread is the main thread
35 | /// of the application
36 | ///
37 | bool IsMainThread { get; }
38 |
39 | #endregion
40 |
41 | #region Public Methods
42 |
43 | ///
44 | /// Returns the object as a so that
45 | /// it can be used for various .NET framework methods
46 | ///
47 | /// The main thread scheduler cast to a
48 | TaskScheduler AsTaskScheduler();
49 |
50 | #endregion
51 | }
52 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/DI/IProxy.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IProxy.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System;
20 | using System.Net;
21 | using System.Threading.Tasks;
22 |
23 | namespace Couchbase.Lite.DI
24 | {
25 | internal interface IProxy
26 | {
27 | Task CreateProxyAsync(Uri destination);
28 | }
29 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/DI/IReachability.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IReachability.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | using System;
19 | using Couchbase.Lite.Sync;
20 |
21 | namespace Couchbase.Lite.DI
22 | {
23 | ///
24 | /// An interface for describing whether a given URL is reachable via
25 | /// network connection or not.
26 | ///
27 | public interface IReachability
28 | {
29 | #region Variables
30 |
31 | ///
32 | /// Fired when the status of connectivity changes
33 | ///
34 | event EventHandler StatusChanged;
35 |
36 | #endregion
37 |
38 | #region Properties
39 |
40 | ///
41 | /// The URL to track connectivity to
42 | ///
43 | Uri? Url { get; set; }
44 |
45 | #endregion
46 |
47 | #region Public Methods
48 |
49 | ///
50 | /// Start monitoring for changes in network status
51 | ///
52 | void Start();
53 |
54 | ///
55 | /// Stop monitoring for changes in network status
56 | ///
57 | void Stop();
58 |
59 | #endregion
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/DI/IRuntimePlatform.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IRuntimePlatform.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.DI
20 | {
21 | ///
22 | /// An interface for getting OS and hardware information from a runtime platform
23 | ///
24 | public interface IRuntimePlatform
25 | {
26 | ///
27 | /// Gets the operating system name and version (and possibly other info)
28 | ///
29 | string OSDescription { get; }
30 |
31 | ///
32 | /// Gets the name of the device that is running the program, if possible
33 | ///
34 | string HardwareName { get; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Database/CollectionChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | //
2 | // CollectionChangedEventArgs.cs
3 | //
4 | // Copyright (c) 2022 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System.Collections.Generic;
20 | using System.Diagnostics;
21 |
22 | namespace Couchbase.Lite
23 | {
24 | ///
25 | /// The parameters of a collection changed event
26 | ///
27 | #pragma warning disable CS0618 // Type or member is obsolete
28 | public sealed class CollectionChangedEventArgs : DatabaseChangedEventArgs
29 | #pragma warning restore CS0618 // Type or member is obsolete
30 | {
31 | #region Properties
32 |
33 | ///
34 | /// Gets the collection in which the change occurred
35 | ///
36 | public Collection Collection { get; }
37 |
38 | #endregion
39 |
40 | #region Constructors
41 |
42 | internal CollectionChangedEventArgs(Collection collection, IReadOnlyList documentIDs,
43 | Database database)
44 | :base(database, documentIDs)
45 | {
46 | Collection = collection;
47 | }
48 |
49 | #endregion
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Database/DatabaseChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | //
2 | // DatabaseChangedEventArgs.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System;
20 | using System.Collections.Generic;
21 | using System.Diagnostics;
22 | using System.Linq;
23 |
24 | namespace Couchbase.Lite
25 | {
26 | ///
27 | /// [DEPRECATED] The parameters of a database changed event
28 | ///
29 | [Obsolete("DatabaseChangedEventArgs is deprecated, please use CollectionChangedEventArgs")]
30 | public class DatabaseChangedEventArgs : EventArgs
31 | {
32 | #region Properties
33 |
34 | ///
35 | /// Gets the database in which the change occurred
36 | ///
37 | public Database Database { get; }
38 |
39 | ///
40 | /// Gets the document that was changed
41 | ///
42 | public IReadOnlyList DocumentIDs { get; }
43 |
44 | #endregion
45 |
46 | #region Constructors
47 |
48 | internal DatabaseChangedEventArgs(Database database, IReadOnlyList documentIDs)
49 | {
50 | Database = database;
51 | DocumentIDs = documentIDs;
52 | }
53 |
54 | #endregion
55 | }
56 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Document/Document+private.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Document+private.cs
3 | //
4 | // Copyright (c) 2024 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Unsupported;
20 |
21 | public static class DocumentExtensions
22 | {
23 | public static string? RevisionIDs(this Document doc)
24 | {
25 | return doc.RevisionIDs;
26 | }
27 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Document/DocumentFragment.cs:
--------------------------------------------------------------------------------
1 | //
2 | // DocumentFragment.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using Couchbase.Lite.Internal.Doc;
20 |
21 | namespace Couchbase.Lite
22 | {
23 | ///
24 | /// DocumentFragment provides access to a object. It also provides subscript access
25 | /// by key to the data values of the wrapped document.
26 | ///
27 | public sealed class DocumentFragment : IDictionaryFragment
28 | {
29 | #region Properties
30 |
31 | ///
32 | /// Gets the from the document fragment
33 | ///
34 | public Document? Document { get; }
35 |
36 | ///
37 | /// Gets whether or not this document is in the database
38 | ///
39 | public bool Exists => Document != null;
40 |
41 | ///
42 | public IFragment this[string key] => Document?[key] ?? Fragment.Null;
43 |
44 | #endregion
45 |
46 | #region Constructors
47 |
48 | internal DocumentFragment(Document? doc)
49 | {
50 | Document = doc;
51 | }
52 |
53 | #endregion
54 | }
55 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Document/IJSON.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IFragment.cs
3 | //
4 | // Copyright (c) 2022 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System;
20 |
21 | namespace Couchbase.Lite
22 | {
23 | ///
24 | /// An interface desribing an object that can be serialized to JSON
25 | ///
26 | public interface IJSON
27 | {
28 | #region Properties
29 |
30 | ///
31 | /// Converts this object to JSON format string.
32 | ///
33 | /// The contents of this object in JSON format string
34 | /// Thrown if ToJSON is called from ,
35 | /// , or
36 | string ToJSON();
37 |
38 | #endregion
39 | }
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Info/Defaults_Deprecated.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2024-present Couchbase, Inc All rights reserved.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | using Couchbase.Lite.Sync;
18 | using Couchbase.Lite.Logging;
19 |
20 | using System;
21 |
22 | namespace Couchbase.Lite.Info;
23 |
24 | public static partial class Constants
25 | {
26 | ///
27 | /// Default value for (false)
28 | /// Plaintext is not used, and instead binary encoding is used in log files
29 | ///
30 | [Obsolete("Use Constants.UsePlantext instead")]
31 | public static readonly bool DefaultLogFileUsePlainText = DefaultLogFileUsePlaintext;
32 |
33 | ///
34 | /// Default value for (TimeSpan.FromSeconds(300))
35 | /// Max wait time between retry attempts in seconds
36 | ///
37 | [Obsolete("Use Constants.DefaultReplicatorMaxAttemptsWaitTime (attempt -> attemps) instead")]
38 | public static readonly TimeSpan DefaultReplicatorMaxAttemptWaitTime = DefaultReplicatorMaxAttemptsWaitTime;
39 | }
40 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Log/ConsoleLogger.cs:
--------------------------------------------------------------------------------
1 | //
2 | // ConsoleLogger.cs
3 | //
4 | // Copyright (c) 2018 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | namespace Couchbase.Lite.Logging
19 | {
20 | ///
21 | /// An interface for an object that will log messages to the
22 | /// relevant debug console. For desktop this is the terminal,
23 | /// WinUI uses the visual studio debug output pane, iOS uses os_log
24 | /// and Android uses logcat.
25 | ///
26 | public interface IConsoleLogger : ILogger
27 | {
28 | #region Properties
29 |
30 | ///
31 | /// Gets or sets the domains that this logger will output
32 | ///
33 | LogDomain Domains { get; set; }
34 |
35 | ///
36 | /// Overrides the Level property
37 | /// with a public setter.
38 | ///
39 | new LogLevel Level { get; set; }
40 |
41 | #endregion
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Log/ILogger.cs:
--------------------------------------------------------------------------------
1 | //
2 | // ILogger.cs
3 | //
4 | // Copyright (c) 2018 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | namespace Couchbase.Lite.Logging
19 | {
20 | ///
21 | /// An interface for implementing a class that can accept
22 | /// logging messages from Couchbase Lite
23 | ///
24 | public interface ILogger
25 | {
26 | #region Properties
27 |
28 | ///
29 | /// Gets the level that the logger is currently
30 | /// logging
31 | ///
32 | LogLevel Level { get; }
33 |
34 | #endregion
35 |
36 | #region Public Methods
37 |
38 | ///
39 | /// Performs the actual logging to the log storage
40 | ///
41 | /// The level of the message being logged
42 | /// The domain of the message being logged
43 | /// The content of the message being logged
44 | void Log(LogLevel level, LogDomain domain, string message);
45 |
46 | #endregion
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Log/Log.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Log.cs
3 | //
4 | // Copyright (c) 2018 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using Couchbase.Lite.DI;
20 |
21 | namespace Couchbase.Lite.Logging
22 | {
23 | ///
24 | /// The class that stores the three available logging facilities in Couchbase Lite
25 | ///
26 | public sealed class Log
27 | {
28 | #region Properties
29 |
30 | ///
31 | /// Gets the logging facility that logs to a debugging console
32 | ///
33 | public IConsoleLogger Console { get; } = Service.GetRequiredInstance();
34 |
35 | ///
36 | /// Gets or sets the user defined logging facility
37 | ///
38 | public ILogger? Custom { get; set; }
39 |
40 | ///
41 | /// Gets the logging facility that logs to files on the disk
42 | ///
43 | public FileLogger File { get; } = new FileLogger();
44 |
45 | #endregion
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/Collation.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Collation.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System.Globalization;
20 | using Couchbase.Lite.Internal.Query;
21 |
22 | namespace Couchbase.Lite.Query
23 | {
24 | ///
25 | /// A factory class for creating instances
26 | ///
27 | public static class Collation
28 | {
29 | ///
30 | /// The default locale for the current program, for use with Unicode collation
31 | ///
32 | internal static readonly string DefaultLocale = CultureInfo.CurrentCulture.Name == "" ?
33 | "en" : CultureInfo.CurrentCulture.Name.Replace('-', '_');
34 | ///
35 | /// Creates an ASCII based collation instance
36 | ///
37 | /// An ASCII based collation instance
38 | public static IASCIICollation ASCII() => new QueryCollation(false);
39 |
40 | ///
41 | /// Creates a Unicode based collation instance (http://unicode.org/reports/tr10/)
42 | ///
43 | /// A Unicode based collation instance
44 | public static IUnicodeCollation Unicode() => new QueryCollation(true);
45 | }
46 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/FullTextExpression.cs:
--------------------------------------------------------------------------------
1 | //
2 | // FullTextExpression.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System;
20 |
21 | using Couchbase.Lite.Internal.Query;
22 |
23 | namespace Couchbase.Lite.Query
24 | {
25 | ///
26 | /// [DEPRECATED] A class that generates expressions that operate on the results of full-text searching
27 | ///
28 | [Obsolete("This class deprecated, please use FullTextFunction.")]
29 | public static class FullTextExpression
30 | {
31 | #region Public Methods
32 |
33 | ///
34 | /// [DEPRECATED] Generates a query expression that will check for matches against a
35 | /// given full text index name
36 | ///
37 | /// The name of the full-text index to perform the
38 | /// check against
39 | /// The generated query expression
40 | [Obsolete("This class deprecated, please use Match(string indexName, string query) in FullTextFunction class.")]
41 | public static IFullTextExpression Index(string name) =>
42 | new QueryCompoundExpression("MATCH()", Expression.String(name), Expression.String(String.Empty));
43 |
44 | #endregion
45 | }
46 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IDataSource.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IDataSource.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing the source of data for a query
23 | ///
24 | public interface IDataSource
25 | {
26 |
27 | }
28 |
29 | ///
30 | /// An interface representing a source of data that comes from
31 | /// an
32 | ///
33 | public interface IDataSourceAs : IDataSource
34 | {
35 | #region Public Methods
36 |
37 | ///
38 | /// Attaches an alias to a given data source
39 | ///
40 | /// The alias to attach
41 | /// The datasource, for further operations
42 | IDataSource As(string alias);
43 |
44 | #endregion
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IFrom.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IFrom.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing the FROM portion of an
23 | ///
24 | public interface IFrom : IQuery, IJoinRouter, IWhereRouter, IGroupByRouter, IOrderByRouter, ILimitRouter
25 | {}
26 | }
27 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IFromRouter.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IFromRouter.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing a portion of a query that can be routed
23 | /// to a FROM portion
24 | ///
25 | public interface IFromRouter
26 | {
27 | #region Public Methods
28 |
29 | ///
30 | /// Routes this IExpression to the nexe FROM portion of a query
31 | ///
32 | /// The data source to use in the FROM portion of the query
33 | /// The next FROM portion of the query for further processing
34 | IFrom From(IDataSource dataSource);
35 |
36 | #endregion
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IFullTextExpression.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IFullTextExpression.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// [DEPRECATED] An interface that represents an expression that is eligible to receive
23 | /// full-text related query clauses
24 | ///
25 | public interface IFullTextExpression
26 | {
27 | ///
28 | /// [DEPRECATED] Returns an expression that will evaluate whether or not the given
29 | /// expression full text matches the current one
30 | ///
31 | /// The text to use for the match operation
32 | /// The expression representing the new operation
33 | IExpression Match(string query);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IGroupBy.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IGroupBy.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing the GROUP BY portion of a query
23 | ///
24 | public interface IGroupBy : IQuery, IHavingRouter, IOrderByRouter, ILimitRouter
25 | {
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IGroupByRouter.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IGroupByRouter.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing a portion of a query which can take GROUP BY
23 | /// as its next step
24 | ///
25 | public interface IGroupByRouter
26 | {
27 | #region Public Methods
28 |
29 | ///
30 | /// Groups the current query by the given GROUP BY clauses
31 | ///
32 | /// The clauses to group by
33 | /// The query grouped by the given clauses for further processing
34 | IGroupBy GroupBy(params IExpression[] expressions);
35 |
36 | #endregion
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IHaving.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IHaving.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing the HAVING portion of a query (i.e. WHERE clause
23 | /// intended for a GROUP BY clause)
24 | ///
25 | public interface IHaving : IQuery, IOrderByRouter, ILimitRouter
26 | {}
27 | }
28 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IHavingRouter.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IHavingRouter.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing a portion of a query that can take HAVING
23 | /// as its next step
24 | ///
25 | public interface IHavingRouter
26 | {
27 | #region Public Methods
28 |
29 | ///
30 | /// Adds the given expression as a HAVING clause onto this query
31 | ///
32 | /// The expression to use in the HAVING clause
33 | /// The query with the new clause for further processing
34 | IHaving Having(IExpression expression);
35 |
36 | #endregion
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IIndexExpression.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IIndexExpression.cs
3 | //
4 | // Copyright (c) 2022 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// The base interface used when an index is required to be specified
23 | /// in a QueryBuilder query.
24 | ///
25 | public interface IIndexExpression
26 | {
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IIndexItem.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IIndexItem.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | namespace Couchbase.Lite.Query
19 | {
20 | ///
21 | /// An interface for an index item for use when creating value based indexes
22 | ///
23 | public interface IValueIndexItem
24 | {
25 |
26 | }
27 |
28 | ///
29 | /// An interface for an index item for use when creating FTS based indexes
30 | ///
31 | public interface IFullTextIndexItem
32 | {
33 |
34 | }
35 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IJoin.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IJoin.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing a query that has just received a JOIN
23 | /// clause
24 | ///
25 | public interface IJoins : IQuery, IWhereRouter, IOrderByRouter, ILimitRouter
26 | {}
27 |
28 | ///
29 | /// An interface representing an with a JOIN clause
30 | ///
31 | public interface IJoin
32 | {
33 | }
34 |
35 | ///
36 | /// An interface representing an with a
37 | /// partially constructed JOIN clause that has not yet received its ON clause
38 | ///
39 | public interface IJoinOn : IJoin
40 | {
41 | #region Public Methods
42 |
43 | ///
44 | /// Adds the ON clause to the current JOIN clause
45 | ///
46 | /// The expression to use as the ON clause
47 | /// The query for further processing
48 | IJoin On(IExpression expression);
49 |
50 | #endregion
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IJoinRouter.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IJoinRouter.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing a portion of an that can accept JOIN
23 | /// as its next clause
24 | ///
25 | public interface IJoinRouter
26 | {
27 | #region Public Methods
28 |
29 | ///
30 | /// Create and appends the list of JOINS to the current
31 | ///
32 | /// The join clauses to add
33 | /// The query with the join statement, for further processing
34 | IJoins Join(params IJoin[] joins);
35 |
36 | #endregion
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/ILimit.cs:
--------------------------------------------------------------------------------
1 | //
2 | // ILimit.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing a query that has had a limit and optionally an
23 | /// offset applied
24 | ///
25 | public interface ILimit : IQuery
26 | {}
27 | }
28 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/ILimitRouter.cs:
--------------------------------------------------------------------------------
1 | //
2 | // ILimitRouter.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing a query that can accept LIMIT as its next clause
23 | ///
24 | public interface ILimitRouter
25 | {
26 | #region Public Methods
27 |
28 | ///
29 | /// Limits a query to the given count (ulong, parameter, etc)
30 | ///
31 | /// The amount to limit the query to
32 | /// The query for further processing
33 | ILimit Limit(IExpression limit);
34 |
35 | ///
36 | /// Limits a query to the given count and also offsets it by
37 | /// a given count (ulong, parameter, etc)
38 | ///
39 | /// The amount to limit the query to
40 | /// The amount to offset the query by
41 | /// The query for further processing
42 | ILimit Limit(IExpression limit, IExpression? offset);
43 |
44 | #endregion
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IMetaExpression.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IMetaExpression.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// Represents an expression that is meant to retrieve metadata information
23 | /// inside of an
24 | ///
25 | public interface IMetaExpression : IExpression
26 | {
27 | #region Public Methods
28 |
29 | ///
30 | /// Specifies the source to retrieve the information from
31 | /// if multiple sources are used in a query
32 | ///
33 | /// The name of the data source
34 | /// The expression with the alias added
35 | IExpression From(string alias);
36 |
37 | #endregion
38 | }
39 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IOrderBy.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IOrderBy.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing the ORDER BY portion of an
23 | ///
24 | public interface IOrderBy : IQuery, ILimitRouter
25 | {}
26 |
27 | ///
28 | /// An interface representing an arbitrary sorting for an
29 | ///
30 | public interface IOrdering
31 | {
32 | }
33 |
34 | ///
35 | /// An interface representing the way that an should be
36 | /// sorted
37 | ///
38 | public interface ISortOrder : IOrdering
39 | {
40 | #region Public Methods
41 |
42 | ///
43 | /// Returns an IExpression that will sort in ascending order
44 | ///
45 | /// An IExpression that will sort in ascending order
46 | IOrdering Ascending();
47 |
48 | ///
49 | /// Returns an IExpression that will sort in desecending order
50 | ///
51 | /// An IExpression that will sort in desecending order
52 | IOrdering Descending();
53 |
54 | #endregion
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IOrderByRouter.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IOrderByRouter.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing a portion of a query that can be routed
23 | /// to an ORDER BY portion
24 | ///
25 | public interface IOrderByRouter
26 | {
27 | #region Public Methods
28 |
29 | ///
30 | /// Routes this IExpression to the next ORDER BY portion of the query
31 | ///
32 | /// An array of order by operations to consider in the
33 | /// ORDER BY portion of the query
34 | /// The next ORDER BY portion of the query
35 | IOrderBy OrderBy(params IOrdering[] orderings);
36 |
37 | #endregion
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IPropertyExpression.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IPropertyExpression.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface for an expression that will retrieve a property
23 | /// from a keypath
24 | ///
25 | public interface IPropertyExpression : IExpression
26 | {
27 | #region Public Methods
28 |
29 | ///
30 | /// Specifies where to retrieve the property from (necessary
31 | /// in instances where the query is coming from multiple sources)
32 | ///
33 | /// The alias of the source to retrieve from
34 | /// The expression, for further processing
35 | IExpression From(string alias);
36 |
37 | #endregion
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IQueryFactory.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IQueryFactory.cs
3 | //
4 | // Copyright (c) 2022 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System;
20 |
21 | namespace Couchbase.Lite.Query
22 | {
23 | ///
24 | /// An interface describing an object that is capable of creating an object
25 | ///
26 | public interface IQueryFactory
27 | {
28 | ///
29 | /// Creates a Query object from the given SQL string.
30 | ///
31 | /// SQL Expression
32 | /// Thrown if
33 | /// is null
34 | /// Thrown if an error condition is returned from LiteCore
35 | /// Throw if compiling returns an error
36 | IQuery CreateQuery(string queryExpression);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IQueryIndex.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IQueryIndex.cs
3 | //
4 | // Copyright (c) 2024 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using LiteCore.Interop;
20 | using System;
21 |
22 | namespace Couchbase.Lite.Query;
23 |
24 | ///
25 | /// An interface representing an existing index in a collection
26 | ///
27 | public partial interface IQueryIndex : IDisposable
28 | {
29 | ///
30 | /// The collection that this index belongs to
31 | ///
32 | Collection Collection { get; }
33 |
34 | ///
35 | /// The name of the index
36 | ///
37 | string Name { get; }
38 | }
39 |
40 | internal sealed unsafe partial class QueryIndexImpl : IQueryIndex
41 | {
42 | private C4IndexWrapper _index;
43 |
44 | public Collection Collection { get; }
45 |
46 | public string Name { get; }
47 |
48 | public QueryIndexImpl(C4IndexWrapper index, Collection collection, string name)
49 | {
50 | Collection = collection;
51 | Name = name;
52 | _index = index;
53 | }
54 |
55 | public void Dispose()
56 | {
57 | _index.Dispose();
58 | }
59 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IResultSet.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IResultSet.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System;
20 | using System.Collections.Generic;
21 |
22 | namespace Couchbase.Lite.Query
23 | {
24 | ///
25 | /// An interface representing an enumerable collection of results
26 | /// from a given .
27 | ///
28 | ///
29 | /// Multiple enumerations are not supported. If you wish to enumerate
30 | /// more than once, then use or another LINQ
31 | /// method to materialize the results.
32 | ///
33 | public interface IResultSet : IEnumerable, IDisposable
34 | {
35 | ///
36 | /// Cross platform API entry to get all results in a list. Same
37 | /// as ToList()
38 | ///
39 | /// A list of results from the result set
40 | List AllResults();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/ISelect.cs:
--------------------------------------------------------------------------------
1 | //
2 | // ISelect.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing the SELECT portion of an
23 | ///
24 | public interface ISelect : IFromRouter
25 | {}
26 | }
27 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/ISelectResult.cs:
--------------------------------------------------------------------------------
1 | //
2 | // ISelectResult.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface that holds information about what to
23 | /// select out of an
24 | ///
25 | public interface ISelectResult
26 | {}
27 |
28 | ///
29 | /// An interface representing a select result "FROM" a certain data
30 | /// source
31 | ///
32 | public interface ISelectResultFrom : ISelectResult
33 | {
34 | ///
35 | /// Specifies the source of this select result
36 | ///
37 | /// The alias of the data source to select from
38 | /// The modified select result
39 | ISelectResult From(string alias);
40 | }
41 |
42 | ///
43 | /// An interface reprsenting a select result that can be aliased to
44 | /// an arbitrary name
45 | ///
46 | public interface ISelectResultAs : ISelectResult
47 | {
48 | ///
49 | /// Adds an alias to the select result
50 | ///
51 | /// The alias to assign to the select result
52 | /// The modified select result
53 | ISelectResult As(string alias);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IVariableExpression.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IVariableExpression.cs
3 | //
4 | // Copyright (c) 2018 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// A type of expression that represents the variable portion of an
23 | /// array based expression such as
24 | ///
25 | public interface IVariableExpression : IExpression
26 | {
27 |
28 | }
29 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IWhere.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IWhere.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing the WHERE portion of an
23 | ///
24 | public interface IWhere : IQuery, IGroupByRouter, IOrderByRouter, ILimitRouter
25 | {}
26 | }
27 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/IWhereRouter.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IWhereRouter.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Query
20 | {
21 | ///
22 | /// An interface representing a portion of a query that can be routed to
23 | /// a WHERE portion of the query.
24 | ///
25 | public interface IWhereRouter
26 | {
27 | #region Public Methods
28 |
29 | ///
30 | /// Routes this portion of the query to the next WHERE portion of the
31 | /// query
32 | ///
33 | /// The expression to evaluate in the WHERE portion
34 | /// The next WHERE portion of the query
35 | IWhere Where(IExpression expression);
36 |
37 | #endregion
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Query/ValueIndexConfiguration.cs:
--------------------------------------------------------------------------------
1 | //
2 | // ValueIndexConfiguration.cs
3 | //
4 | // Copyright (c) 2021 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using Couchbase.Lite.Internal.Query;
20 | using LiteCore.Interop;
21 |
22 | namespace Couchbase.Lite.Query
23 | {
24 | ///
25 | /// An class for an index based on a simple property value
26 | ///
27 | public sealed class ValueIndexConfiguration : IndexConfiguration
28 | {
29 | #region Properties
30 | internal override C4IndexOptions Options => new C4IndexOptions();
31 | #endregion
32 |
33 | #region Constructors
34 |
35 | ///
36 | /// Starts the creation of an index based on a simple property
37 | ///
38 | /// The expressions to use to create the index
39 | /// The beginning of a value based index
40 | public ValueIndexConfiguration(params string[] expressions)
41 | : base(C4IndexType.ValueIndex, expressions)
42 | {
43 | }
44 |
45 | #endregion
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/RuntimeException.cs:
--------------------------------------------------------------------------------
1 | //
2 | // RuntimeException.cs
3 | //
4 | // Copyright (c) 2018 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System;
20 |
21 | namespace Couchbase.Lite
22 | {
23 | ///
24 | /// An exception that is thrown in rare circumstances where the runtime returns
25 | /// an unexpected value for a method (usually null)
26 | ///
27 | public sealed class RuntimeException : Exception
28 | {
29 | internal RuntimeException(string message) : base(message)
30 | {
31 |
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Sync/Authenticator.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Authenticator.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Sync
20 | {
21 | ///
22 | /// An abstract base class for authenticator classes. This class
23 | /// has no public methods.
24 | ///
25 | public abstract class Authenticator
26 | {
27 | #region Internal Methods
28 |
29 | internal abstract void Authenticate(ReplicatorOptionsDictionary options);
30 |
31 | #endregion
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Sync/IEndpoint.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IEndpoint.cs
3 | //
4 | // Copyright (c) 2018 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Sync
20 | {
21 | ///
22 | /// Represents an endpoint in a replication
23 | ///
24 | public interface IEndpoint
25 | {
26 |
27 | }
28 |
29 | internal interface IEndpointInternal : IEndpoint
30 | {
31 | void Visit(ReplicatorConfiguration config);
32 | }
33 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Sync/ProxyAuthenticator.cs:
--------------------------------------------------------------------------------
1 | //
2 | // ProxyAuthenticator.cs
3 | //
4 | // Copyright (c) 2024 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using Couchbase.Lite.Sync;
20 | using System;
21 |
22 | ///
23 | /// A class for storing credentials for a proxy that needs authentication
24 | ///
25 | public sealed class ProxyAuthenticator
26 | {
27 | ///
28 | /// Gets the username sent to the proxy
29 | ///
30 | public string Username { get; init; }
31 |
32 | ///
33 | /// Gets the password sent to the proxy
34 | ///
35 | public string Password { get; init; }
36 |
37 | ///
38 | /// Default constructor
39 | ///
40 | /// The username to send to the proxy
41 | /// The password to send to the proxy
42 | public ProxyAuthenticator(string username, string password)
43 | {
44 | Username = username;
45 | Password = password;
46 | }
47 |
48 | internal void Authenticate(ReplicatorOptionsDictionary options)
49 | {
50 | var authDict = new AuthOptionsDictionary
51 | {
52 | Username = Username,
53 | Password = Password
54 | };
55 |
56 | options.ProxyAuth = authDict;
57 | }
58 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Sync/ReplicationActivityLevel.cs:
--------------------------------------------------------------------------------
1 | //
2 | // ReplicationActivityLevel.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | namespace Couchbase.Lite.Sync
20 | {
21 | ///
22 | /// An enum describing states for a
23 | ///
24 | public enum ReplicatorActivityLevel
25 | {
26 | ///
27 | /// The replication is finished or hit a fatal error
28 | ///
29 | Stopped,
30 | ///
31 | /// The replicator has detected that there is no Internet connection available
32 | ///
33 | Offline,
34 | ///
35 | /// The replicator is connecting to the remote host
36 | ///
37 | Connecting,
38 | ///
39 | /// The replication is inactive; either waiting for changes or offline
40 | /// because the remote host is unreachable
41 | ///
42 | Idle,
43 | ///
44 | /// The replication is actively transferring data
45 | ///
46 | Busy
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/API/Sync/ReplicatorStatus.cs:
--------------------------------------------------------------------------------
1 | //
2 | // ReplicatorStatus.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using System;
20 |
21 | namespace Couchbase.Lite.Sync
22 | {
23 | ///
24 | /// A struct describing the current status of a
25 | ///
26 | public struct ReplicatorStatus
27 | {
28 | ///
29 | /// Gets the current state of the replication (i.e. whether or not it is
30 | /// actively processing changes)
31 | ///
32 | public ReplicatorActivityLevel Activity { get; }
33 |
34 | ///
35 | /// Gets the current progress of the replication
36 | ///
37 | public ReplicatorProgress Progress { get; }
38 |
39 | ///
40 | /// Gets the last error that occurred, if any
41 | ///
42 | public Exception? Error { get; }
43 |
44 | internal ReplicatorStatus(ReplicatorActivityLevel activity, ReplicatorProgress progress, Exception? error)
45 | {
46 | Activity = activity;
47 | Progress = progress;
48 | Error = error;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/Couchbase.Lite.Shared.shproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 9b92b9d6-5dd3-477a-883b-1b40d5deef3b
5 | 14.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/Document/DocContext.cs:
--------------------------------------------------------------------------------
1 | //
2 | // DocContext.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 |
19 | using Couchbase.Lite.Internal.Serialization;
20 |
21 | using LiteCore.Interop;
22 |
23 | namespace Couchbase.Lite.Internal.Doc
24 | {
25 | internal unsafe class DocContext : MContext
26 | {
27 | #region Properties
28 |
29 | public Database Db { get; }
30 |
31 | public C4DocumentWrapper? Doc { get; }
32 |
33 | #endregion
34 |
35 | #region Constructors
36 |
37 | public DocContext(Database database, C4DocumentWrapper? doc)
38 | : base(new FLSlice())
39 | {
40 | Db = database;
41 | Doc = doc?.Retain();
42 | }
43 |
44 | #endregion
45 |
46 | #region Public Methods
47 |
48 | public object? ToObject(FLValue* value, bool dotNetType)
49 | {
50 | return FLValueConverter.ToCouchbaseObject(value, Db, dotNetType);
51 | }
52 |
53 | #endregion
54 |
55 | #region Overrides
56 |
57 | protected override void Dispose(bool disposing)
58 | {
59 | base.Dispose(disposing);
60 |
61 | if (disposing) {
62 | Doc?.Dispose();
63 | }
64 | }
65 |
66 | #endregion
67 | }
68 | }
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/Linq/IDocumentModel.cs:
--------------------------------------------------------------------------------
1 | //
2 | // IDocumentModel.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | #if CBL_LINQ
19 | using Newtonsoft.Json;
20 |
21 | namespace Couchbase.Lite.Linq
22 | {
23 | public interface IDocumentModel
24 | {
25 | [JsonIgnore]
26 | Document Document { get; set; }
27 | }
28 | }
29 | #endif
--------------------------------------------------------------------------------
/src/Couchbase.Lite.Shared/Linq/LiteCoreOrderingExpressionVisitor.cs:
--------------------------------------------------------------------------------
1 | //
2 | // LiteCoreOrderingExpressionVisitor.cs
3 | //
4 | // Copyright (c) 2017 Couchbase, Inc All rights reserved.
5 | //
6 | // Licensed under the Apache License, Version 2.0 (the "License");
7 | // you may not use this file except in compliance with the License.
8 | // You may obtain a copy of the License at
9 | //
10 | // http://www.apache.org/licenses/LICENSE-2.0
11 | //
12 | // Unless required by applicable law or agreed to in writing, software
13 | // distributed under the License is distributed on an "AS IS" BASIS,
14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | // See the License for the specific language governing permissions and
16 | // limitations under the License.
17 | //
18 | #if CBL_LINQ
19 | using System.Collections.Generic;
20 | using System.Linq;
21 | using System.Linq.Expressions;
22 |
23 | using Remotion.Linq.Clauses;
24 |
25 | namespace Couchbase.Lite.Internal.Linq
26 | {
27 | internal sealed class LiteCoreOrderingExpressionVisitor : LiteCoreExpressionVisitor
28 | {
29 | #region Public Methods
30 |
31 | public static IList