Skip to content

How to use squirrel.Not to support "Nor", I encountered an unrecognized error here #386

Open

Description

@wenbo1989

I encountered an unrecognized error, my squirrel version is v1.5.4 , seems that there is no "Not" method in "expr.go" file.

I have a Mongo query statement such as below
and I hope to convert it into MySQL.

 {
    "$nor": [
        { "age":20 },
        { "owner1": "a"}
      ]
}

so I write as below

builder := squirrel.Select("*").From("table_name")
ageCondition := squirrel.Eq{"age": 20}
owner1Condition := squirrel.Eq{"owner1": "a"}

andCondition := squirrel.And{
    ageCondition,
    owner1Condition
}
 builder = builder.Where(squirrel.Not(andCondition))  

// I encountered an unrecognized error here,and my squirrel version is v1.5.4 , seems that there is no "Not" method in "expr.go" file.
query, args, err := builder.ToSql()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions