V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  2024  ›  全部回复第 2 页 / 共 2 页
回复总数  22
1  2  
@johnlin 每次都重新写太麻烦了, 获取 id 列表,或者 id map 基本是经常用到的,直接生成放着完事。
看我生成的例子
https://github.com/go-home-admin/go-admin/blob/main/app/entity/demo/user.go
可以用这个工具生成 orm , https://github.com/go-home-admin/toolset
直接生成对应函数
type UsersList []*Users

func (l UsersList) GetIdList() []int64 {}
func (l UsersList) GetIdMap() map[int64]*Users {}
1  2  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2141 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 9ms · UTC 06:32 · PVG 14:32 · LAX 23:32 · JFK 02:32
Developed with CodeLauncher
♥ Do have faith in what you're doing.