jet/postgres/lateral.go

25 lines
505 B
Go
Raw Normal View History

2020-10-16 13:26:53 +02:00
package postgres
import "github.com/go-jet/jet/v2/internal/jet"
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 {
2020-10-16 13:26:53 +02:00
subQuery := &selectTableImpl{
2021-05-03 19:31:04 +02:00
SelectTable: jet.NewLateral(l.selectStmt, alias),
2020-10-16 13:26:53 +02:00
}
subQuery.readableTableInterfaceImpl.parent = subQuery
return subQuery
}