Skip to content

Commit 96c9eb5

Browse files
committed
Enhance documentation of generated columns
1 parent 33103bb commit 96c9eb5

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

GRDB/QueryInterface/Schema/ColumnDefinition.swift

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ public final class ColumnDefinition {
370370
/// }
371371
/// ```
372372
///
373-
/// When you want to ignore generated columns in record types, instruct
374-
/// GRDB not to select them:
373+
/// To remove the generated columns from the selection of record types,
374+
/// define their `databaseSelection`:
375375
///
376376
/// ```swift
377377
/// struct Player: Codable {
@@ -383,6 +383,9 @@ public final class ColumnDefinition {
383383
///
384384
/// extension Player: FetchableRecord, PersistableRecord {
385385
/// static var databaseSelection: [any SQLSelectable] {
386+
/// // Option 1
387+
/// [Column("id"), Column("score"), Column("bonus")]
388+
/// // Option 2
386389
/// [.allColumns(excluding: ["totalScore"])]
387390
/// }
388391
/// }
@@ -432,8 +435,8 @@ public final class ColumnDefinition {
432435
/// }
433436
/// ```
434437
///
435-
/// When you want to ignore generated columns in record types, instruct
436-
/// GRDB not to select them:
438+
/// To remove the generated columns from the selection of record types,
439+
/// define their `databaseSelection`:
437440
///
438441
/// ```swift
439442
/// struct Player: Codable {
@@ -445,6 +448,9 @@ public final class ColumnDefinition {
445448
///
446449
/// extension Player: FetchableRecord, PersistableRecord {
447450
/// static var databaseSelection: [any SQLSelectable] {
451+
/// // Option 1
452+
/// [Column("id"), Column("score"), Column("bonus")]
453+
/// // Option 2
448454
/// [.allColumns(excluding: ["totalScore"])]
449455
/// }
450456
/// }
@@ -493,8 +499,8 @@ public final class ColumnDefinition {
493499
/// }
494500
/// ```
495501
///
496-
/// When you want to ignore generated columns in record types, instruct
497-
/// GRDB not to select them:
502+
/// To remove the generated columns from the selection of record types,
503+
/// define their `databaseSelection`:
498504
///
499505
/// ```swift
500506
/// struct Player: Codable {
@@ -506,6 +512,9 @@ public final class ColumnDefinition {
506512
///
507513
/// extension Player: FetchableRecord, PersistableRecord {
508514
/// static var databaseSelection: [any SQLSelectable] {
515+
/// // Option 1
516+
/// [Column("id"), Column("score"), Column("bonus")]
517+
/// // Option 2
509518
/// [.allColumns(excluding: ["totalScore"])]
510519
/// }
511520
/// }
@@ -556,8 +565,8 @@ public final class ColumnDefinition {
556565
/// }
557566
/// ```
558567
///
559-
/// When you want to ignore generated columns in record types, instruct
560-
/// GRDB not to select them:
568+
/// To remove the generated columns from the selection of record types,
569+
/// define their `databaseSelection`:
561570
///
562571
/// ```swift
563572
/// struct Player: Codable {
@@ -569,6 +578,9 @@ public final class ColumnDefinition {
569578
///
570579
/// extension Player: FetchableRecord, PersistableRecord {
571580
/// static var databaseSelection: [any SQLSelectable] {
581+
/// // Option 1
582+
/// [Column("id"), Column("score"), Column("bonus")]
583+
/// // Option 2
572584
/// [.allColumns(excluding: ["totalScore"])]
573585
/// }
574586
/// }

0 commit comments

Comments
 (0)