Skip to content

Named argument in Where() clause #7657

@raphaelyancey

Description

@raphaelyancey

Your Question

I'd like to be able to use this query

db.Where(`jobs.playbook_backup @? '$.nodes.* ? (@.name=="@actionName") ? (@.type=="action")'`, sql.Named("actionName", pj.NodesActionName))

But between the ? needing to be escaped, and the named argument not working, I don't really know what are my options without defacing the query with endless gorm.Expr() while keeping it secure with a prepared statement (and not injecting the value directly).

Is it possible to disable the ? placeholder completely for a given clause maybe?

The document you expected this should be explained

https://gorm.io/docs/advanced_query.html#Named-Argument

Expected answer

How to make this query work.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions