Conversation
|
Why are there 2 pull requests? |
|
I could make them one request if you like, i wasn't sure if both would be accepted |
|
Was just confused because it looked like both PRs had the same changes, but yes, having it in one would make reviewing simpler. |
|
You're completely right - I had messed up the PR and included commits in both. i've closed out the other PR, as this one has everything I've done. Thanks! |
|
Is your use case aliasing aggregate functions as well? The normal API usage would be something like this: let name = Expression<String?>("name")
let age = Expression<Int>("age")
let maxAge = age.max
for row in db.prepare(users.select(maxAge).group(name)) {
print(row[maxAge])
}And you'd like to write let maxAge = age.max.alias("maxAge")
for row in db.prepare(users.select(maxAge).group(name)) {
print(row[maxAge])
}? |
|
I'm sending query results to a Specifically, the aggregate is happening inside a With the existing API, the column name for that aggregate method is |
|
The problem is that the string alias loses type safety, so it's not possible to do this: let maxAge = age.max.alias("maxAge")
for row in db.prepare(users.select(maxAge).group(name)) {
print(row[maxAge])
} |
|
ah interesting. i'm using it to define a view and i alias to an existing column name, and then use that column object to fetch, so something like: I'll have time this weekend to look deeper into this and see what to do about the type safety side of it. |
|
let myView = view.create(mumbleTable.select(colClock.max.alias("existingColumn"), colStuff).group(colStuff)) hi @adamwulf if you delete mumbleTable then create a new table renamed mumbleTable the view myView is work ok? |
|
let aliasName = columnName, did a trick, finally I found that I do not need alias |
Allows
Rowobjects to be created publicly. This makes it easy to convert statements prepared from raw SQL and run with Connection.run() into the same shape as Connection.prepare(anyTableObject)