Enumerations

The following enumerations are available globally.

Database events

Date functions

DatabaseDateEncodingStrategy

  • DatabaseDateEncodingStrategy specifies how EncodableRecord types that also adopt the standard Encodable protocol encode their Date properties.

    For example:

    struct Player: EncodableRecord, Encodable {
        static let databaseDateEncodingStrategy = DatabaseDateEncodingStrategy.timeIntervalSince1970
    
        var name: String
        var registrationDate: Date // encoded as an epoch timestamp
    }
    
    See more

    Declaration

    Swift

    public enum DatabaseDateEncodingStrategy

DatabaseUUIDEncodingStrategy

  • DatabaseUUIDEncodingStrategy specifies how EncodableRecord types that also adopt the standard Encodable protocol encode their UUID properties.

    For example:

    struct Player: EncodableProtocol, Encodable {
        static let databaseUUIDEncodingStrategy = DatabaseUUIDEncodingStrategy.uppercaseString
    
        // encoded in a string like "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
        var uuid: UUID
    }
    
    See more

    Declaration

    Swift

    public enum DatabaseUUIDEncodingStrategy

DatabaseColumnEncodingStrategy

  • DatabaseColumnEncodingStrategy specifies how EncodableRecord types that also adopt the standard Encodable protocol encode their coding keys into database columns.

    For example:

    struct Player: EncodableProtocol, Encodable {
        static let databaseColumnEncodingStrategy = DatabaseColumnEncodingStrategy.convertToSnakeCase
    
        // Encoded in the player_id column
        var playerID: String
    }
    
    See more

    Declaration

    Swift

    public enum DatabaseColumnEncodingStrategy

DatabaseDateDecodingStrategy

  • DatabaseDateDecodingStrategy specifies how FetchableRecord types that also adopt the standard Decodable protocol decode their Date properties.

    For example:

    struct Player: FetchableRecord, Decodable {
        static let databaseDateDecodingStrategy = DatabaseDateDecodingStrategy.timeIntervalSince1970
    
        var name: String
        var registrationDate: Date // decoded from epoch timestamp
    }
    
    See more

    Declaration

    Swift

    public enum DatabaseDateDecodingStrategy

DatabaseColumnDecodingStrategy