@@ -311,9 +311,9 @@ public struct Query {
311
311
312
312
/// Prefixes a star with the query’s table name or alias.
313
313
///
314
- /// :param: star A literal * .
314
+ /// :param: star A literal `*` .
315
315
///
316
- /// :returns: A * expression namespaced with the query’s table name or
316
+ /// :returns: A `*` expression namespaced with the query’s table name or
317
317
/// alias.
318
318
public subscript( star: Star ) -> Expression < Void > {
319
319
return namespace ( star ( nil , nil ) )
@@ -423,7 +423,7 @@ public struct Query {
423
423
424
424
/// Runs an INSERT statement against the query.
425
425
///
426
- /// :param: action An action to run in case of a conflict.
426
+ /// :param: action An optional action to run in case of a conflict.
427
427
/// :param: value A value to set.
428
428
/// :param: more A list of additional values to set.
429
429
///
@@ -434,7 +434,7 @@ public struct Query {
434
434
435
435
/// Runs an INSERT statement against the query.
436
436
///
437
- /// :param: action An action to run in case of a conflict.
437
+ /// :param: action An optional action to run in case of a conflict.
438
438
/// :param: values An array of values to set.
439
439
///
440
440
/// :returns: The rowid and statement.
@@ -492,7 +492,7 @@ public struct Query {
492
492
493
493
// MARK: - Aggregate Functions
494
494
495
- /// Runs count() against the query.
495
+ /// Runs ` count()` against the query.
496
496
///
497
497
/// :param: column The column used for the calculation.
498
498
///
@@ -501,7 +501,7 @@ public struct Query {
501
501
return calculate ( _count ( column) ) !
502
502
}
503
503
504
- /// Runs count() with DISTINCT against the query.
504
+ /// Runs ` count()` with DISTINCT against the query.
505
505
///
506
506
/// :param: column The column used for the calculation.
507
507
///
@@ -510,7 +510,7 @@ public struct Query {
510
510
return calculate ( _count ( distinct: column) ) !
511
511
}
512
512
513
- /// Runs count() with DISTINCT against the query.
513
+ /// Runs ` count()` with DISTINCT against the query.
514
514
///
515
515
/// :param: column The column used for the calculation.
516
516
///
@@ -519,7 +519,7 @@ public struct Query {
519
519
return calculate ( _count ( distinct: column) ) !
520
520
}
521
521
522
- /// Runs max() against the query.
522
+ /// Runs ` max()` against the query.
523
523
///
524
524
/// :param: column The column used for the calculation.
525
525
///
@@ -531,7 +531,7 @@ public struct Query {
531
531
return calculate ( _max ( column) )
532
532
}
533
533
534
- /// Runs min() against the query.
534
+ /// Runs ` min()` against the query.
535
535
///
536
536
/// :param: column The column used for the calculation.
537
537
///
@@ -543,7 +543,7 @@ public struct Query {
543
543
return calculate ( _min ( column) )
544
544
}
545
545
546
- /// Runs avg() against the query.
546
+ /// Runs ` avg()` against the query.
547
547
///
548
548
/// :param: column The column used for the calculation.
549
549
///
@@ -555,7 +555,7 @@ public struct Query {
555
555
return calculate ( _average ( column) )
556
556
}
557
557
558
- /// Runs avg() with DISTINCT against the query.
558
+ /// Runs ` avg()` with DISTINCT against the query.
559
559
///
560
560
/// :param: column The column used for the calculation.
561
561
///
@@ -567,7 +567,7 @@ public struct Query {
567
567
return calculate ( _average ( distinct: column) )
568
568
}
569
569
570
- /// Runs sum() against the query.
570
+ /// Runs ` sum()` against the query.
571
571
///
572
572
/// :param: column The column used for the calculation.
573
573
///
@@ -579,7 +579,7 @@ public struct Query {
579
579
return calculate ( _sum ( column) )
580
580
}
581
581
582
- /// Runs sum() with DISTINCT against the query.
582
+ /// Runs ` sum()` with DISTINCT against the query.
583
583
///
584
584
/// :param: column The column used for the calculation.
585
585
///
@@ -591,7 +591,7 @@ public struct Query {
591
591
return calculate ( _sum ( distinct: column) )
592
592
}
593
593
594
- /// Runs total() against the query.
594
+ /// Runs ` total()` against the query.
595
595
///
596
596
/// :param: column The column used for the calculation.
597
597
///
@@ -603,7 +603,7 @@ public struct Query {
603
603
return calculate ( _total ( column) ) !
604
604
}
605
605
606
- /// Runs total() with DISTINCT against the query.
606
+ /// Runs ` total()` with DISTINCT against the query.
607
607
///
608
608
/// :param: column The column used for the calculation.
609
609
///
@@ -624,19 +624,19 @@ public struct Query {
624
624
625
625
// MARK: - Array
626
626
627
- /// Runs count(*) against the query and returns it .
627
+ /// Runs ` count(*)` against the query and returns the number of rows .
628
628
public var count : Int { return calculate ( _count ( * ) ) ! }
629
629
630
- /// Returns true if the query has no rows.
630
+ /// Returns ` true` iff the query has no rows.
631
631
public var isEmpty : Bool { return first == nil }
632
632
633
- /// The first row (or nil if the query returns no rows).
633
+ /// The first row (or ` nil` if the query returns no rows).
634
634
public var first : Row ? {
635
635
var generator = limit ( to: 1 , offset: limit? . offset) . generate ( )
636
636
return generator. next ( )
637
637
}
638
638
639
- /// The last row (or nil if the query returns no rows).
639
+ /// The last row (or ` nil` if the query returns no rows).
640
640
public var last : Row ? {
641
641
return reverse ( ) . first
642
642
}
@@ -775,23 +775,39 @@ extension Query: Printable {
775
775
}
776
776
777
777
/// The result of an INSERT executed by a query.
778
+ ///
779
+ /// :param: rowid The insert rowid of the result (or `nil` on failure).
780
+ ///
781
+ /// :param: statement The associated statement.
778
782
public typealias Insert = ( rowid: Int64 ? , statement: Statement )
779
783
780
- /// The result of an UPDATE or DELETE executed by a query.
784
+ /// The result of an bulk INSERT, UPDATE or DELETE executed by a query.
785
+ ///
786
+ /// :param: changes The number of rows affected (or `nil` on failure).
787
+ ///
788
+ /// :param: statement The associated statement.
781
789
public typealias Change = ( changes: Int ? , statement: Statement )
782
790
791
+ /// If `lhs` fails, return it. Otherwise, execute `rhs` and return its
792
+ /// associated statement.
783
793
public func && ( lhs: Statement , @autoclosure rhs: ( ) -> Insert ) -> Statement {
784
794
return lhs && rhs ( ) . statement
785
795
}
786
796
797
+ /// If `lhs` succeeds, return it. Otherwise, execute `rhs` and return its
798
+ /// associated statement.
787
799
public func || ( lhs: Statement , @autoclosure rhs: ( ) -> Insert ) -> Statement {
788
800
return lhs || rhs ( ) . statement
789
801
}
790
802
803
+ /// If `lhs` fails, return it. Otherwise, execute `rhs` and return its
804
+ /// associated statement.
791
805
public func && ( lhs: Statement , @autoclosure rhs: ( ) -> Change ) -> Statement {
792
806
return lhs && rhs ( ) . statement
793
807
}
794
808
809
+ /// If `lhs` succeeds, return it. Otherwise, execute `rhs` and return its
810
+ /// associated statement.
795
811
public func || ( lhs: Statement , @autoclosure rhs: ( ) -> Change ) -> Statement {
796
812
return lhs || rhs ( ) . statement
797
813
}
0 commit comments