Skip to content

Commit 7615d8a

Browse files
committed
Update README.md
1 parent 7f7365f commit 7615d8a

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,39 @@ You can install SQLiteCloud Swift Package using Swift Package Manager (SPM). Add
2121

2222
```swift
2323
dependencies: [
24-
.package(url: "https://github.com/sqlitecloud/swift", from: "0.2.0")
24+
.package(url: "https://github.com/sqlitecloud/swift", from: "0.1.0")
2525
]
2626
```
2727

28+
## Usage
29+
30+
#### Using explicit configuration
31+
32+
```
33+
let configuration = SQLiteCloudConfig(host: "myproject.sqlite.cloud", username: "", password: "", port: .default)
34+
let sqliteCloud = SQLiteCloud(configuration)
35+
36+
do {
37+
try await sqliteCloud.connect()
38+
debugPrint("connected")
39+
} catch {
40+
debugPrint("connection error: \(error)") // SQLiteCloudConnectionError
41+
}
42+
```
43+
44+
#### Using string configuration
45+
46+
```
47+
let configuration = SQLiteCloudConfig(connectionString: "sqlitecloud://user:[email protected]:port/dbname?timeout=10&key2=value2&key3=value3")
48+
let sqliteCloud = SQLiteCloud(configuration)
49+
50+
do {
51+
try await sqliteCloud.connect()
52+
debugPrint("connected")
53+
} catch {
54+
debugPrint("connection error: \(error)") // SQLiteCloudConnectionError
55+
}
56+
```
57+
2858
## License
2959
SQLiteCloud is licensed under the MIT License. See the LICENSE file for details.

0 commit comments

Comments
 (0)