2021-05-03 19:31:04 +02:00
|
|
|
package mysql
|
|
|
|
|
|
2026-05-14 17:04:09 +00:00
|
|
|
import "source.gleipnir.technology/Gleipnir/jet/v2/internal/jet"
|
2021-05-03 19:31:04 +02:00
|
|
|
|
2021-05-16 19:10:43 +02:00
|
|
|
// LATERAL derived tables constructor from select statement
|
2021-05-03 19:31:04 +02:00
|
|
|
func LATERAL(selectStmt SelectStatement) lateralImpl {
|
|
|
|
|
return lateralImpl{
|
|
|
|
|
selectStmt: selectStmt,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type lateralImpl struct {
|
|
|
|
|
selectStmt SelectStatement
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (l lateralImpl) AS(alias string) SelectTable {
|
|
|
|
|
subQuery := &selectTableImpl{
|
|
|
|
|
SelectTable: jet.NewLateral(l.selectStmt, alias),
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-09 19:06:17 +01:00
|
|
|
subQuery.readableTableInterfaceImpl.root = subQuery
|
2021-05-03 19:31:04 +02:00
|
|
|
|
|
|
|
|
return subQuery
|
|
|
|
|
}
|