Handle todos.
This commit is contained in:
parent
d3d00910aa
commit
9a34dc9fd7
6 changed files with 48 additions and 28 deletions
|
|
@ -19,7 +19,7 @@ type InsertStatement interface {
|
|||
func newInsertStatement(table Table, columns []jet.Column) InsertStatement {
|
||||
newInsert := &insertStatementImpl{}
|
||||
newInsert.StatementImpl = jet.NewStatementImpl(Dialect, jet.InsertStatementType, newInsert,
|
||||
&newInsert.Insert, &newInsert.Values, &newInsert.Select)
|
||||
&newInsert.Insert, &newInsert.ValuesQuery)
|
||||
|
||||
newInsert.Insert.Table = table
|
||||
newInsert.Insert.Columns = columns
|
||||
|
|
@ -30,27 +30,26 @@ func newInsertStatement(table Table, columns []jet.Column) InsertStatement {
|
|||
type insertStatementImpl struct {
|
||||
jet.StatementImpl
|
||||
|
||||
Insert jet.ClauseInsert
|
||||
Values jet.ClauseValues
|
||||
Select jet.ClauseQuery
|
||||
Insert jet.ClauseInsert
|
||||
ValuesQuery jet.ClauseValuesQuery
|
||||
}
|
||||
|
||||
func (i *insertStatementImpl) VALUES(value interface{}, values ...interface{}) InsertStatement {
|
||||
i.Values.Rows = append(i.Values.Rows, jet.UnwindRowFromValues(value, values))
|
||||
i.ValuesQuery.Rows = append(i.ValuesQuery.Rows, jet.UnwindRowFromValues(value, values))
|
||||
return i
|
||||
}
|
||||
|
||||
func (i *insertStatementImpl) MODEL(data interface{}) InsertStatement {
|
||||
i.Values.Rows = append(i.Values.Rows, jet.UnwindRowFromModel(i.Insert.GetColumns(), data))
|
||||
i.ValuesQuery.Rows = append(i.ValuesQuery.Rows, jet.UnwindRowFromModel(i.Insert.GetColumns(), data))
|
||||
return i
|
||||
}
|
||||
|
||||
func (i *insertStatementImpl) MODELS(data interface{}) InsertStatement {
|
||||
i.Values.Rows = append(i.Values.Rows, jet.UnwindRowsFromModels(i.Insert.GetColumns(), data)...)
|
||||
i.ValuesQuery.Rows = append(i.ValuesQuery.Rows, jet.UnwindRowsFromModels(i.Insert.GetColumns(), data)...)
|
||||
return i
|
||||
}
|
||||
|
||||
func (i *insertStatementImpl) QUERY(selectStatement SelectStatement) InsertStatement {
|
||||
i.Select.Query = selectStatement
|
||||
i.ValuesQuery.Query = selectStatement
|
||||
return i
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue