我们如何使用gorm在text []列中插入数据?

时间:2019-06-05 01:43:14

标签: postgresql go go-gorm glide-golang

我们如何使用gorm将数据插入到text []列中。我试过但没有解决办法。我的gorm查询生成为

INSERT INTO "details" ("username","nickname","email","mobile","location","status","roleids","subid","camids","skl","ser","ts","brids","lan","createdat","createdby","modifiedby","modified") 
VALUES ('sample','test','',0,'','','[2 4]',0,'[2 4]',0,0,'[tr1 tr2]','[b1 b2]','','2019-06-05 10:47:50',0,0,'0001-01-01 00:00:00') 
RETURNING "details"."userid" 

我希望查询如下:

INSERT INTO "details" ("username","nickname","email","mobile","location","status","roleids","subid","camids","skl","ser","ts","brids","lan","createdat","createdby","modifiedby","modified") 
VALUES ('sample','test','',0,'','',array[2, 4]',0,array[3, 4],0,0,array['tr1' 'tr2'],array['b1', 'b2'],'','2019-06-05 10:47:50',0,0,'0001-01-01 00:00:00') 
RETURNING "details"."userid" 

这将在postgresql数据库中执行。

0 个答案:

没有答案