I cannot use `qm.Expr` for manual grouping of statements in `sqlboiler v4.12.0`

44 Views Asked by At

This is an example in section Query Mod System at github sqlboiler.

import . "github.com/volatiletech/sqlboiler/v4/queries/qm"

// In some function

// Expr allows manual grouping of statements
Where(
  Expr(
    models.PilotWhere.Name.EQ("John"),
    Or2(models.PilotWhere.Age.EQ(5)),
  ),
  Or2(models.PilotAge),
)

I try to implement it in my app

userGroupQuery := qm.Where(
    qm.Expr(
        orm.GroupWhere.ID.IN(input.IDs),
        qm.Or2(orm.GroupWhere.GroupName.EQ("users")),
    ),
    qm.And(orm.GroupWhere.DeletedAt.IsNull()),
)

but I got an error, this is the details Cannot use 'qm.Expr( orm.GroupWhere.ID.IN(input.IDs), qm.Or2(orm.GroupWhere.GroupName.EQ("users")), )' (type QueryMod) as the type string

I checked the qm package and I found the Where function usage:
Where(clause string, args ...interface{}) QueryMod

0

There are 0 best solutions below