Skip to content

Commit 1c048fd

Browse files
committed
Fix whitespace issues in documentation
Signed-off-by: Stephen Celis <[email protected]>
1 parent c4fa24f commit 1c048fd

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

Documentation/Index.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ To use SQLite.swift classes or structures in your target’s source file, first
8181

8282
``` swift
8383
import SQLite
84-
```
84+
```
8585

8686

8787
### Connecting to a Database
@@ -237,7 +237,7 @@ The `create(table:)` function has several default parameters we can override.
237237
db.create(table: users, temporary: true) { t in /* ... */ }
238238
// CREATE TEMPORARY TABLE "users" -- ...
239239
```
240-
240+
241241
- `ifNotExists` adds an `IF NOT EXISTS` clause to the `CREATE TABLE` statement (which will bail out gracefully if the table already exists). Default: `false`.
242242

243243
``` swift
@@ -266,21 +266,21 @@ The `column` function is used for a single column definition. It takes an [expre
266266
t.column(email, unique: true)
267267
// "email" TEXT UNIQUE NOT NULL
268268
```
269-
269+
270270
- `check` attaches a `CHECK` constraint to a column definition in the form of a boolean expression (`Expression<Bool>`). Boolean expressions can be easily built using [filter operators and functions](#filter-operators-and-functions). (See also the `check` function under [Table Constraints](#table-constraints).)
271271

272272
``` swift
273273
t.column(email, check: like("%@%", email))
274274
// "email" TEXT NOT NULL CHECK ("email" LIKE '%@%')
275275
```
276-
276+
277277
- `defaultValue` adds a `DEFAULT` clause to a column definition and _only_ accepts a value (or expression) matching the column’s type. This value is used if none is explicitly provided during [an `INSERT`](#inserting-rows).
278278

279279
``` swift
280280
t.column(name, defaultValue: "Anonymous")
281281
// "name" TEXT DEFAULT 'Anonymous'
282282
```
283-
283+
284284
> _Note:_ The `defaultValue` parameter cannot be used alongside `primaryKey` and `references`. If you need to create a column that has a default value and is also a primary and/or foreign key, use the `primaryKey` and `foreignKey` functions mentioned under [Table Constraints](#table-constraints).
285285

286286
- `collate` adds a `COLLATE` clause to `Expression<String>` (and `Expression<String?>`) column definitions with [a collating sequence](https://www.sqlite.org/datatype3.html#collation) defined in the `Collation` enumeration.
@@ -289,7 +289,7 @@ The `column` function is used for a single column definition. It takes an [expre
289289
t.column(email, collate: .NoCase)
290290
// "email" TEXT NOT NULL COLLATE NOCASE
291291
```
292-
292+
293293
- `references` adds a `REFERENCES` clause to `Expression<Int>` (and `Expression<Int?>`) column definitions and accepts a table (`Query`) or namespaced column expression. (See the `foreignKey` function under [Table Constraints](#table-constraints) for non-integer foreign key support.)
294294

295295
``` swift
@@ -314,14 +314,14 @@ Additional constraints may be provided outside the scope of a single column usin
314314
t.primaryKey(email.asc, name)
315315
// PRIMARY KEY("email" ASC, "name")
316316
```
317-
317+
318318
- `unique` adds a `UNIQUE` constraint to the table. Unlike [the column constraint, above](#column-constraints), it supports composite (multiple column) constraints.
319319

320320
``` swift
321321
t.unique(local, domain)
322322
// UNIQUE("local", "domain")
323323
```
324-
324+
325325
- `check` adds a `CHECK` constraint to the table in the form of a boolean expression (`Expression<Bool>`). Boolean expressions can be easily built using [filter operators and functions](#filter-operators-and-functions). (See also the `check` parameter under [Column Constraints](#column-constraints).)
326326

327327
``` swift
@@ -358,7 +358,7 @@ The `insert` function can return several different types that are useful in diff
358358

359359
``` swift
360360
if let insertID = users.insert(email <- "[email protected]") {
361-
println("inserted id: \(insertID)")
361+
println("inserted id: \(insertID)")
362362
}
363363
```
364364

@@ -383,23 +383,23 @@ The `insert` function can return several different types that are useful in diff
383383
// INSERT INTO "users" ("email") VALUES ('[email protected]');
384384
// INSERT INTO "users" ("email") VALUES ('[email protected]');
385385
// COMMIT TRANSACTION;
386-
```
386+
```
387387

388388
- A tuple of the above [`ROWID`][ROWID] and statement: `(ID: Int?, Statement)`, for flexibility.
389389

390390
``` swift
391391
let (ID, statement) = users.insert(email <- "[email protected]")
392392
if let ID = ID {
393-
println("inserted id: \(ID)")
393+
println("inserted id: \(ID)")
394394
} else if statement.failed {
395-
println("insertion failed: \(statement.reason)")
395+
println("insertion failed: \(statement.reason)")
396396
}
397397
```
398398

399399
The [`update`](#updating-rows) and [`delete`](#deleting-rows) functions follow similar patterns.
400400

401401
> _Note:_ If `insert` is called without any arguments, the statement will run with a `DEFAULT VALUES` clause. The table must not have any constraints that aren’t fulfilled by default values.
402-
>
402+
>
403403
> ``` swift
404404
> timestamps.insert()!
405405
> // INSERT INTO "timestamps" DEFAULT VALUES
@@ -790,7 +790,7 @@ Like [`insert`](#inserting-rows) (and [`delete`](#updating-rows)), `update` can
790790

791791
``` swift
792792
if alice.update(email <- "[email protected]") > 0 {
793-
println("updated Alice")
793+
println("updated Alice")
794794
}
795795
```
796796

@@ -834,7 +834,7 @@ Like [`insert`](#inserting-rows) and [`update`](#updating-rows), `delete` can re
834834

835835
``` swift
836836
if alice.delete() > 0 {
837-
println("deleted Alice")
837+
println("deleted Alice")
838838
}
839839
```
840840

@@ -895,7 +895,7 @@ db.alter(table: users, add: suffix)
895895
#### Added Column Constraints
896896

897897
The `alter` function shares several of the same [`column` function parameters](#column-constraints) used when [creating tables](#creating-a-table).
898-
898+
899899
- `check` attaches a `CHECK` constraint to a column definition in the form of a boolean expression (`Expression<Bool>`). (See also the `check` function under [Table Constraints](#table-constraints).)
900900

901901
``` swift
@@ -904,14 +904,14 @@ The `alter` function shares several of the same [`column` function parameters](#
904904
// ALTER TABLE "users"
905905
// ADD COLUMN "suffix" TEXT CHECK ("suffix" IN ('JR', 'SR'))
906906
```
907-
907+
908908
- `defaultValue` adds a `DEFAULT` clause to a column definition and _only_ accepts a value matching the column’s type. This value is used if none is explicitly provided during [an `INSERT`](#inserting-rows).
909909

910910
``` swift
911911
db.alter(table: users, add: suffix, defaultValue: "SR")
912912
// ALTER TABLE "users" ADD COLUMN "suffix" TEXT DEFAULT 'SR'
913913
```
914-
914+
915915
> _Note:_ Unlike the [`CREATE TABLE` constraint](#table-constraints), default values may not be expression structures (including `CURRENT_TIME`, `CURRENT_DATE`, or `CURRENT_TIMESTAMP`).
916916

917917
<!-- FIXME
@@ -935,7 +935,7 @@ The `alter` function shares several of the same [`column` function parameters](#
935935
```
936936

937937

938-
### Indexes
938+
### Indexes
939939

940940

941941
#### Creating Indexes
@@ -1303,4 +1303,4 @@ We can log SQL using the database’s `trace` function.
13031303
```
13041304

13051305

1306-
[ROWID]: https://sqlite.org/lang_createtable.html#rowid
1306+
[ROWID]: https://sqlite.org/lang_createtable.html#rowid

0 commit comments

Comments
 (0)