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
Since an orm is a very integral part of any backend framework, dartseid should have one as well. Since code generation and reflection are not part of the design architecture of dartseid, let us discuss and come up with the design of how we can implement an orm.
Design Considerations:
Dartseid orm should have an adapter pattern so that any database can be used with it. We can support some common databases in the beginning and have it be extendable so that any new database can be easily added to it. There should be a way to get the data returned from the db queries into data classes. The database adapter needs to handle db connection, query optimization, connection pooling and more.
Some possible apis can be considered such as this:
// Query@dataClassclassSelectedUser {
constfactorySelectedUserProfile({
int id,
String fullName,
SelectedUserProfile profile,
}) =_SelectedUserProfile;
}
@dataClassclassSelectedUserProfile {
constfactorySelectedUserProfile({
String bio,
String? avatar,
}) =_SelectedUserProfile;
}
final user =await usersSchema.findFirst().where({"id":isEqual(1)}).include(
"profile",
profilesSchema,
on:"profileId", // Can be omitted as defined in schema
where: {"bio":isNotEmpty()},
).select(
{
"id",
"fullName",
"profile": {"id", "bio"},
},
).exec(
converter:SelectedUser.fromJson, // Can be omitted if no select or aggregation operations are used
);
Feature Request: Dartseid should have an orm.
Since an orm is a very integral part of any backend framework, dartseid should have one as well. Since code generation and reflection are not part of the design architecture of dartseid, let us discuss and come up with the design of how we can implement an orm.
Design Considerations:
Dartseid orm should have an adapter pattern so that any database can be used with it. We can support some common databases in the beginning and have it be extendable so that any new database can be easily added to it. There should be a way to get the data returned from the db queries into data classes. The database adapter needs to handle db connection, query optimization, connection pooling and more.
Some possible apis can be considered such as this:
The other most important feature would be to consider migrations, to generate, run and keep track of migrations.
We can create a package executable in the dartseid orm package to handle these things.
Let's discuss further.
The text was updated successfully, but these errors were encountered: