Skip to content

Commit

Permalink
patched velty expression parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
adranwit committed Feb 2, 2024
1 parent 31d62ef commit 6b8b1c6
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 54 deletions.
4 changes: 2 additions & 2 deletions cmd/options/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ func (m mapper) Map(name string) string {
return name
}

func (r *Rule) NormalizeSQL(SQL string, handleVeltyExpression func() sqlparser.Option) string {
func (r *Rule) NormalizeSQL(SQL string, option func() sqlparser.Option) string {
if !r.Generated {
return SQL
}
sqlQuery, err := sqlparser.ParseQuery(SQL, handleVeltyExpression())
sqlQuery, err := sqlparser.ParseQuery(SQL, option())
if err != nil {
return SQL
}
Expand Down
13 changes: 4 additions & 9 deletions e2e/debug_gen/datly.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func main() {

baseDir := filepath.Join(toolbox.CallerDirectory(3), "..")
fmt.Printf("base: %v\n", baseDir)
caseName := "032_generate_patch_basic_many"
caseName := "009_apikey"
caseFolder := filepath.Join(baseDir, "local/regression/cases/", caseName)
gen, err := loadGen(caseFolder, caseName)
if err != nil {
Expand All @@ -73,8 +73,8 @@ func main() {
os.Args = []string{"",
"-N=" + gen.Name,
"-X=" + gen.URL,
"-C='dev|mysql|root:dev@tcp(127.0.0.1:3306)/dev?parseTime=true'",
"-C='dyndb|dynamodb|dynamodb://localhost:8000/us-west-1?key=dummy&secret=dummy'",
"-C=dev|mysql|root:dev@tcp(127.0.0.1:3306)/dev?parseTime=true",
"-C=dyndb|dynamodb|dynamodb://localhost:8000/us-west-1?key=dummy&secret=dummy",
fmt.Sprintf("-j='%v/local/jwt/public.enc|blowfish://default'", baseDir),
"-w=autogen",
}
Expand All @@ -89,16 +89,11 @@ func main() {
}()
os.Chdir(path.Join(baseDir, "local"))

server, err := cmd.New(Version, os.Args[1:], &ConsoleWriter{})
err = cmd.New(Version, os.Args[1:], &ConsoleWriter{})
if err != nil {
log.Fatal(err)
}

if server != nil {
if err := server.ListenAndServe(); err != nil {
log.Fatal(err.Error())
}
}
}

func loadGen(baseURL string, name string) (*Gen, error) {
Expand Down
3 changes: 1 addition & 2 deletions e2e/local/regression/cases/001_one_to_many/vendor_list.dql
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@


SELECT vendor.*,
products.* EXCEPT VENDOR_ID,
match_strategy(products, 'read_all')
products.* EXCEPT VENDOR_ID
FROM (SELECT * FROM VENDOR t ) vendor
JOIN (SELECT * FROM PRODUCT t) products ON products.VENDOR_ID = vendor.ID

Expand Down
2 changes: 1 addition & 1 deletion e2e/local/regression/regression.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pipeline:
'[]gen': '@gen'

subPath: 'cases/${index}_*'
range: 18..018
range: 1..068
template:
checkSkip:
action: nop
Expand Down
1 change: 0 additions & 1 deletion gateway/router/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ func (r *Handler) handleWithComponent(ctx context.Context, request *http.Request

//TODO merge with Path settings
unmarshal := aComponent.UnmarshalFunc(request)

locatorOptions := append(aComponent.LocatorOptions(request, state.NewForm(), unmarshal))
aSession := session.New(aComponent.View, session.WithLocatorOptions(locatorOptions...))
err := aSession.InitKinds(state.KindComponent, state.KindHeader, state.KindRequestBody, state.KindForm, state.KindQuery)
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/viant/dyndb v0.1.4-0.20221214043424-27654ab6ed9c
github.com/viant/gmetric v0.3.1-0.20230405233616-cc90deee60c4
github.com/viant/godiff v0.4.1
github.com/viant/parsly v0.3.2
github.com/viant/parsly v0.3.3-0.20240201231835-eceb98bf4c32
github.com/viant/pgo v0.11.0
github.com/viant/scy v0.6.0
github.com/viant/sqlx v0.12.1-0.20240201190210-9e2be3fa4de3
Expand All @@ -37,15 +37,15 @@ require (
github.com/viant/xreflect v0.6.2-0.20240129222322-972307391f16
github.com/viant/xunsafe v0.9.2
golang.org/x/mod v0.14.0
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
google.golang.org/api v0.126.0 // indirect
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/viant/govalidator v0.2.2-0.20230629211659-f2a3f0659b0b
github.com/viant/sqlparser v0.5.3-0.20240129191008-1fd7a2507ac5
golang.org/x/crypto v0.14.0 // indirect
github.com/viant/sqlparser v0.5.3-0.20240202161521-a96ec25a3113
golang.org/x/crypto v0.18.0 // indirect
)

require (
Expand Down Expand Up @@ -116,11 +116,11 @@ require (
github.com/xuri/nfp v0.0.0-20230819163627-dc951e3ffe1a // indirect
github.com/yuin/gopher-lua v0.0.0-20221210110428-332342483e3f // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/net v0.16.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect
Expand Down
26 changes: 16 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1073,14 +1073,14 @@ github.com/viant/govalidator v0.2.2-0.20230629211659-f2a3f0659b0b h1:IxRf961iRIo
github.com/viant/govalidator v0.2.2-0.20230629211659-f2a3f0659b0b/go.mod h1:D35Dwx0R8rR1knRxhlseoYvOkiqo24kpMg1/o977i9Y=
github.com/viant/igo v0.1.0 h1:AdBNAP4hckhNmnnDJgdbinpKgzZJFpl0uT0To3lLksI=
github.com/viant/igo v0.1.0/go.mod h1:2IhjHP1uijFPY8QqnV4DJx7+9YurIPyJ6Fd/BZvB5hw=
github.com/viant/parsly v0.3.2 h1:5w6qxrk0CsjiD/kZ32l/vQQWXlEIjZd+7rPVi3Fs9Vw=
github.com/viant/parsly v0.3.2/go.mod h1:4PKQzioRT9R99ceIhZ6tCD3tp0H0n2dEoIOaLulVvrg=
github.com/viant/parsly v0.3.3-0.20240201231835-eceb98bf4c32 h1:hbZ3T9WwtKWMsxiiz9sfNbM8jB4K34qvlUpIsnn6Uus=
github.com/viant/parsly v0.3.3-0.20240201231835-eceb98bf4c32/go.mod h1:85fneXJbErKMGhSQto3A5ElTQCwl3t74U9cSV0waBHw=
github.com/viant/pgo v0.11.0 h1:PNuYVhwTfyrAHGBO6lxaMFuHP4NkjKV8ULecz3OWk8c=
github.com/viant/pgo v0.11.0/go.mod h1:MFzHmkRFZlciugEgUvpl/3grK789PBSH4dUVSLOSo+Q=
github.com/viant/scy v0.6.0 h1:QQgq2jKaarDKfJgt9Q2bJlg0Jon/jjL1FfIRyDFzb7E=
github.com/viant/scy v0.6.0/go.mod h1:8DdAWhNVjY6OGOT9+2O7FEAPGDRqy2e+fG6cwIY6jNo=
github.com/viant/sqlparser v0.5.3-0.20240129191008-1fd7a2507ac5 h1:XTGrLPdr0CUQjD/SmsrLfpoFC7XpIKKcitz0jJjH2lk=
github.com/viant/sqlparser v0.5.3-0.20240129191008-1fd7a2507ac5/go.mod h1:cfJpZuqzt9iWoIbEWBYsnpzEzJ8T8xatW4qSbeiMEzg=
github.com/viant/sqlparser v0.5.3-0.20240202161521-a96ec25a3113 h1:Zs4d5LG6nRpooq8MC2Uc9Fu0w8eqAJi58WNtdWeZU4I=
github.com/viant/sqlparser v0.5.3-0.20240202161521-a96ec25a3113/go.mod h1:Ag/U7jzSnPRcQLl7a0dnn+3Fycod9rSQV9F+SjLuy7Q=
github.com/viant/sqlx v0.12.1-0.20240201190210-9e2be3fa4de3 h1:FfVj0ZSNH+aj9FX6HcYbCcOY6ICO3Ez+FpsvSjX/aYM=
github.com/viant/sqlx v0.12.1-0.20240201190210-9e2be3fa4de3/go.mod h1:HYtPW5x+z1zVgdZyDrpITI8uhXI53MrrOe6SgOP0SdA=
github.com/viant/structology v0.5.6-0.20231127181208-736f8ad06193 h1:wKs4BXSTV0VAubYVO4giNJIwRCE4OS1Ctk2y9MeKax4=
Expand Down Expand Up @@ -1164,8 +1164,9 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -1295,8 +1296,9 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos=
golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -1329,8 +1331,9 @@ golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I
golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw=
golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4=
golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE=
golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY=
golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0=
golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ=
golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o=
golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -1439,8 +1442,9 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand All @@ -1453,8 +1457,9 @@ golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -1472,8 +1477,9 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
2 changes: 1 addition & 1 deletion internal/inference/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (t *Table) lookup(ns, column string) *sqlparser.Column {
func (t *Table) detect(ctx context.Context, db *sql.DB, SQL string) error {
SQL = TrimParenthesis(SQL)
query, err := sqlparser.ParseQuery(SQL)
if err != nil {
if err != nil && query.From.X == nil { //TODO add velty expr handler
return fmt.Errorf("unable to parseSQL to detect table: %w", err)
}
query, err = column.RewriteWithQueryIfNeeded(SQL, query)
Expand Down
23 changes: 23 additions & 0 deletions internal/translator/parser/velty.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package parser

import (
"github.com/viant/parsly"
"github.com/viant/sqlparser"
"github.com/viant/sqlparser/query"
)

func OnVeltyExpression() sqlparser.Option {
return sqlparser.WithErrorHandler(func(err error, cur *parsly.Cursor, destNode interface{}) error {
fromNode, ok := destNode.(*query.From)
if !ok {
return err
}
match := cur.MatchOne(IfBlockMatcher)
if match.Code == IfBlockToken {
fromNode.Unparsed = match.Text(cur)
return nil
}

return err
})
}
22 changes: 2 additions & 20 deletions internal/translator/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import (
"github.com/viant/datly/view/discover"
"github.com/viant/datly/view/extension"
"github.com/viant/datly/view/state"
"github.com/viant/parsly"
"github.com/viant/sqlparser"
"github.com/viant/sqlparser/query"
"github.com/viant/xreflect"
"golang.org/x/mod/modfile"
"gopkg.in/yaml.v3"
Expand Down Expand Up @@ -86,7 +84,7 @@ func (s *Service) Translate(ctx context.Context, rule *options.Rule, dSQL string
if err = s.updateComponentType(ctx, resource, resource.OutputState.FilterByKind(state.KindComponent)); err != nil {
return err
}
dSQL = rule.NormalizeSQL(dSQL, handleVeltyExpression)
dSQL = rule.NormalizeSQL(dSQL, parser.OnVeltyExpression)
if resource.IsExec() || resource.Rule.Handler != nil {
if err := s.translateExecutorDSQL(ctx, resource, dSQL); err != nil {
return err
Expand Down Expand Up @@ -174,7 +172,7 @@ func (s *Service) buildExecutorView(ctx context.Context, resource *Resource, DSQ
}

func (s *Service) translateReaderDSQL(ctx context.Context, resource *Resource, dSQL string) error {
aQuery, err := sqlparser.ParseQuery(dSQL, handleVeltyExpression())
aQuery, err := sqlparser.ParseQuery(dSQL, parser.OnVeltyExpression())
if err != nil {
return err
}
Expand Down Expand Up @@ -279,22 +277,6 @@ func (s *Service) persistViewMetaColumn(cache discover.Columns, resource *Resour
return nil
}

func handleVeltyExpression() sqlparser.Option {
return sqlparser.WithErrorHandler(func(err error, cur *parsly.Cursor, destNode interface{}) error {
fromNode, ok := destNode.(*query.From)
if !ok {
return err
}
match := cur.MatchOne(parser.IfBlockMatcher)
if match.Code == parser.IfBlockToken {
fromNode.Unparsed = match.Text(cur)
return nil
}

return err
})
}

func (s *Service) persistRouterRule(ctx context.Context, resource *Resource, serviceType service.Type) error {
baseRuleURL := s.Repository.RuleBaseURL(resource.rule)

Expand Down

0 comments on commit 6b8b1c6

Please sign in to comment.