infobloxopen / seal

Apache License 2.0
16 stars 11 forks source link

Add exported sqlcompiler.CompileCondition() fn #131

Closed rchowinfoblox closed 3 years ago

rchowinfoblox commented 3 years ago

Add new sqlcompiler.CompileCondition() to support converting of obligations into SQL. Both make test and make demo pass successfully.

Output of new unit-tests:

$ go test -v
=== RUN   TestCompileCondition
    sql_condition_test.go:74: Test#0: success: expected error and got err=no prefix condition parse function for IDENT found
    sql_condition_test.go:76: Test#1: success: where=(foobar.qwerty = 'there''s a single-quote in this string')
    sql_condition_test.go:76: Test#2: success: where=(mysqltable.nbf < 123 AND (mysqltable.description = 'string with subject. in it'))
    sql_condition_test.go:76: Test#3: success: where=((NOT (mysqltable.iss = 'string with ctx. in it')) AND (mysqltable.name ~ '.*goofy.*'))
    sql_condition_test.go:74: Test#4: success: expected error and got err=map/array indexing not supported yet: ctx.tags["endangered"]
    sql_condition_test.go:74: Test#5: success: expected error and got err=IN operator not supported yet: (ctx.id in "tag-manage")
--- PASS: TestCompileCondition (0.00s)
PASS
ok      github.com/infobloxopen/seal/pkg/compiler/sql   0.003s