@@ -28,15 +28,15 @@ type insertWithValues interface {
2828 toInsertWithContext
2929 toInsertFinal
3030 Values (values ... interface {}) insertWithValues
31- OnDuplicateKeyIgnore () toInsertFinal
31+ OnDuplicateKeyIgnore () toInsertWithDuplicateKey
3232 OnDuplicateKeyUpdate () insertWithOnDuplicateKeyUpdateBegin
3333}
3434
3535type insertWithModels interface {
3636 toInsertWithContext
3737 toInsertFinal
3838 Models (models ... interface {}) insertWithModels
39- OnDuplicateKeyIgnore () toInsertFinal
39+ OnDuplicateKeyIgnore () toInsertWithDuplicateKey
4040 OnDuplicateKeyUpdate () insertWithOnDuplicateKeyUpdateBegin
4141}
4242
@@ -46,10 +46,8 @@ type insertWithOnDuplicateKeyUpdateBegin interface {
4646}
4747
4848type insertWithOnDuplicateKeyUpdate interface {
49- toInsertWithContext
50- toInsertFinal
51- Set (Field Field , value interface {}) insertWithOnDuplicateKeyUpdate
52- SetIf (condition bool , Field Field , value interface {}) insertWithOnDuplicateKeyUpdate
49+ insertWithOnDuplicateKeyUpdateBegin
50+ toInsertWithDuplicateKey
5351}
5452
5553type toInsertWithContext interface {
@@ -61,6 +59,11 @@ type toInsertFinal interface {
6159 Execute () (result sql.Result , err error )
6260}
6361
62+ type toInsertWithDuplicateKey interface {
63+ toInsertWithContext
64+ toInsertFinal
65+ }
66+
6467func (d * database ) InsertInto (table Table ) insertWithTable {
6568 return insertStatus {method : "INSERT" , scope : scope {Database : d , Tables : []Table {table }}}
6669}
@@ -131,7 +134,7 @@ func (s insertStatus) Set(field Field, value interface{}) insertWithOnDuplicateK
131134 return s
132135}
133136
134- func (s insertStatus ) OnDuplicateKeyIgnore () toInsertFinal {
137+ func (s insertStatus ) OnDuplicateKeyIgnore () toInsertWithDuplicateKey {
135138 firstField := s .scope .Tables [0 ].GetFields ()[0 ]
136139 return s .OnDuplicateKeyUpdate ().Set (firstField , firstField )
137140}
0 commit comments