Shellbye.github.io icon indicating copy to clipboard operation
Shellbye.github.io copied to clipboard

`gorm` 源码阅读笔记

Open Shellbye opened this issue 1 year ago • 0 comments

Open 方法中,进来就是一个不知为啥进行的一个排序:

sort.Slice(opts, func(i, j int) bool {
	_, isConfig := opts[i].(*Config)
	_, isConfig2 := opts[j].(*Config)
	return isConfig && !isConfig2
})

结合上下文想了想,这里其实是把用户传入的 gorm.Option 进行了排序,并把 gorm.Config 类型的配置放到了前面。

Shellbye avatar Mar 07 '24 03:03 Shellbye