1 回答
TA贡献1776条经验 获得超12个赞
我认为你需要这样的东西,没有测试过代码,但你明白了。
notes := "this will be default"
if request.Notes != "" {
notes = request.Notes
}
qapi := `
UPDATE custom_param SET param_value = $1, start_date = $2, end_date = $3, status = $4, notes = $4 WHERE param_name = 'default-password'
RETURNING param_value, start_date, end_date, status, notes;
`
// insrt into master_param
sqlError := tx.QueryRowContext(ctx, qapi, request.Value, request.StartDate, request.EndDate, request.Status, notes).Scan(
&value,
&startDate,
&endDate,
&status,
¬es,
)
if sqlError != nil {
log.Println("SQL Error on ReadApplication on UpdateScheduleMaintenance", sqlError)
tx.Rollback()
return schedule, sqlError
}
err = tx.Commit()
if err != nil {
tx.Rollback()
return schedule, err
}
- 1 回答
- 0 关注
- 110 浏览
添加回答
举报