github.com/RevenueMonster/sqlike@v1.0.6/sqlike/options/insert.go (about) 1 package options 2 3 import "github.com/RevenueMonster/sqlike/sql/util" 4 5 type insertMode int 6 7 // insert modes : 8 const ( 9 InsertIgnore insertMode = iota + 1 10 InsertOnDuplicate 11 ) 12 13 // InsertOptions : 14 type InsertOptions struct { 15 Mode insertMode 16 Omits util.StringSlice 17 Debug bool 18 } 19 20 // Insert : 21 func Insert() *InsertOptions { 22 return &InsertOptions{} 23 } 24 25 // SetMode : 26 func (opt *InsertOptions) SetMode(mode insertMode) *InsertOptions { 27 opt.Mode = mode 28 return opt 29 } 30 31 // SetDebug : 32 func (opt *InsertOptions) SetDebug(debug bool) *InsertOptions { 33 opt.Debug = debug 34 return opt 35 } 36 37 // SetOmitFields : 38 func (opt *InsertOptions) SetOmitFields(fields ...string) *InsertOptions { 39 opt.Omits = fields 40 return opt 41 } 42 43 // // SetOnConflict : 44 // func (opt *InsertOptions) SetOnConflict(src []interface{}) *InsertOptions { 45 // return opt 46 // }