GetLibraryByID 根据ID获取知识库
(eid int64, id int64)
| 138 | |
| 139 | // GetLibraryByID 根据ID获取知识库 |
| 140 | func GetLibraryByID(eid int64, id int64) (*Library, error) { |
| 141 | libraries, err := GetLibrariesByEidCached(eid) |
| 142 | if err != nil { |
| 143 | return nil, err |
| 144 | } |
| 145 | for i := range libraries { |
| 146 | if libraries[i].ID == id { |
| 147 | library := libraries[i] |
| 148 | return &library, nil |
| 149 | } |
| 150 | } |
| 151 | return nil, gorm.ErrRecordNotFound |
| 152 | } |
| 153 | |
| 154 | // GetLibrariesByIDs 根据ID列表批量获取知识库 |
| 155 | func GetLibrariesByIDs(eid int64, ids []int64) ([]Library, error) { |
no test coverage detected