DatabaseUUIDEncodingStrategy

public enum 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 = .string

    // encoded in a string like "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
    var uuid: UUID
}
  • The strategy that uses formatting from the UUID type.

    It encodes UUIDs as 16-bytes data blobs.

    Declaration

    Swift

    case deferredToUUID
  • Encodes UUIDs as strings such as E621E1F8-C36C-495A-93FC-0C247A3E6E5F

    Declaration

    Swift

    case string