Fix use hint with join bug
This commit is contained in:
parent
bdd8787d84
commit
529b8c66e9
|
@ -184,6 +184,7 @@ func (statement *Statement) writeFrom(w *builder.BytesWriter) error {
|
||||||
statement.writeStrings(" FROM "),
|
statement.writeStrings(" FROM "),
|
||||||
statement.writeTableName,
|
statement.writeTableName,
|
||||||
statement.writeAlias,
|
statement.writeAlias,
|
||||||
|
statement.writeIndexHints,
|
||||||
statement.writeJoins,
|
statement.writeJoins,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -254,7 +255,6 @@ func (statement *Statement) writeSelect(buf *builder.BytesWriter, columnStr stri
|
||||||
return statement.writeMultiple(buf,
|
return statement.writeMultiple(buf,
|
||||||
statement.writeSelectColumns(columnStr),
|
statement.writeSelectColumns(columnStr),
|
||||||
statement.writeFrom,
|
statement.writeFrom,
|
||||||
statement.writeIndexHints,
|
|
||||||
statement.writeWhere,
|
statement.writeWhere,
|
||||||
statement.writeGroupBy,
|
statement.writeGroupBy,
|
||||||
statement.writeHaving,
|
statement.writeHaving,
|
||||||
|
|
|
@ -78,4 +78,11 @@ func TestIndexHint(t *testing.T) {
|
||||||
|
|
||||||
_, err = testEngine.Table("userinfo").IndexHint("USE", "GROUP BY", "UQE_userinfo_username").Get(new(Userinfo))
|
_, err = testEngine.Table("userinfo").IndexHint("USE", "GROUP BY", "UQE_userinfo_username").Get(new(Userinfo))
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
// with join
|
||||||
|
_, err = testEngine.Table("userinfo").
|
||||||
|
Join("LEFT", "userdetail", "userinfo.id = userdetail.id").
|
||||||
|
IndexHint("USE", "", "UQE_userinfo_username").
|
||||||
|
Get(new(Userinfo))
|
||||||
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue