Exemplo n.º 1
0
func (suite *QueryLanguageTestSuite) TestQueryLanguage_SelectWithFilter() {
	expectedCount := suite.expectedLength(func(inv OverriddenInvoice) bool {
		return inv.Memo == "another_test_memo" || inv.Updated == 3
	})

	invTest, err := Query(suite.Map, suite.Map, suite.Ref).
		Where().
		Filter(filters.Or(filters.Equal(&suite.Ref.Memo, "another_test_memo"), filters.Equal(&suite.Ref.Updated, 3))).
		Select()
	if suite.NoError(err) {
		suite.Equal(expectedCount, len(invTest))
	}
}
Exemplo n.º 2
0
// Equal adds a column = value comparison to the where clause.
func (plan *QueryPlan) Equal(fieldPtr interface{}, value interface{}) interfaces.WhereQuery {
	return plan.Filter(filters.Equal(fieldPtr, value))
}