fullyQualified method
The fully qualified column name, potentially including a relationshipPrefix.
This is the name that should be used in filters (e.g., eq(PostsColumn.userId, 1)
might translate to a filter on 'user_id' or 'posts.user_id' or 'author.id'
depending on context and prefix).
If relationshipPrefix
is set, it returns 'relationshipPrefix.dbName'
.
Otherwise, it returns dbName
.
Implementation
String fullyQualified(String? prefix) {
if (prefix == tableName) {
// If the prefix is the same as the table name, we don't need to add it.
return dbName;
} else if (prefix != null && prefix.isNotEmpty) {
// If a prefix is provided, use it to qualify the column name.
return '$tableName.$originalName';
}
return relationshipPrefix != null ? '$relationshipPrefix.$dbName' : dbName;
}