Skip to content

Commit

Permalink
add new query operator, NOOP
Browse files Browse the repository at this point in the history
  • Loading branch information
demonsh committed May 26, 2022
1 parent d678513 commit ad47119
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 8 additions & 6 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (

// List of available operators.
const (
EQ int = iota
NOOP int = iota // No operation, skip query verification in circuit
EQ
LT
GT
IN
Expand All @@ -24,11 +25,12 @@ type Query struct {

// QueryOperators represents operators for atomic circuits
var QueryOperators = map[string]int{
"$eq": EQ,
"$lt": LT,
"$gt": GT,
"$in": IN,
"$nin": NIN,
"$noop": NOOP,
"$eq": EQ,
"$lt": LT,
"$gt": GT,
"$in": IN,
"$nin": NIN,
}

// Comparer value.
Expand Down
8 changes: 4 additions & 4 deletions query_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package circuits

import (
"math/big"
"testing"
"math/big"
"testing"

"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
)

func TestScalarCompare(t *testing.T) {
Expand Down Expand Up @@ -64,7 +64,7 @@ func TestScalarCompare(t *testing.T) {
name: "testing unknown operator",
x: big.NewInt(0),
y: big.NewInt(1),
operator: 4, // unknown operator.
operator: 6, // unknown operator.
expected: false,
withErr: true,
},
Expand Down

0 comments on commit ad47119

Please sign in to comment.