bun
bun copied to clipboard
how to set jsonb type default value with content
Version: 1.1.7
I want to set a jsonb default, like:
{ title: 'title', token: 'token' }
when I define a model:
Field map[string]interface{} `bun:"field,nullzero,notnull,type:jsonb,default:'{ \"title\": \"title\", \"token\": \"token\"}'" json:"field"`
but show me a warn:
WARN: bun: 2022/07/31 23:46:02 Model.Field has unknown tag option: "title"
WARN: bun: 2022/07/31 23:46:02 Model.Field has unknown tag option: "token"
Looks like https://github.com/uptrace/bun/tree/master/internal/tagparser should be improved to support more complex values.
I'll pick it up. also faced this problem