Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdgr8 committed Jan 23, 2024
1 parent 593a6a2 commit c75ba7b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
20 changes: 20 additions & 0 deletions couchbase-lite-ee-ktx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ val document = MutableDocument {
database.save(document)
```

##### Collection creation functions

You can create a `MutableArray` or `MutableDictionary` using idiomatic `vararg` functions:

```kotlin
mutableArrayOf("hello", 42, true)
mutableDictOf("key1" to "value1", "key2" to 2, "key3" to null)
```

The similar `mutableDocOf` function allows nesting dictionary types, unlike the `MutableDocument` DSL:

```kotlin
mutableDocOf(
"string" to "hello",
"number" to 42,
"array" to mutableArrayOf(1, 2, 3),
"dict" to mutableDictOf("key" to "value")
)
```

#### Flow support

Supplementing the `Flow` APIs from [Couchbase Lite Android KTX](
Expand Down
20 changes: 20 additions & 0 deletions couchbase-lite-ktx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ val document = MutableDocument {
database.save(document)
```

##### Collection creation functions

You can create a `MutableArray` or `MutableDictionary` using idiomatic `vararg` functions:

```kotlin
mutableArrayOf("hello", 42, true)
mutableDictOf("key1" to "value1", "key2" to 2, "key3" to null)
```

The similar `mutableDocOf` function allows nesting dictionary types, unlike the `MutableDocument` DSL:

```kotlin
mutableDocOf(
"string" to "hello",
"number" to 42,
"array" to mutableArrayOf(1, 2, 3),
"dict" to mutableDictOf("key" to "value")
)
```

#### Flow support

Supplementing the `Flow` APIs from [Couchbase Lite Android KTX](
Expand Down
20 changes: 20 additions & 0 deletions docs/ktx.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,26 @@ val document = MutableDocument {
database.save(document)
```

#### Collection creation functions

You can create a `MutableArray` or `MutableDictionary` using idiomatic `vararg` functions:

```kotlin
mutableArrayOf("hello", 42, true)
mutableDictOf("key1" to "value1", "key2" to 2, "key3" to null)
```

The similar `mutableDocOf` function allows nesting dictionary types, unlike the `MutableDocument` DSL:

```kotlin
mutableDocOf(
"string" to "hello",
"number" to 42,
"array" to mutableArrayOf(1, 2, 3),
"dict" to mutableDictOf("key" to "value")
)
```

### Flow support

Supplementing the `Flow` APIs from [Couchbase Lite Android KTX](
Expand Down

0 comments on commit c75ba7b

Please sign in to comment.