Closed Noxits closed 1 month ago
I think the postgres package only supports some array types, but we should definitely have support for those in drift_postgres
.
Or is there a dark magic way with custom queries?
You can use custom SQL types as a workaround until we have official support for them. That's not even dark magic, an official API in package:drift_postgres
will be built with the same thing :)
I've added them to drift_postgres
in c621ef9c6be3ef83a948124fcc830517b22b5559.
Sweet, thanks :D
You can use custom SQL types as a workaround
Oopsies, totally forgot about this functionality, my bad
Hmm, it seems I can get it working with default values
class User extends Table {
Column<List<int>> get example => customType(PgTypes.bigIntArray).withDefault(const Constant([]))();
}
Throws :
Invalid argument (dart): Must be null, bool, String, int, DateTime, Uint8List or double: _ImmutableList len:0
Ah right, I think you'd have that problem with all custom types - at the moment we're unfortunately unable to infer the type to apply in that context.
Does it work if you explicitly apply the type on the constant, e.g Constant([], PgTypes.bigIntArray)
?
It indeed does, thank you very much.
Sorry, I should really open my eyes somehow, the solution was right in front of me..
No problem - the fact that the custom type has to be specified twice here not intuitive at all, I consider this to be a flaw in drift. It's just not easy to fix...
Is your feature request related to a problem? Please describe. Are postgresql arrays supported? I've stumbled accros the issues/disscusions and code but couldn't find anything. Or is there a dark magic way with custom queries?
Describe the solution you'd like Support for postgresql arrays