I'm probably doing something simple wrong but I can't figure this out.
I have a 'users' table. Fetching data from the users table works fine, as long as the column names are all a single word (i.e. email). If I try to fetch data from a column that is two words separated by an underscore (i.e. is_admin) I get an error: ERROR #42703 column user.is_admin does not exist. To be clear this is not a problem only with the is_admin column, but with any multi-word column.
If I try to retrieve data from a different table with similar, multi-word columns, everything works as expected. The tables are all generated and altered only by Rails ORM, so are quite uniform.
code:
type Subscription struct {
Id int64
Name string
StripeId string
}
type User struct {
Id int64
Email string
IsAdmin bool
Uid string
Tokens string
}
var s []Subscription
err := db.Model(&s).Select()
if err != nil {
panic(err)
}
fmt.Println(s)
var u []User
err = db.Model(&u).Select()
if err != nil {
panic(err)
}
fmt.Println(u)
The subscription data prints fine, but I get a panic error on the user data.
I'm probably doing something simple wrong but I can't figure this out.
I have a 'users' table. Fetching data from the users table works fine, as long as the column names are all a single word (i.e.
email
). If I try to fetch data from a column that is two words separated by an underscore (i.e.is_admin
) I get an error:ERROR #42703 column user.is_admin does not exist
. To be clear this is not a problem only with theis_admin
column, but with any multi-word column.If I try to retrieve data from a different table with similar, multi-word columns, everything works as expected. The tables are all generated and altered only by Rails ORM, so are quite uniform.
code:
The subscription data prints fine, but I get a panic error on the user data.