Extensions

The following extensions are available globally.

  • Declaration

    Swift

    struct Array<Element> : RandomAccessCollection, MutableCollection
  • Declaration

    Swift

    protocol Sequence
  • Swift’s Optional comes with built-in methods that allow to fetch cursors and arrays of optional DatabaseValueConvertible:

    try Optional<String>.fetchCursor(db, "SELECT name FROM ...", arguments:...) // DatabaseCursor<String?>
    try Optional<String>.fetchAll(db, "SELECT name FROM ...", arguments:...)    // [String?]
    
    let statement = try db.makeSelectStatement("SELECT name FROM ...")
    try Optional<String>.fetchCursor(statement, arguments:...) // DatabaseCursor<String?>
    try Optional<String>.fetchAll(statement, arguments:...)    // [String?]
    

    DatabaseValueConvertible is adopted by Bool, Int, String, etc.

    See more

    Declaration

    Swift

    enum Optional<Wrapped> : ExpressibleByNilLiteral
  • NSData is convertible to and from DatabaseValue.

    See more

    Declaration

    Swift

    class NSData : NSObject, NSCopying, NSMutableCopying, NSSecureCoding
  • DatabaseValueConvertible is free for RawRepresentable types whose raw value is itself DatabaseValueConvertible.

    // If the RawValue adopts DatabaseValueConvertible...
    enum Color : Int {
        case red
        case white
        case rose
    }
    
    // ... then the RawRepresentable type can freely adopt DatabaseValueConvertible:
    extension Color : DatabaseValueConvertible { /* empty */ }
    
    See more

    Declaration

    Swift

    protocol RawRepresentable
  • DatabaseValueConvertible is free for ReferenceConvertible types whose ReferenceType is itself DatabaseValueConvertible.

    class FooReference { ... }
    struct Foo : ReferenceConvertible {
        typealias ReferenceType = FooReference
    }
    
    // If the ReferenceType adopts DatabaseValueConvertible...
    extension FooReference : DatabaseValueConvertible { ... }
    
    // ... then the ReferenceConvertible type can freely adopt DatabaseValueConvertible:
    extension Foo : DatabaseValueConvertible { /* empty */ }
    
    See more

    Declaration

    Swift

    protocol ReferenceConvertible : CustomStringConvertible, CustomDebugStringConvertible, Hashable, Equatable
  • Declaration

    Swift

    struct Range<Bound> where Bound : Comparable
  • Declaration

    Swift

    struct ClosedRange<Bound> where Bound : Comparable
  • Declaration

    Swift

    struct CountableRange<Bound> : RandomAccessCollection where Bound : Comparable, Bound : _Strideable, Bound.Stride : SignedInteger
  • Declaration

    Swift

    struct CountableClosedRange<Bound> : RandomAccessCollection where Bound : Comparable, Bound : _Strideable, Bound.Stride : SignedInteger
  • Bool adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct Bool
  • Int

    Int adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct Int : SignedInteger, Comparable, Equatable
  • Int32 adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct Int32 : SignedInteger, Comparable, Equatable
  • Int64 adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct Int64 : SignedInteger, Comparable, Equatable
  • Double adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct Double
  • Float adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct Float
  • String adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct String