修复 curve 接口的一些问题
This commit is contained in:
@@ -18,7 +18,7 @@ func NewCurveRepository(db *sql.DB) *CurveRepository {
|
||||
|
||||
// GetModelByBrandAndName 按 brand_name + name 查询 Model(唯一索引)
|
||||
func (r *CurveRepository) GetModelByBrandAndName(ctx context.Context, brandName, name string) (*model.Model, error) {
|
||||
const query = `SELECT id, brand_name, name, form, rig, source, eq_key, create_at FROM model WHERE brand_name = ? AND name = ?`
|
||||
const query = `SELECT id, brand_name, name, form, rig, source, eq_key, create_at FROM model WHERE BINARY brand_name = ? AND BINARY name = ?`
|
||||
|
||||
var m model.Model
|
||||
var form, rig, source, eqKey sql.NullString
|
||||
@@ -43,13 +43,13 @@ func (r *CurveRepository) GetModelByBrandAndName(ctx context.Context, brandName,
|
||||
|
||||
// GetTargetByLabel 按 label 查询 Target
|
||||
func (r *CurveRepository) GetTargetByLabel(ctx context.Context, label string) (*model.Target, error) {
|
||||
const query = `SELECT id, label, read_csv, file, bass_boost, create_at FROM target WHERE label = ?`
|
||||
const query = `SELECT id, label, read_csv, file, bassBoost, addtime FROM target WHERE BINARY label = ?`
|
||||
|
||||
var t model.Target
|
||||
var file, bassBoost sql.NullString
|
||||
|
||||
err := r.db.QueryRowContext(ctx, query, label).Scan(
|
||||
&t.ID, &t.Label, &t.ReadCSV, &file, &bassBoost, &t.CreateAt,
|
||||
&t.ID, &t.Label, &t.ReadCSV, &file, &bassBoost, &t.AddTime,
|
||||
)
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, nil
|
||||
@@ -62,4 +62,4 @@ func (r *CurveRepository) GetTargetByLabel(ctx context.Context, label string) (*
|
||||
t.BassBoost = nullStringPtr(bassBoost)
|
||||
|
||||
return &t, nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user