@@ -311,9 +311,9 @@ public struct Query {
311311
312312 /// Prefixes a star with the query’s table name or alias.
313313 ///
314- /// :param: star A literal * .
314+ /// :param: star A literal `*` .
315315 ///
316- /// :returns: A * expression namespaced with the query’s table name or
316+ /// :returns: A `*` expression namespaced with the query’s table name or
317317 /// alias.
318318 public subscript( star: Star ) -> Expression < Void > {
319319 return namespace ( star ( nil , nil ) )
@@ -423,7 +423,7 @@ public struct Query {
423423
424424 /// Runs an INSERT statement against the query.
425425 ///
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.
427427 /// :param: value A value to set.
428428 /// :param: more A list of additional values to set.
429429 ///
@@ -434,7 +434,7 @@ public struct Query {
434434
435435 /// Runs an INSERT statement against the query.
436436 ///
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.
438438 /// :param: values An array of values to set.
439439 ///
440440 /// :returns: The rowid and statement.
@@ -492,7 +492,7 @@ public struct Query {
492492
493493 // MARK: - Aggregate Functions
494494
495- /// Runs count() against the query.
495+ /// Runs ` count()` against the query.
496496 ///
497497 /// :param: column The column used for the calculation.
498498 ///
@@ -501,7 +501,7 @@ public struct Query {
501501 return calculate ( _count ( column) ) !
502502 }
503503
504- /// Runs count() with DISTINCT against the query.
504+ /// Runs ` count()` with DISTINCT against the query.
505505 ///
506506 /// :param: column The column used for the calculation.
507507 ///
@@ -510,7 +510,7 @@ public struct Query {
510510 return calculate ( _count ( distinct: column) ) !
511511 }
512512
513- /// Runs count() with DISTINCT against the query.
513+ /// Runs ` count()` with DISTINCT against the query.
514514 ///
515515 /// :param: column The column used for the calculation.
516516 ///
@@ -519,7 +519,7 @@ public struct Query {
519519 return calculate ( _count ( distinct: column) ) !
520520 }
521521
522- /// Runs max() against the query.
522+ /// Runs ` max()` against the query.
523523 ///
524524 /// :param: column The column used for the calculation.
525525 ///
@@ -531,7 +531,7 @@ public struct Query {
531531 return calculate ( _max ( column) )
532532 }
533533
534- /// Runs min() against the query.
534+ /// Runs ` min()` against the query.
535535 ///
536536 /// :param: column The column used for the calculation.
537537 ///
@@ -543,7 +543,7 @@ public struct Query {
543543 return calculate ( _min ( column) )
544544 }
545545
546- /// Runs avg() against the query.
546+ /// Runs ` avg()` against the query.
547547 ///
548548 /// :param: column The column used for the calculation.
549549 ///
@@ -555,7 +555,7 @@ public struct Query {
555555 return calculate ( _average ( column) )
556556 }
557557
558- /// Runs avg() with DISTINCT against the query.
558+ /// Runs ` avg()` with DISTINCT against the query.
559559 ///
560560 /// :param: column The column used for the calculation.
561561 ///
@@ -567,7 +567,7 @@ public struct Query {
567567 return calculate ( _average ( distinct: column) )
568568 }
569569
570- /// Runs sum() against the query.
570+ /// Runs ` sum()` against the query.
571571 ///
572572 /// :param: column The column used for the calculation.
573573 ///
@@ -579,7 +579,7 @@ public struct Query {
579579 return calculate ( _sum ( column) )
580580 }
581581
582- /// Runs sum() with DISTINCT against the query.
582+ /// Runs ` sum()` with DISTINCT against the query.
583583 ///
584584 /// :param: column The column used for the calculation.
585585 ///
@@ -591,7 +591,7 @@ public struct Query {
591591 return calculate ( _sum ( distinct: column) )
592592 }
593593
594- /// Runs total() against the query.
594+ /// Runs ` total()` against the query.
595595 ///
596596 /// :param: column The column used for the calculation.
597597 ///
@@ -603,7 +603,7 @@ public struct Query {
603603 return calculate ( _total ( column) ) !
604604 }
605605
606- /// Runs total() with DISTINCT against the query.
606+ /// Runs ` total()` with DISTINCT against the query.
607607 ///
608608 /// :param: column The column used for the calculation.
609609 ///
@@ -624,19 +624,19 @@ public struct Query {
624624
625625 // MARK: - Array
626626
627- /// Runs count(*) against the query and returns it .
627+ /// Runs ` count(*)` against the query and returns the number of rows .
628628 public var count : Int { return calculate ( _count ( * ) ) ! }
629629
630- /// Returns true if the query has no rows.
630+ /// Returns ` true` iff the query has no rows.
631631 public var isEmpty : Bool { return first == nil }
632632
633- /// The first row (or nil if the query returns no rows).
633+ /// The first row (or ` nil` if the query returns no rows).
634634 public var first : Row ? {
635635 var generator = limit ( to: 1 , offset: limit? . offset) . generate ( )
636636 return generator. next ( )
637637 }
638638
639- /// The last row (or nil if the query returns no rows).
639+ /// The last row (or ` nil` if the query returns no rows).
640640 public var last : Row ? {
641641 return reverse ( ) . first
642642 }
@@ -775,23 +775,39 @@ extension Query: Printable {
775775}
776776
777777/// 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.
778782public typealias Insert = ( rowid: Int64 ? , statement: Statement )
779783
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.
781789public typealias Change = ( changes: Int ? , statement: Statement )
782790
791+ /// If `lhs` fails, return it. Otherwise, execute `rhs` and return its
792+ /// associated statement.
783793public func && ( lhs: Statement , @autoclosure rhs: ( ) -> Insert ) -> Statement {
784794 return lhs && rhs ( ) . statement
785795}
786796
797+ /// If `lhs` succeeds, return it. Otherwise, execute `rhs` and return its
798+ /// associated statement.
787799public func || ( lhs: Statement , @autoclosure rhs: ( ) -> Insert ) -> Statement {
788800 return lhs || rhs ( ) . statement
789801}
790802
803+ /// If `lhs` fails, return it. Otherwise, execute `rhs` and return its
804+ /// associated statement.
791805public func && ( lhs: Statement , @autoclosure rhs: ( ) -> Change ) -> Statement {
792806 return lhs && rhs ( ) . statement
793807}
794808
809+ /// If `lhs` succeeds, return it. Otherwise, execute `rhs` and return its
810+ /// associated statement.
795811public func || ( lhs: Statement , @autoclosure rhs: ( ) -> Change ) -> Statement {
796812 return lhs || rhs ( ) . statement
797813}
0 commit comments