bun
bun copied to clipboard
is []time.Time `bun:",array"` supported?
I'm trying to set this up using postgres and the query string generated has some issues with quotes that prevent it from running
type Model struct {
ID string `bun:",pk"`
List []time.Time `bun:",array"`
}
Later on when bun runs an Exec on an update query on Model the generated query string looks like this:
UPDATE "models" AS "model" SET "list" = '{'2022-10-31 23:21:49.673242+00:00'}' WHERE ("model"."id" = '466d0003-744b-42d2-beac-a63e9002bc97');
the issue being the single quotes: '{'2022
changing the quotes to double makes the SQL valid
'{"2022-10-31 23:21:49.673242+00:00"}'
Seems like a general problem, since pgdialect also has its problems with e.g. UUID arrays passed into queries. Is there any news on this one being tackled?
//EDIT: Seems like both issues could be traced back to 122 in appender (pgdialect). Since []time.Time has its own appender, which handles this correctly, I wonder why it doesn't? Nevertheless, my UUID problem has to be tackled separately.