You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I attempted to create a custom column type (UUID) and implemented BlackbirdColumnWrappable and BlackbirdStorableAsText as follows:
extensionUUID:BlackbirdColumnWrappable,BlackbirdStorableAsText{publicstaticfunc fromValue(_ value:Blackbird.Value)->UUID?{
guard case letBlackbird.Value.text(stringValue)= value else{returnnil}returnUUID(uuidString: stringValue)}publicfunc unifiedRepresentation()->String{self.uuidString
}publicstaticfunc from(unifiedRepresentation:String)->UUID{returnUUID(uuidString: unifiedRepresentation)!
}}
I also added an init(from:) decoder to my model as show in the comments of BlackbirdSchema.swift.
However, my model does not pass the schema validation because instead of using the BlackbirdDefaultsDecoder, which supplies a valid default for UUID, it uses the BlackbirdSQLiteDecoder which bypasses the if statement in my init(from:) to test for the BlackbirdDefaultsDecoder and provide a valid default.
I attempted to create a custom column type (UUID) and implemented
BlackbirdColumnWrappable
andBlackbirdStorableAsText
as follows:I also added an
init(from:)
decoder to my model as show in the comments of BlackbirdSchema.swift.However, my model does not pass the schema validation because instead of using the
BlackbirdDefaultsDecoder
, which supplies a valid default for UUID, it uses theBlackbirdSQLiteDecoder
which bypasses the if statement in myinit(from:)
to test for theBlackbirdDefaultsDecoder
and provide a valid default.Should the decoder at the following line be
BlackbirdDefaultsDecoder
to ensure the testRow has the right default for the column?https://github.com/marcoarment/Blackbird/blob/2f15d7fae9f3821b43b7a945af38273fcb955157/Sources/Blackbird/BlackbirdModel.swift#L826C1-L835C10
Or am I just on the wrong path and this is not a feature Blackbird is supporting?
The text was updated successfully, but these errors were encountered: