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
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@
13
13
</p>
14
14
15
15
# Overview
16
-
Otter is a pure Swift SQL compiler that allow developers to write plain comile time safe SQL.
16
+
Otter is a pure Swift SQL compiler that allow developers to write plain compile time safe SQL.
17
17
18
18
-[Installation](#installation)
19
19
-[Queries](#queries)
@@ -23,7 +23,7 @@ Otter is a pure Swift SQL compiler that allow developers to write plain comile t
23
23
24
24
## Basic Primer
25
25
26
-
As a quick intro, here is an basic example. First, in SQL we will create our migrations and our first query.
26
+
As a quick intro, here is a basic example. First, in SQL we will create our migrations and our first query.
27
27
```sql
28
28
-- Located in Migrations/1.sql
29
29
CREATETABLEtodo (
@@ -61,9 +61,6 @@ for try await todos in database.todoQueries.selectTodos.observe() {
61
61
### Or Use the Swift Macro
62
62
Otter can even run within a Swift macro by adding the `@Database` macro to a `struct`.
63
63
64
-
> As of now it is not recommended for larger projects. There are quite a few limitations
65
-
that won't scale well beyond a fairly simple schema and a handfull of queries. ⚠️
66
-
67
64
```swift
68
65
@Database
69
66
structDB {
@@ -93,6 +90,10 @@ func main() async throws {
93
90
}
94
91
```
95
92
93
+
> [!IMPORTANT]
94
+
> As of now it is not recommended for larger projects. There are quite a few limitations
95
+
that won't scale well beyond a fairly simple schema and a handfull of queries.
96
+
96
97
#### Current Limitations
97
98
* Since macros operate purely on the syntax, all queries must be within the `@Database` itself so it has access to the schema.
98
99
* All generated types will be nested under the `@Database` struct.
@@ -128,7 +129,8 @@ This will create all diretories needed and will create your first migration. You
128
129
Queries.swift
129
130
```
130
131
131
-
> 💡 Tip: Follow the SQL standard and use singular table names.
132
+
> [!TIP]
133
+
> Follow the SQL standard and use singular table names. This will stop table structs from being named plural
132
134
133
135
#### Generating the Database
134
136
Once you have your first migration in and the project setup you can now generate the database. In the same directory where `init` was run, you run the `gen` command.
@@ -171,7 +173,8 @@ All queries will be stored in the `/Queries` directory. More than one query can
171
173
feather queries add --name <some-name>
172
174
```
173
175
174
-
> 💡 Tip: Organize queries by usage, not by table. This will become more useful later on when we talk about dependency injection.
176
+
> [!TIP]
177
+
> Organize queries by usage, not by table. This will become more useful later on when we talk about dependency injection.
175
178
176
179
Open the file that was created in `/Queries`, it should be blank. Individual queries can be defined using the `DEFINE` keyword. At the moment queries can only have one statement.
0 commit comments