新增 TakeBusinessFields、WriteBusinessFields、SetByPath 与 GetByPath 等工具,支持按映射路径写入请求体与解析响应,并更新相关依赖。
30 lines
659 B
Go
30 lines
659 B
Go
package dao
|
|
|
|
import (
|
|
"context"
|
|
"model-gateway/consts/public"
|
|
"model-gateway/model/dto"
|
|
"model-gateway/model/entity"
|
|
|
|
"gitea.redpowerfuture.com/red-future/common/db/gfdb"
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
)
|
|
|
|
var ModelTaskEnd = &modelTaskEndDao{}
|
|
|
|
type modelTaskEndDao struct{}
|
|
|
|
// Insert 插入
|
|
func (d *modelTaskEndDao) Insert(ctx context.Context, req *dto.CreateModelTaskEndReq) (id int64, err error) {
|
|
m := new(entity.ModelTaskEnd)
|
|
err = gconv.Struct(req, &m)
|
|
if err != nil {
|
|
return
|
|
}
|
|
r, err := gfdb.DB(ctx, public.DbNameModelGateway).Model(ctx, public.TableNameModelTaskEnd).Insert(m)
|
|
if err != nil {
|
|
return
|
|
}
|
|
return r.LastInsertId()
|
|
}
|