iver-wharf / wharf-api

Wharf backend written in Go
MIT License
1 stars 0 forks source link

Fixed SafeSQLName not getting read correctly #186

Closed applejag closed 2 years ago

applejag commented 2 years ago

Summary

Motivation

In GORM:

db.Where("name IN ?", []any{"a", "b", "c"})

Is a shortcut for:

db.Where(db.Raw("name IN ?", []any{"a", "b", "c"}))

But that only works if the first argument is a string.

It was not a string, it was a SafeSQLName, which was based on a string, but that didn't GORM understand.

Now SafeSQLName is a type alias instead of it's own type, so reflection doesn't see them as different types.