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
Copy file name to clipboardExpand all lines: README.md
+19-2Lines changed: 19 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,10 @@
13
13
</p>
14
14
15
15
# Overview
16
-
Otter is a pure Swift SQL compiler that allow developers to write plain compile time safe SQL.
16
+
Otter is a pure Swift SQL compiler that allow developers to simply write plain SQL with compile time safety.
17
+
If your database schema changes, you will get compile time errors for the places that need to be fixed.
18
+
It just doesn't generate the code to talk to SQLite, but rather your entire data layer in a testable
19
+
flexible manner. No more writing mocks or wrappers. Just pass in the query.
17
20
18
21
-[Installation](#installation)
19
22
-[Macros](#or-use-the-swift-macro)
@@ -59,6 +62,19 @@ for try await todos in database.todoQueries.selectTodos.observe() {
59
62
}
60
63
```
61
64
65
+
Otter is built with testing in mind. Dependency injection is possible right out of the box.
66
+
No need to wrap your database in repositories. Just pass in the `any <Name>Query` and
67
+
you can pass in `Queries.Just`, `Queries.Fail` or even `Queries.Test` for call counts.
68
+
```swift
69
+
classViewModel {
70
+
let selectTodos: any SelectTodosQuery
71
+
}
72
+
73
+
let live =ViewModel(selectTodos: db.todoQueries.selectTodos)
74
+
75
+
let test =ViewModel(selectTodos: Queries.Just([...]))
76
+
```
77
+
62
78
### Or Use the Swift Macro
63
79
Otter can even run within a Swift macro by adding the `@Database` macro to a `struct`.
64
80
@@ -377,6 +393,7 @@ ORDER BY rank;
377
393
## Upcoming Features
378
394
Otter is a young project and there are a lot of new features and functionality I want to add.
379
395
Below are some idea that I would love input on!
396
+
- LSP and vscode plugin
380
397
- Support for multiple statements in a single query
381
398
- Kotlin library/generation
382
399
- Generating Kotlin would allow SQLite based apps to basically share their model/data layer
@@ -385,7 +402,7 @@ Below are some idea that I would love input on!
385
402
- Queries with multiple statements
386
403
- Would allow for easier loading of more complex models that have many joins
387
404
- Want to allow other queries to be called from within the body to help centrize logic.
388
-
- Postgres support for server side swift ❤️
405
+
- Postgres support for server side swift
389
406
390
407
## Contributions
391
408
Contributions are welcome and encouraged! Feel free to make a PR or open an issue. If the change is large please open an issue first to make sure the change is desired.
0 commit comments