Description
Hi
If I have an alias for a table, that table aliased cannot be used in select when using @selection , because conflicting signatures
I drop an example
struct Example {
@Table
struct Wallet {
public let id: Int
public let name: String
}
@Table
struct Transfer {
let id: Int
let walletId: Int
}
enum WalletAlias: AliasName {
static let aliasName: String = "wallet_alias"
}
static let transfers = Transfer
.join(Wallet.as(WalletAlias.self).all, on: { transfersTable, sourceWallets in
transfersTable.walletId.eq(sourceWallets.id)
})
@Selection
public struct ExampleSelection1: Sendable {
public let record: Example.Transfer
public let sourceWallet: Example.Wallet
}
/// Initializer 'init(record:sourceWallet:)' requires the types 'TableAlias<Example.Wallet, Example.WalletAlias>.TableColumns.QueryValue' (aka 'TableAlias<Example.Wallet, Example.WalletAlias>') and 'Example.Wallet' be equivalent
static let query1 = transfers
.select { a, b in
return ExampleSelection1.Columns(record: a, sourceWallet: b)
}
@Selection
public struct ExampleSelection2: Sendable {
public let record: Example.Transfer
public let sourceWallet: Example.WalletAlias
}
/// Initializer 'init(record:sourceWallet:)' requires the types 'TableAlias<Example.Wallet, Example.WalletAlias>.TableColumns.QueryValue' (aka 'TableAlias<Example.Wallet, Example.WalletAlias>') and 'Example.WalletAlias' be equivalent
static let query2 = transfers
.select { a, b in
return ExampleSelection2.Columns(record: a, sourceWallet: b)
}
}
Only using this generic combination may result in a compilation, but it is a bit un-usable
@Selection
public struct ExampleSelection1: Sendable {
public let record: Example.Transfer
public let sourceWallet: StructuredQueries.TableAlias<Example.Wallet, Example.WalletAlias>
}
/// Initializer 'init(record:sourceWallet:)' requires the types 'TableAlias<Example.Wallet, Example.WalletAlias>.TableColumns.QueryValue' (aka 'TableAlias<Example.Wallet, Example.WalletAlias>') and 'Example.Wallet' be equivalent
static let query1 = transfers
.select { a, b in
return ExampleSelection1.Columns(record: a, sourceWallet: b)
}
Description
Hi
If I have an alias for a table, that table aliased cannot be used in select when using @selection , because conflicting signatures
I drop an example
Only using this generic combination may result in a compilation, but it is a bit un-usable