feat(server): dao 增加 GetByNamePrefix(封面公开路由定位用)
This commit is contained in:
@@ -108,6 +108,19 @@ func (d *datasetDao) GetByName(ctx context.Context, name string) (*entity.Datase
|
||||
return &e, nil
|
||||
}
|
||||
|
||||
// GetByNamePrefix 按训练文件名前缀查询(模型发布命名,前缀唯一),不存在返回 nil
|
||||
func (d *datasetDao) GetByNamePrefix(ctx context.Context, prefix string) (*entity.Dataset, error) {
|
||||
var e entity.Dataset
|
||||
err := g.DB().Model(consts.TableDataset).Ctx(ctx).Where("name_prefix", prefix).Scan(&e)
|
||||
if err != nil {
|
||||
if common.IsNoRows(err) {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return &e, nil
|
||||
}
|
||||
|
||||
// UpdateCounters 更新图片数/已标注数/状态(imgDelta 增量;labeledCount ≥0 时覆盖写)
|
||||
func (d *datasetDao) UpdateCounters(ctx context.Context, id int64, imgDelta, labeledCount int64, status string) error {
|
||||
data := g.Map{"updated_at": gtime.Now()}
|
||||
|
||||
Reference in New Issue
Block a user