当用户不输入字段 var 时返回默认值(notes ='this will be default')
qapi := `
UPDATE custom_param SET param_value = $1, start_date = $2, end_date = $3, status = $4 `enter code here` 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, request.Notes).Scan(
&value,
&startDate,
&endDate,
&status,
¬es,
)
queryInsertNotes := `insert `
if request.Notes != "" {
notes = request.Notes
}
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
}
当用户不输入任何注释时返回默认注释
叮当猫咪
相关分类