Skip to content

Commit 533e47e

Browse files
committed
Swift prefers camelCase
Pulling snake_case over for an interface isn't necessary. Signed-off-by: Stephen Celis <stephen@stephencelis.com>
1 parent e7fbda4 commit 533e47e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Documentation/Index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ Occasionally, we need to join a table to itself, in which case we must alias the
601601
``` swift
602602
let managers = users.alias("managers")
603603

604-
let query = users.join(managers, on: managers[id] == users[manager_id])
604+
let query = users.join(managers, on: managers[id] == users[managerId])
605605
// SELECT * FROM "users"
606606
// INNER JOIN ("users") AS "managers" ON ("managers"."id" = "users"."manager_id")
607607
```
@@ -859,7 +859,7 @@ Using the `transaction` and `savepoint` functions, we can run a series of statem
859859
``` swift
860860
db.transaction()
861861
&& users.insert(email <- "betty@icloud.com")
862-
&& users.insert(email <- "cathy@icloud.com", manager_id <- db.lastInsertRowid)
862+
&& users.insert(email <- "cathy@icloud.com", managerId <- db.lastInsertRowid)
863863
&& db.commit() || db.rollback()
864864
```
865865

@@ -870,7 +870,7 @@ For more complex transactions and savepoints, block helpers exist. Using a block
870870
``` swift
871871
db.transaction { txn in
872872
if let rowid = users.insert(email <- "betty@icloud.com").rowid {
873-
if users.insert(email <- "cathy@icloud.com", manager_id <- db.lastInsertRowid).rowid != nil {
873+
if users.insert(email <- "cathy@icloud.com", managerId <- db.lastInsertRowid).rowid != nil {
874874
return .Commit
875875
}
876876
}

SQLite.playground/Contents.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ let id = Expression<Int64>("id")
111111
let email = Expression<String>("email")
112112
let age = Expression<Int?>("age")
113113
let admin = Expression<Bool>("admin")
114-
let manager_id = Expression<Int64?>("manager_id")
114+
let managerId = Expression<Int64?>("manager_id")
115115
/*:
116116
The query-building interface is provided via the `Query` struct. We can access this interface by subscripting our database connection with a table name.
117117
*/
@@ -129,7 +129,7 @@ The `insert` function can return a `rowid` (which will be `nil` in the case of f
129129
*/
130130
db.transaction()
131131
&& users.insert(email <- "julie@acme.com")
132-
&& users.insert(email <- "kelly@acme.com", manager_id <- db.lastInsertRowid)
132+
&& users.insert(email <- "kelly@acme.com", managerId <- db.lastInsertRowid)
133133
&& db.commit()
134134
|| db.rollback()
135135
/*:

0 commit comments

Comments
 (0)