当前位置:网站首页>Remember a pit for gorm initialization
Remember a pit for gorm initialization
2022-08-02 02:15:00 【Not the old king who lives next door】
When initializing gorm across files, if db is used in gorm.open after db *gorm.DB is declared in advance, and err:= gorm.open, an error will be reported later
The error code is:
panic: runtime error: invalid memory address or nil pointer dereference
change db,err:=gorm.open to
var err error
db,err=gorm.open
error resolved

The solution comes from blog:
http://t.csdn.cn/IxS0o
边栏推荐
- AOF重写
- 手写一个博客平台~第三天
- swift project, sqlcipher3 -> 4, cannot open legacy database is there a way to fix it
- C语言之插入字符简单练习
- 工程师如何对待开源
- Effects of Scraping and Aggregation
- MySQL optimization strategy
- Fly propeller power space future PIE - Engine Engine build earth science
- 2022-08-01 mysql/stoonedb slow SQL-Q18 analysis
- libcurl访问url保存为文件的简单示例
猜你喜欢

The Paddle Open Source Community Quarterly Report is here, everything you want to know is here

Pinduoduo leverages the consumer expo to promote the upgrading of domestic agricultural products brands and keep pace with international high-quality agricultural products

AOF重写

The failure to create a role in Dahua Westward Journey has been solved

MySQL8 下载、启动、配置、验证

检查IP或端口是否被封

nacos启动报错,已配置数据库,单机启动

手写一个博客平台~第三天

AI目标分割能力,无需绿幕即可实现快速视频抠图

哈希冲突和一致性哈希
随机推荐
Good News | AR opens a new model for the textile industry, and ALVA Systems wins another award!
typescript30 - any type
垃圾回收器CMS和G1
Force buckle, 752-open turntable lock
Personal blog system project test
Rasa 3 x learning series - Rasa - 4873 dispatcher Issues. Utter_message study notes
bool框架::PosInGrid (const简历:关键点kp, int &posX, int诗句)
考完PMP学什么?前方软考等着你~
【ORB_SLAM2】void Frame::AssignFeaturesToGrid()
密码学的基础:X.690和对应的BER CER DER编码
ALCCIKERS Shane 20191114
How to adjust the cross cursor too small, CAD dream drawing calculation skills
【 wheeled odometer 】
AOF重写
【LeetCode Daily Question】——704. Binary Search
项目后台技术Express
2022-08-01 反思
Hash collisions and consistent hashing
力扣(LeetCode)213. 打家劫舍 II(2022.08.01)
LeetCode Review Diary: 34. Find the first and last position of an element in a sorted array