Nerdicon
Nerdicon

Reputation: 33

golang-gorm .where with like

i couldn't find any thing like this but it is exactly like (not in golang ) this

DB.Where(like(client))

should i make a function that return the sql query

edit : i meant using a struct not a string query

Upvotes: 1

Views: 1802

Answers (1)

Kin Pong chan
Kin Pong chan

Reputation: 179

From the GORM docs e.g.

db.Where("name LIKE ?", "%jin%")

https://gorm.io/docs/query.html#Conditions

Upvotes: 5

Related Questions