Lateral - initial commit.

This commit is contained in:
go-jet 2020-10-16 13:26:53 +02:00
parent 1146afe343
commit 0cba1f6401
4 changed files with 73 additions and 2 deletions

13
postgres/lateral.go Normal file
View file

@ -0,0 +1,13 @@
package postgres
import "github.com/go-jet/jet/v2/internal/jet"
func LATERAL(selectStmt SelectStatement, alias string) SelectTable {
subQuery := &selectTableImpl{
SelectTable: jet.NewLateral(selectStmt, alias),
}
subQuery.readableTableInterfaceImpl.parent = subQuery
return subQuery
}

9
postgres/lateral_test.go Normal file
View file

@ -0,0 +1,9 @@
package postgres
import "testing"
func TestLATERAL(t *testing.T) {
assertSerialize(t, LATERAL(SELECT(Int(1)), "lat1"), `LATERAL (
SELECT $1
) AS lat1`)
}