Extensions

The following extensions are available globally.

  • Declaration

    Swift

    struct Array<Element> : _DestructorSafeContainer
  • Declaration

    Swift

    protocol Sequence
  • Set

    Declaration

    Swift

    struct Set<Element> where Element : Hashable
  • Swift’s Optional comes with built-in methods that allow to fetch cursors and arrays of optional DatabaseValueConvertible:

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

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

    See more

    Declaration

    Swift

    @_frozen
    enum Optional<Wrapped> : ExpressibleByNilLiteral
  • CGFloat adopts DatabaseValueConvertible

    See more

    Declaration

    Swift

    struct CGFloat
  • Data is convertible to and from DatabaseValue.

    See more

    Declaration

    Swift

    struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessCollection, MutableCollection, RangeReplaceableCollection, MutableDataProtocol, ContiguousBytes
  • NSDate is stored in the database using the format yyyy-MM-dd HH:mm:ss.SSS, in the UTC time zone.

    See more

    Declaration

    Swift

    class NSDate : NSObject, NSCopying, NSSecureCoding
  • Date is stored in the database using the format yyyy-MM-dd HH:mm:ss.SSS, in the UTC time zone.

    See more

    Declaration

    Swift

    struct Date : ReferenceConvertible, Comparable, Equatable
  • NSData is convertible to and from DatabaseValue.

    See more

    Declaration

    Swift

    class NSData : NSObject, NSCopying, NSMutableCopying, NSSecureCoding
  • NSNull adopts DatabaseValueConvertible

    See more

    Declaration

    Swift

    class NSNull : NSObject, NSCopying, NSSecureCoding
  • NSNumber adopts DatabaseValueConvertible

    See more

    Declaration

    Swift

    class NSNumber : NSValue
  • NSString adopts DatabaseValueConvertible

    See more

    Declaration

    Swift

    class NSString : NSObject, NSCopying, NSMutableCopying, NSSecureCoding
  • NSURL stores its absoluteString in the database.

    See more

    Declaration

    Swift

    class NSURL : NSObject, NSSecureCoding, NSCopying
  • NSUUID adopts DatabaseValueConvertible

    See more

    Declaration

    Swift

    class NSUUID : NSObject, NSCopying, NSSecureCoding
  • UUID adopts DatabaseValueConvertible

    See more

    Declaration

    Swift

    @available(OSX 10.8, iOS 6.0, *)
    struct UUID : ReferenceConvertible, Hashable, Equatable, CustomStringConvertible
  • Bool adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct Bool
  • Int

    Int adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct Int : FixedWidthInteger, SignedInteger
  • Int8 adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct Int8 : FixedWidthInteger, SignedInteger
  • Int16 adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct Int16 : FixedWidthInteger, SignedInteger
  • Int32 adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

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

    See more

    Declaration

    Swift

    struct Int64 : FixedWidthInteger, SignedInteger
  • UInt adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct UInt : FixedWidthInteger, UnsignedInteger
  • UInt8 adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct UInt8 : FixedWidthInteger, UnsignedInteger
  • UInt16 adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct UInt16 : FixedWidthInteger, UnsignedInteger
  • UInt32 adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct UInt32 : FixedWidthInteger, UnsignedInteger
  • UInt64 adopts DatabaseValueConvertible and StatementColumnConvertible.

    See more

    Declaration

    Swift

    struct UInt64 : FixedWidthInteger, UnsignedInteger
  • 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
  • Declaration

    Swift

    struct Range<Bound> where Bound : Comparable
  • Declaration

    Swift

    struct ClosedRange<Bound> where Bound : Comparable
  • Declaration

    Swift

    typealias CountableRange<Bound> = Range<Bound> where Bound : Strideable, Bound.Stride : SignedInteger
  • Declaration

    Swift

    typealias CountableClosedRange<Bound> = ClosedRange<Bound> where Bound : Strideable, Bound.Stride : SignedInteger