-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 和Select方法不同的是,Scan方法仅仅影响输出,类似GoRedis的Scan的思想,依然需要指定table,只是最后的Get或者Find方法换成本方法即可 - 传入struct{}可以解析单条,类似Find方法 - 传入[]struct{}将会解析成多条,类似Get方法 注意需要传入指针值,例如传入:&User{},而不是:User{} 避免(不是禁止的意思)使用这个方法传入Map[string]interface{} 如果你全程使用struct方法,建议你可以直接使用table().select()这样原版框架支持的模式来操作数据库,因为从代码思想和洁净度角度来看,保持业务代码风格统一也是很重要的
- Loading branch information
Showing
2 changed files
with
26 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters