当前位置:网站首页>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
边栏推荐
- AI target segmentation capability for fast video cutout without green screen
- Multi-Party Threshold Private Set Intersection with Sublinear Communication-2021:解读
- LeetCode刷题日记:LCP 03.机器人大冒险
- Speed up your programs with bitwise operations
- Redis Persistence - RDB and AOF
- 哈希冲突和一致性哈希
- 密码学的基础:X.690和对应的BER CER DER编码
- MySQL优化策略
- 『网易实习』周记(二)
- AWR analysis report questions for help: How can SQL be optimized from what aspects?
猜你喜欢
"NetEase Internship" Weekly Diary (3)
Project Background Technology Express
2022河南青训联赛第(三)场
Hiring a WordPress Developer: 4 Practical Ways
Constructor instance method of typescript36-class
volatile原理解析
HSDC is related to Independent Spanning Tree
手写一个博客平台~第三天
工程师如何对待开源
The Paddle Open Source Community Quarterly Report is here, everything you want to know is here
随机推荐
LeetCode Brushing Diary: 74. Searching 2D Matrix
搜罗汇总的效应
leetcode / anagram in string - some permutation of s1 string is a substring of s2
【LeetCode每日一题】——654.最大二叉树
记一次gorm事务及调试解决mysql死锁
The underlying data structure of Redis
C language inserted into the characters of simple exercises
libcurl访问url保存为文件的简单示例
The Paddle Open Source Community Quarterly Report is here, everything you want to know is here
Service discovery of kubernetes
Force buckle, 752-open turntable lock
"NetEase Internship" Weekly Diary (2)
[ORB_SLAM2] void Frame::ComputeImageBounds(const cv::Mat & imLeft)
MySQL8 download, start, configure, verify
Effects of Scraping and Aggregation
手写一个博客平台~第一天
Ask God to answer, how should this kind of sql be written?
60 Feature Engineering Operations: Using Custom Aggregate Functions【Favorites】
The failure to create a role in Dahua Westward Journey has been solved
拼多多借力消博会推动国内农产品品牌升级 看齐国际精品农货