mirror of
https://github.com/MontFerret/ferret.git
synced 2026-05-22 10:15:21 +02:00
Renamted non-safe methods
This commit is contained in:
@@ -91,7 +91,7 @@ func (c *FqlCompiler) Compile(query string) (program *runtime.Program, err error
|
|||||||
return program, err
|
return program, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FqlCompiler) CompileP(query string) *runtime.Program {
|
func (c *FqlCompiler) MustCompile(query string) *runtime.Program {
|
||||||
program, err := c.Compile(query)
|
program, err := c.Compile(query)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1606,7 +1606,7 @@ func TestForTernaryExpression(t *testing.T) {
|
|||||||
Convey("RETURN foo ? TRUE : (FOR i IN 1..5 RETURN i*2)", t, func() {
|
Convey("RETURN foo ? TRUE : (FOR i IN 1..5 RETURN i*2)", t, func() {
|
||||||
c := compiler.New()
|
c := compiler.New()
|
||||||
|
|
||||||
out1, err := c.CompileP(`
|
out1, err := c.MustCompile(`
|
||||||
LET foo = FALSE
|
LET foo = FALSE
|
||||||
RETURN foo ? TRUE : (FOR i IN 1..5 RETURN i*2)
|
RETURN foo ? TRUE : (FOR i IN 1..5 RETURN i*2)
|
||||||
`).Run(context.Background())
|
`).Run(context.Background())
|
||||||
@@ -1614,7 +1614,7 @@ func TestForTernaryExpression(t *testing.T) {
|
|||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
So(string(out1), ShouldEqual, `[2,4,6,8,10]`)
|
So(string(out1), ShouldEqual, `[2,4,6,8,10]`)
|
||||||
|
|
||||||
out2, err := c.CompileP(`
|
out2, err := c.MustCompile(`
|
||||||
LET foo = TRUE
|
LET foo = TRUE
|
||||||
RETURN foo ? TRUE : (FOR i IN 1..5 RETURN i*2)
|
RETURN foo ? TRUE : (FOR i IN 1..5 RETURN i*2)
|
||||||
`).Run(context.Background())
|
`).Run(context.Background())
|
||||||
@@ -1626,7 +1626,7 @@ func TestForTernaryExpression(t *testing.T) {
|
|||||||
Convey("RETURN foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)", t, func() {
|
Convey("RETURN foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)", t, func() {
|
||||||
c := compiler.New()
|
c := compiler.New()
|
||||||
|
|
||||||
out1, err := c.CompileP(`
|
out1, err := c.MustCompile(`
|
||||||
LET foo = FALSE
|
LET foo = FALSE
|
||||||
RETURN foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)
|
RETURN foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)
|
||||||
`).Run(context.Background())
|
`).Run(context.Background())
|
||||||
@@ -1634,7 +1634,7 @@ func TestForTernaryExpression(t *testing.T) {
|
|||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
So(string(out1), ShouldEqual, `[2,4,6,8,10]`)
|
So(string(out1), ShouldEqual, `[2,4,6,8,10]`)
|
||||||
|
|
||||||
out2, err := c.CompileP(`
|
out2, err := c.MustCompile(`
|
||||||
LET foo = TRUE
|
LET foo = TRUE
|
||||||
RETURN foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)
|
RETURN foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)
|
||||||
`).Run(context.Background())
|
`).Run(context.Background())
|
||||||
@@ -1646,7 +1646,7 @@ func TestForTernaryExpression(t *testing.T) {
|
|||||||
Convey("LET res = foo ? TRUE : (FOR i IN 1..5 RETURN i*2)", t, func() {
|
Convey("LET res = foo ? TRUE : (FOR i IN 1..5 RETURN i*2)", t, func() {
|
||||||
c := compiler.New()
|
c := compiler.New()
|
||||||
|
|
||||||
out1, err := c.CompileP(`
|
out1, err := c.MustCompile(`
|
||||||
LET foo = FALSE
|
LET foo = FALSE
|
||||||
LET res = foo ? TRUE : (FOR i IN 1..5 RETURN i*2)
|
LET res = foo ? TRUE : (FOR i IN 1..5 RETURN i*2)
|
||||||
RETURN res
|
RETURN res
|
||||||
@@ -1655,7 +1655,7 @@ func TestForTernaryExpression(t *testing.T) {
|
|||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
So(string(out1), ShouldEqual, `[2,4,6,8,10]`)
|
So(string(out1), ShouldEqual, `[2,4,6,8,10]`)
|
||||||
|
|
||||||
out2, err := c.CompileP(`
|
out2, err := c.MustCompile(`
|
||||||
LET foo = TRUE
|
LET foo = TRUE
|
||||||
LET res = foo ? TRUE : (FOR i IN 1..5 RETURN i*2)
|
LET res = foo ? TRUE : (FOR i IN 1..5 RETURN i*2)
|
||||||
RETURN res
|
RETURN res
|
||||||
@@ -1668,7 +1668,7 @@ func TestForTernaryExpression(t *testing.T) {
|
|||||||
Convey("LET res = foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)", t, func() {
|
Convey("LET res = foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)", t, func() {
|
||||||
c := compiler.New()
|
c := compiler.New()
|
||||||
|
|
||||||
out1, err := c.CompileP(`
|
out1, err := c.MustCompile(`
|
||||||
LET foo = FALSE
|
LET foo = FALSE
|
||||||
LET res = foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)
|
LET res = foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)
|
||||||
RETURN res
|
RETURN res
|
||||||
@@ -1677,7 +1677,7 @@ func TestForTernaryExpression(t *testing.T) {
|
|||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
So(string(out1), ShouldEqual, `[2,4,6,8,10]`)
|
So(string(out1), ShouldEqual, `[2,4,6,8,10]`)
|
||||||
|
|
||||||
out2, err := c.CompileP(`
|
out2, err := c.MustCompile(`
|
||||||
LET foo = TRUE
|
LET foo = TRUE
|
||||||
LET res = foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)
|
LET res = foo ? (FOR i IN 1..5 RETURN i) : (FOR i IN 1..5 RETURN i*2)
|
||||||
RETURN res
|
RETURN res
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func (p *Program) Run(ctx context.Context, setters ...Option) ([]byte, error) {
|
|||||||
return out.MarshalJSON()
|
return out.MarshalJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Program) RunP(ctx context.Context, setters ...Option) []byte {
|
func (p *Program) MustRun(ctx context.Context, setters ...Option) []byte {
|
||||||
out, err := p.Run(ctx, setters...)
|
out, err := p.Run(ctx, setters...)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user