英文: Omitempty field is not working, how to remove empty structs from the response body? 问题 以下是翻译好的内容...
在gorm中如何添加枚举类型?
英文: How can i add enum in gorm? 问题 我正在编写 PostgreSQL 表模式。 type TestTable struct { ID int `gorm:"c...
Go sqlmock 测试 MySQL 批量插入
英文: Go sqlmock test MySQL batch insert 问题 我正在使用GORM将多行数据批量插入到MySQL表中,并且我想使用sqlmock来测试其行为是否正确。关于使用sql...
using Preload and Join in gorm
英文: using Preload and Join in gorm 问题 让我们假设我有以下三个结构体: type Question struct { gorm.Model Id *uint64 `...
Difference in string and *string in Gorm model declaration
英文: Difference in string and *string in Gorm model declaration 问题 gorm的文档https://gorm.io/docs/models...
根据外键关系获取基于 GORM 模型的行(使用 Golang)
英文: Get GORM model row based on foreign key relationship (golang) 问题 我正在使用Golang(GORM)+ Postgres。我正在...
Go Unit test – could not match actual sql with expected regexp while mocking gorm using go-sqlmock?
英文: Go Unit test - could not match actual sql with expected regexp while mocking gorm using go-sqlmo...
如何将多个更新 GORM MySql 查询合并为一个查询?
英文: How to combine multiple update GORM MySql queries into 1? 问题 我有一个包含4列(A(主键,整数)、B(字符串)、C(字符串)、D(字...
如何为单元测试模拟数据库
英文: How to mock DB for unit tests 问题 我有一个类似这样的UserRepo: type users struct { *gorm.DB } func NewMySql...
将接口设置为具有多个实现的属性,使用GORM。
英文: Setting Interface as an attribute having many implementations using GORM 问题 我有一个存储JSON的Postgres数...
47