drift icon indicating copy to clipboard operation
drift copied to clipboard

Make the tables and daos list receive only its supported types (Table/DatabaseAccessor)

Open pedromassango opened this issue 5 years ago • 2 comments

I just made the list of tables receive classes that extends Table class and the daos list receive classes that extends DatabaseAccessor class.

pedromassango avatar Feb 02 '20 18:02 pedromassango

Thanks for the contribution!

I'm not sure if this works though. We'd have to change usages from

@UseMoor(tables: [Users])

to

@UseMoor(tables: [Users()])

and convert the type to an actual instance. This is pretty breaking, especially since Table doesn't have a const constructor. I've left a note on a related Dart language issue asking for something like List<Type<Table>>.

simolus3 avatar Feb 02 '20 21:02 simolus3

Thanks for the contribution!

I'm not sure if this works though. We'd have to change usages from

@UseMoor(tables: [Users])

to

@UseMoor(tables: [Users()])

and convert the type to an actual instance. This is pretty breaking, especially since Table doesn't have a const constructor. I've left a note on a related Dart language issue asking for something like List<Type<Table>>.

I took some time trying to fix it until I saw you comment here. Thank you.

pedromassango avatar Feb 03 '20 08:02 pedromassango

@pedromassango @simolus3 should this be closed so a surface level evaluation of long-outstanding PRs isn't an orange flag to new people evaluating this package? thanks

neiljaywarner avatar Feb 26 '24 18:02 neiljaywarner

Good point - unfortunately the PR doesn't work as is and since Type isn't generic it can't be fixed either.

simolus3 avatar Feb 26 '24 23:02 simolus3