db icon indicating copy to clipboard operation
db copied to clipboard

Trouble using splats when intersecting Cond's

Open mcandre opened this issue 6 years ago • 0 comments

Hi, I want to db.And() a dynamic array of db.Cond's. The documentation appears to support this:

Cond is a map that defines conditions for a query and satisfies the Constraints and Compound interfaces.

https://godoc.org/upper.io/db.v3#And

However, when I try to do db.And(constraints...), then I actually get a compilation error complaining:

cannot use constraints (type []db.Cond) as type []db.Compound in argument to db.And

As a workaround, I am collecting my individual db.Cond's into an array of db.Compound, then the compiler passes.

mcandre avatar Apr 22 '19 15:04 mcandre