Add LATERAL query support

This commit is contained in:
go-jet 2021-05-03 19:31:04 +02:00
parent 4ef0113f6b
commit 0f773b26d6
6 changed files with 224 additions and 12 deletions

23
mysql/lateral.go Normal file
View file

@ -0,0 +1,23 @@
package mysql
import "github.com/go-jet/jet/v2/internal/jet"
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),
}
subQuery.readableTableInterfaceImpl.parent = subQuery
return subQuery
}