某次如下使用gorm
的时候出现以下的错误:
DB.Model(&model.Captcha{
}).Find(data)
unsupported destination, should be slice or struct
其实之前我使用过一样的方式写过代码,当时请求的时候是正确的,不过这次就😢,一言难尽
后来在stackoverflow上面问了这个问题,在这里总结一下
使用结构体接收数据
如果直接使用var d
某次如下使用gorm
的时候出现以下的错误:
DB.Model(&model.Captcha{
}).Find(data)
unsupported destination, should be slice or struct
其实之前我使用过一样的方式写过代码,当时请求的时候是正确的,不过这次就😢,一言难尽
后来在stackoverflow上面问了这个问题,在这里总结一下
如果直接使用var d