You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Align codebase with feather database API 1.0.0-beta.3 release (#7)
⚠️ Breaking changes:
- With-style API for transaction & connection
- Using RowSequence in a handler instead of a return value
- Query result renamed to RowSequence
- Remove execute API from database client
- Improve transaction error interface
- Sendable fixes
---------
Co-authored-by: GErP83 <gurrka@gmail.com>
API documentation is available at the following link.
46
+
API documentation is available at the link below:
47
+
48
+
[](https://feather-framework.github.io/feather-sqlite-database/)
59
49
60
-
> [!TIP]
61
-
> Avoid calling `database.execute` while in a transaction; use the transaction `connection` instead.
50
+
Here is a brief example:
62
51
63
52
```swift
64
53
importLogging
@@ -75,19 +64,25 @@ let configuration = SQLiteClient.Configuration(
75
64
)
76
65
77
66
let client =SQLiteClient(configuration: configuration)
78
-
tryawait client.run()
79
67
80
-
let database =SQLiteDatabaseClient(client: client)
81
-
82
-
let result =tryawait database.execute(
83
-
query: #"""
84
-
SELECT
85
-
sqlite_version() AS "version"
86
-
WHERE
87
-
1=\#(1);
88
-
"""#
68
+
let database =SQLiteDatabaseClient(
69
+
client: client,
70
+
logger: logger
89
71
)
90
72
73
+
tryawait client.run()
74
+
75
+
tryawait database.withConnection { connection in
76
+
tryawait connection.run(
77
+
query: #"""
78
+
SELECT
79
+
sqlite_version() AS "version"
80
+
WHERE
81
+
1=\#(1);
82
+
"""#
83
+
)
84
+
}
85
+
91
86
fortryawait item in result {
92
87
let version =try item.decode(column: "version", as: String.self)
93
88
print(version)
@@ -99,7 +94,6 @@ await client.shutdown()
99
94
> [!WARNING]
100
95
> This repository is a work in progress, things can break until it reaches v1.0.0.
101
96
102
-
103
97
## Other database drivers
104
98
105
99
The following database driver implementations are available for use:
@@ -110,12 +104,12 @@ The following database driver implementations are available for use:
110
104
## Development
111
105
112
106
- Build: `swift build`
113
-
- Test:
114
-
- local: `swift test`
115
-
- using Docker: `make docker-test`
107
+
- Test:
108
+
- local: `swift test`
109
+
- using Docker: `make docker-test`
116
110
- Format: `make format`
117
111
- Check: `make check`
118
112
119
113
## Contributing
120
114
121
-
[Pull requests](https://github.com/feather-framework/feather-sqlite-database/pulls) are welcome. Please keep changes focused and include tests for new logic. 🙏
115
+
[Pull requests](https://github.com/feather-framework/feather-sqlite-database/pulls) are welcome. Please keep changes focused and include tests for new logic.
0 commit comments