[MySQL] Optimizer hints
This commit is contained in:
parent
c9967d151e
commit
f772f90336
12 changed files with 207 additions and 27 deletions
|
|
@ -6,6 +6,8 @@ import "github.com/go-jet/jet/v2/internal/jet"
|
|||
type InsertStatement interface {
|
||||
Statement
|
||||
|
||||
OPTIMIZER_HINTS(hints ...OptimizerHint) InsertStatement
|
||||
|
||||
// Insert row of values
|
||||
VALUES(value interface{}, values ...interface{}) InsertStatement
|
||||
// Insert row of values, where value for each column is extracted from filed of structure data.
|
||||
|
|
@ -22,7 +24,10 @@ type InsertStatement interface {
|
|||
func newInsertStatement(table Table, columns []jet.Column) InsertStatement {
|
||||
newInsert := &insertStatementImpl{}
|
||||
newInsert.SerializerStatement = jet.NewStatementImpl(Dialect, jet.InsertStatementType, newInsert,
|
||||
&newInsert.Insert, &newInsert.ValuesQuery, &newInsert.OnDuplicateKey)
|
||||
&newInsert.Insert,
|
||||
&newInsert.ValuesQuery,
|
||||
&newInsert.OnDuplicateKey,
|
||||
)
|
||||
|
||||
newInsert.Insert.Table = table
|
||||
newInsert.Insert.Columns = columns
|
||||
|
|
@ -38,6 +43,11 @@ type insertStatementImpl struct {
|
|||
OnDuplicateKey onDuplicateKeyUpdateClause
|
||||
}
|
||||
|
||||
func (is *insertStatementImpl) OPTIMIZER_HINTS(hints ...OptimizerHint) InsertStatement {
|
||||
is.Insert.OptimizerHints = hints
|
||||
return is
|
||||
}
|
||||
|
||||
func (is *insertStatementImpl) VALUES(value interface{}, values ...interface{}) InsertStatement {
|
||||
is.ValuesQuery.Rows = append(is.ValuesQuery.Rows, jet.UnwindRowFromValues(value, values))
|
||||
return is
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue