英文: How can non-struct type extends struct functions 问题 更新:好的,我弄错了。CustomJSONType的函数不能访问它所嵌入的结构体的字段,...
错误:没有与ON CONFLICT规范匹配的唯一或排除约束
英文: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification 问题 我正在尝...
使用Gorm查询多列数据
英文: Querying for multiple columns with Gorm 问题 你的代码中出现了扫描错误,错误信息显示目标不是一个指针。这个错误是因为你传递给.Scan()方法的参数类型...
Gorm预加载多对多关系
英文: Gorm preload m2m relation 问题 我想使用gorm预加载M2M关系,但使用Preload函数时,它没有填充切片。 这是SQL模式 create table projec...
从GORM的Raw()查询中检索数据
英文: Retrieving data from GORM Raw() Query 问题 我正在尝试通过项目学习来学习Golang。我给自己提出了一个问题,模拟顾客将产品添加到购物车中。目前,我有一个...
How to cascade (soft) delete has many relationships in GORM?
英文: How to cascade (soft) delete has many relationships in GORM? 问题 我正在使用GORM实现一些删除功能。我的想法是级联删除,即当删除...
获取嵌套对象的方法是使用一个查询。
英文: Get nested object with one query 问题 我有以下模型: type Instance struct { gorm.Model Name string `gorm:...
Gorm自动迁移在PostgreSQL中创建一个没有用户定义属性的表。
英文: Gorm auto-migration creating a table with no user-defined attributes (postgresql) 问题 package mai...
如何使用Go和Docker等待PostgreSQL数据库?
英文: How to wait postgres db using go with docker? 问题 我使用docker-compose部署了一个使用gorm和postgres的Go应用程序。 我...
在Gorm中可以使用复合主键吗?为什么会出现SQLSTATE 42830错误?
英文: Can I use Composite Primary Keys this way in Gorm? Why SQLSTATE 42830 error? 问题 我需要使用复合主键创建这些表: ...
47