658a671b by slene

all panic use Error

1 parent aaf1490f
...@@ -58,7 +58,7 @@ func (d *dbBase) collectValues(mi *modelInfo, ind reflect.Value, cols []string, ...@@ -58,7 +58,7 @@ func (d *dbBase) collectValues(mi *modelInfo, ind reflect.Value, cols []string,
58 if fi, _ = mi.fields.GetByAny(column); fi != nil { 58 if fi, _ = mi.fields.GetByAny(column); fi != nil {
59 column = fi.column 59 column = fi.column
60 } else { 60 } else {
61 panic(fmt.Sprintf("wrong db field/column name `%s` for model `%s`", column, mi.fullName)) 61 panic(fmt.Errorf("wrong db field/column name `%s` for model `%s`", column, mi.fullName))
62 } 62 }
63 if fi.dbcol == false || fi.auto && skipAuto { 63 if fi.dbcol == false || fi.auto && skipAuto {
64 continue 64 continue
...@@ -360,7 +360,7 @@ func (d *dbBase) UpdateBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Con ...@@ -360,7 +360,7 @@ func (d *dbBase) UpdateBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Con
360 values := make([]interface{}, 0, len(params)) 360 values := make([]interface{}, 0, len(params))
361 for col, val := range params { 361 for col, val := range params {
362 if fi, ok := mi.fields.GetByAny(col); ok == false || fi.dbcol == false { 362 if fi, ok := mi.fields.GetByAny(col); ok == false || fi.dbcol == false {
363 panic(fmt.Sprintf("wrong field/column name `%s`", col)) 363 panic(fmt.Errorf("wrong field/column name `%s`", col))
364 } else { 364 } else {
365 columns = append(columns, fi.column) 365 columns = append(columns, fi.column)
366 values = append(values, val) 366 values = append(values, val)
...@@ -368,7 +368,7 @@ func (d *dbBase) UpdateBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Con ...@@ -368,7 +368,7 @@ func (d *dbBase) UpdateBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Con
368 } 368 }
369 369
370 if len(columns) == 0 { 370 if len(columns) == 0 {
371 panic("update params cannot empty") 371 panic(fmt.Errorf("update params cannot empty"))
372 } 372 }
373 373
374 tables := newDbTables(mi, d.ins) 374 tables := newDbTables(mi, d.ins)
...@@ -438,7 +438,7 @@ func (d *dbBase) DeleteBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Con ...@@ -438,7 +438,7 @@ func (d *dbBase) DeleteBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Con
438 } 438 }
439 439
440 if cond == nil || cond.IsEmpty() { 440 if cond == nil || cond.IsEmpty() {
441 panic("delete operation cannot execute without condition") 441 panic(fmt.Errorf("delete operation cannot execute without condition"))
442 } 442 }
443 443
444 Q := d.ins.TableQuote() 444 Q := d.ins.TableQuote()
...@@ -533,9 +533,9 @@ func (d *dbBase) ReadBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Condi ...@@ -533,9 +533,9 @@ func (d *dbBase) ReadBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Condi
533 533
534 if errTyp { 534 if errTyp {
535 if one { 535 if one {
536 panic(fmt.Sprintf("wrong object type `%s` for rows scan, need *%s", val.Type(), mi.fullName)) 536 panic(fmt.Errorf("wrong object type `%s` for rows scan, need *%s", val.Type(), mi.fullName))
537 } else { 537 } else {
538 panic(fmt.Sprintf("wrong object type `%s` for rows scan, need *[]*%s or *[]%s", val.Type(), mi.fullName, mi.fullName)) 538 panic(fmt.Errorf("wrong object type `%s` for rows scan, need *[]*%s or *[]%s", val.Type(), mi.fullName, mi.fullName))
539 } 539 }
540 } 540 }
541 541
...@@ -559,7 +559,7 @@ func (d *dbBase) ReadBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Condi ...@@ -559,7 +559,7 @@ func (d *dbBase) ReadBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Condi
559 maps[fi.column] = true 559 maps[fi.column] = true
560 } 560 }
561 } else { 561 } else {
562 panic(fmt.Sprintf("wrong field/column name `%s`", col)) 562 panic(fmt.Errorf("wrong field/column name `%s`", col))
563 } 563 }
564 } 564 }
565 if hasRel { 565 if hasRel {
...@@ -717,7 +717,7 @@ func (d *dbBase) GenerateOperatorSql(mi *modelInfo, fi *fieldInfo, operator stri ...@@ -717,7 +717,7 @@ func (d *dbBase) GenerateOperatorSql(mi *modelInfo, fi *fieldInfo, operator stri
717 params := getFlatParams(fi, args, tz) 717 params := getFlatParams(fi, args, tz)
718 718
719 if len(params) == 0 { 719 if len(params) == 0 {
720 panic(fmt.Sprintf("operator `%s` need at least one args", operator)) 720 panic(fmt.Errorf("operator `%s` need at least one args", operator))
721 } 721 }
722 arg := params[0] 722 arg := params[0]
723 723
...@@ -729,7 +729,7 @@ func (d *dbBase) GenerateOperatorSql(mi *modelInfo, fi *fieldInfo, operator stri ...@@ -729,7 +729,7 @@ func (d *dbBase) GenerateOperatorSql(mi *modelInfo, fi *fieldInfo, operator stri
729 sql = fmt.Sprintf("IN (%s)", strings.Join(marks, ", ")) 729 sql = fmt.Sprintf("IN (%s)", strings.Join(marks, ", "))
730 } else { 730 } else {
731 if len(params) > 1 { 731 if len(params) > 1 {
732 panic(fmt.Sprintf("operator `%s` need 1 args not %d", operator, len(params))) 732 panic(fmt.Errorf("operator `%s` need 1 args not %d", operator, len(params)))
733 } 733 }
734 sql = d.ins.OperatorSql(operator) 734 sql = d.ins.OperatorSql(operator)
735 switch operator { 735 switch operator {
...@@ -758,7 +758,7 @@ func (d *dbBase) GenerateOperatorSql(mi *modelInfo, fi *fieldInfo, operator stri ...@@ -758,7 +758,7 @@ func (d *dbBase) GenerateOperatorSql(mi *modelInfo, fi *fieldInfo, operator stri
758 } 758 }
759 params = nil 759 params = nil
760 } else { 760 } else {
761 panic(fmt.Sprintf("operator `%s` need a bool value not `%T`", operator, arg)) 761 panic(fmt.Errorf("operator `%s` need a bool value not `%T`", operator, arg))
762 } 762 }
763 } 763 }
764 } 764 }
...@@ -779,13 +779,13 @@ func (d *dbBase) setColsValues(mi *modelInfo, ind *reflect.Value, cols []string, ...@@ -779,13 +779,13 @@ func (d *dbBase) setColsValues(mi *modelInfo, ind *reflect.Value, cols []string,
779 779
780 value, err := d.convertValueFromDB(fi, val, tz) 780 value, err := d.convertValueFromDB(fi, val, tz)
781 if err != nil { 781 if err != nil {
782 panic(fmt.Sprintf("Raw value: `%v` %s", val, err.Error())) 782 panic(fmt.Errorf("Raw value: `%v` %s", val, err.Error()))
783 } 783 }
784 784
785 _, err = d.setFieldValue(fi, value, field) 785 _, err = d.setFieldValue(fi, value, field)
786 786
787 if err != nil { 787 if err != nil {
788 panic(fmt.Sprintf("Raw value: `%v` %s", val, err.Error())) 788 panic(fmt.Errorf("Raw value: `%v` %s", val, err.Error()))
789 } 789 }
790 } 790 }
791 } 791 }
...@@ -1034,7 +1034,7 @@ func (d *dbBase) ReadValues(q dbQuerier, qs *querySet, mi *modelInfo, cond *Cond ...@@ -1034,7 +1034,7 @@ func (d *dbBase) ReadValues(q dbQuerier, qs *querySet, mi *modelInfo, cond *Cond
1034 case *ParamsList: 1034 case *ParamsList:
1035 typ = 3 1035 typ = 3
1036 default: 1036 default:
1037 panic(fmt.Sprintf("unsupport read values type `%T`", container)) 1037 panic(fmt.Errorf("unsupport read values type `%T`", container))
1038 } 1038 }
1039 1039
1040 tables := newDbTables(mi, d.ins) 1040 tables := newDbTables(mi, d.ins)
...@@ -1117,7 +1117,7 @@ func (d *dbBase) ReadValues(q dbQuerier, qs *querySet, mi *modelInfo, cond *Cond ...@@ -1117,7 +1117,7 @@ func (d *dbBase) ReadValues(q dbQuerier, qs *querySet, mi *modelInfo, cond *Cond
1117 1117
1118 value, err := d.convertValueFromDB(fi, val, tz) 1118 value, err := d.convertValueFromDB(fi, val, tz)
1119 if err != nil { 1119 if err != nil {
1120 panic(fmt.Sprintf("db value convert failed `%v` %s", val, err.Error())) 1120 panic(fmt.Errorf("db value convert failed `%v` %s", val, err.Error()))
1121 } 1121 }
1122 1122
1123 params[columns[i]] = value 1123 params[columns[i]] = value
...@@ -1132,7 +1132,7 @@ func (d *dbBase) ReadValues(q dbQuerier, qs *querySet, mi *modelInfo, cond *Cond ...@@ -1132,7 +1132,7 @@ func (d *dbBase) ReadValues(q dbQuerier, qs *querySet, mi *modelInfo, cond *Cond
1132 1132
1133 value, err := d.convertValueFromDB(fi, val, tz) 1133 value, err := d.convertValueFromDB(fi, val, tz)
1134 if err != nil { 1134 if err != nil {
1135 panic(fmt.Sprintf("db value convert failed `%v` %s", val, err.Error())) 1135 panic(fmt.Errorf("db value convert failed `%v` %s", val, err.Error()))
1136 } 1136 }
1137 1137
1138 params = append(params, value) 1138 params = append(params, value)
...@@ -1146,7 +1146,7 @@ func (d *dbBase) ReadValues(q dbQuerier, qs *querySet, mi *modelInfo, cond *Cond ...@@ -1146,7 +1146,7 @@ func (d *dbBase) ReadValues(q dbQuerier, qs *querySet, mi *modelInfo, cond *Cond
1146 1146
1147 value, err := d.convertValueFromDB(fi, val, tz) 1147 value, err := d.convertValueFromDB(fi, val, tz)
1148 if err != nil { 1148 if err != nil {
1149 panic(fmt.Sprintf("db value convert failed `%v` %s", val, err.Error())) 1149 panic(fmt.Errorf("db value convert failed `%v` %s", val, err.Error()))
1150 } 1150 }
1151 1151
1152 list = append(list, value) 1152 list = append(list, value)
......
...@@ -126,7 +126,7 @@ func (t *dbTables) parseRelated(rels []string, depth int) { ...@@ -126,7 +126,7 @@ func (t *dbTables) parseRelated(rels []string, depth int) {
126 jtl = jt 126 jtl = jt
127 127
128 } else { 128 } else {
129 panic(fmt.Sprintf("unknown model/table name `%s`", ex)) 129 panic(fmt.Errorf("unknown model/table name `%s`", ex))
130 } 130 }
131 } 131 }
132 } 132 }
......
...@@ -14,7 +14,7 @@ func registerModel(model interface{}, prefix string) { ...@@ -14,7 +14,7 @@ func registerModel(model interface{}, prefix string) {
14 typ := ind.Type() 14 typ := ind.Type()
15 15
16 if val.Kind() != reflect.Ptr { 16 if val.Kind() != reflect.Ptr {
17 panic(fmt.Sprintf("<orm.RegisterModel> cannot use non-ptr model struct `%s`", getFullName(typ))) 17 panic(fmt.Errorf("<orm.RegisterModel> cannot use non-ptr model struct `%s`", getFullName(typ)))
18 } 18 }
19 19
20 table := getTableName(val) 20 table := getTableName(val)
...@@ -177,7 +177,7 @@ func bootStrap() { ...@@ -177,7 +177,7 @@ func bootStrap() {
177 } 177 }
178 } 178 }
179 if added == false { 179 if added == false {
180 panic(fmt.Sprintf("cannot generate auto reverse field info `%s` to `%s`", fi.fullName, ffi.fullName)) 180 panic(fmt.Errorf("cannot generate auto reverse field info `%s` to `%s`", fi.fullName, ffi.fullName))
181 } 181 }
182 } 182 }
183 } 183 }
......
...@@ -44,13 +44,13 @@ func (o *orm) getMiInd(md interface{}) (mi *modelInfo, ind reflect.Value) { ...@@ -44,13 +44,13 @@ func (o *orm) getMiInd(md interface{}) (mi *modelInfo, ind reflect.Value) {
44 ind = reflect.Indirect(val) 44 ind = reflect.Indirect(val)
45 typ := ind.Type() 45 typ := ind.Type()
46 if val.Kind() != reflect.Ptr { 46 if val.Kind() != reflect.Ptr {
47 panic(fmt.Sprintf("<Ormer> cannot use non-ptr model struct `%s`", getFullName(typ))) 47 panic(fmt.Errorf("<Ormer> cannot use non-ptr model struct `%s`", getFullName(typ)))
48 } 48 }
49 name := getFullName(typ) 49 name := getFullName(typ)
50 if mi, ok := modelCache.getByFN(name); ok { 50 if mi, ok := modelCache.getByFN(name); ok {
51 return mi, ind 51 return mi, ind
52 } 52 }
53 panic(fmt.Sprintf("<Ormer> table: `%s` not found, maybe not RegisterModel", name)) 53 panic(fmt.Errorf("<Ormer> table: `%s` not found, maybe not RegisterModel", name))
54 } 54 }
55 55
56 func (o *orm) Read(md interface{}, cols ...string) error { 56 func (o *orm) Read(md interface{}, cols ...string) error {
...@@ -141,14 +141,14 @@ func (o *orm) QueryTable(ptrStructOrTableName interface{}) (qs QuerySeter) { ...@@ -141,14 +141,14 @@ func (o *orm) QueryTable(ptrStructOrTableName interface{}) (qs QuerySeter) {
141 } 141 }
142 } 142 }
143 if qs == nil { 143 if qs == nil {
144 panic(fmt.Sprintf("<Ormer.QueryTable> table name: `%s` not exists", name)) 144 panic(fmt.Errorf("<Ormer.QueryTable> table name: `%s` not exists", name))
145 } 145 }
146 return 146 return
147 } 147 }
148 148
149 func (o *orm) Using(name string) error { 149 func (o *orm) Using(name string) error {
150 if o.isTx { 150 if o.isTx {
151 panic("<Ormer.Using> transaction has been start, cannot change db") 151 panic(fmt.Errorf("<Ormer.Using> transaction has been start, cannot change db"))
152 } 152 }
153 if al, ok := dataBaseCache.get(name); ok { 153 if al, ok := dataBaseCache.get(name); ok {
154 o.alias = al 154 o.alias = al
...@@ -158,7 +158,7 @@ func (o *orm) Using(name string) error { ...@@ -158,7 +158,7 @@ func (o *orm) Using(name string) error {
158 o.db = al.DB 158 o.db = al.DB
159 } 159 }
160 } else { 160 } else {
161 return errors.New(fmt.Sprintf("<Ormer.Using> unknown db alias name `%s`", name)) 161 return fmt.Errorf("<Ormer.Using> unknown db alias name `%s`", name)
162 } 162 }
163 return nil 163 return nil
164 } 164 }
......
1 package orm 1 package orm
2 2
3 import ( 3 import (
4 "fmt"
4 "strings" 5 "strings"
5 ) 6 )
6 7
...@@ -28,7 +29,7 @@ func NewCondition() *Condition { ...@@ -28,7 +29,7 @@ func NewCondition() *Condition {
28 29
29 func (c Condition) And(expr string, args ...interface{}) *Condition { 30 func (c Condition) And(expr string, args ...interface{}) *Condition {
30 if expr == "" || len(args) == 0 { 31 if expr == "" || len(args) == 0 {
31 panic("<Condition.And> args cannot empty") 32 panic(fmt.Errorf("<Condition.And> args cannot empty"))
32 } 33 }
33 c.params = append(c.params, condValue{exprs: strings.Split(expr, ExprSep), args: args}) 34 c.params = append(c.params, condValue{exprs: strings.Split(expr, ExprSep), args: args})
34 return &c 35 return &c
...@@ -36,7 +37,7 @@ func (c Condition) And(expr string, args ...interface{}) *Condition { ...@@ -36,7 +37,7 @@ func (c Condition) And(expr string, args ...interface{}) *Condition {
36 37
37 func (c Condition) AndNot(expr string, args ...interface{}) *Condition { 38 func (c Condition) AndNot(expr string, args ...interface{}) *Condition {
38 if expr == "" || len(args) == 0 { 39 if expr == "" || len(args) == 0 {
39 panic("<Condition.AndNot> args cannot empty") 40 panic(fmt.Errorf("<Condition.AndNot> args cannot empty"))
40 } 41 }
41 c.params = append(c.params, condValue{exprs: strings.Split(expr, ExprSep), args: args, isNot: true}) 42 c.params = append(c.params, condValue{exprs: strings.Split(expr, ExprSep), args: args, isNot: true})
42 return &c 43 return &c
...@@ -45,7 +46,7 @@ func (c Condition) AndNot(expr string, args ...interface{}) *Condition { ...@@ -45,7 +46,7 @@ func (c Condition) AndNot(expr string, args ...interface{}) *Condition {
45 func (c *Condition) AndCond(cond *Condition) *Condition { 46 func (c *Condition) AndCond(cond *Condition) *Condition {
46 c = c.clone() 47 c = c.clone()
47 if c == cond { 48 if c == cond {
48 panic("cannot use self as sub cond") 49 panic(fmt.Errorf("<Condition.AndCond> cannot use self as sub cond"))
49 } 50 }
50 if cond != nil { 51 if cond != nil {
51 c.params = append(c.params, condValue{cond: cond, isCond: true}) 52 c.params = append(c.params, condValue{cond: cond, isCond: true})
...@@ -55,7 +56,7 @@ func (c *Condition) AndCond(cond *Condition) *Condition { ...@@ -55,7 +56,7 @@ func (c *Condition) AndCond(cond *Condition) *Condition {
55 56
56 func (c Condition) Or(expr string, args ...interface{}) *Condition { 57 func (c Condition) Or(expr string, args ...interface{}) *Condition {
57 if expr == "" || len(args) == 0 { 58 if expr == "" || len(args) == 0 {
58 panic("<Condition.Or> args cannot empty") 59 panic(fmt.Errorf("<Condition.Or> args cannot empty"))
59 } 60 }
60 c.params = append(c.params, condValue{exprs: strings.Split(expr, ExprSep), args: args, isOr: true}) 61 c.params = append(c.params, condValue{exprs: strings.Split(expr, ExprSep), args: args, isOr: true})
61 return &c 62 return &c
...@@ -63,7 +64,7 @@ func (c Condition) Or(expr string, args ...interface{}) *Condition { ...@@ -63,7 +64,7 @@ func (c Condition) Or(expr string, args ...interface{}) *Condition {
63 64
64 func (c Condition) OrNot(expr string, args ...interface{}) *Condition { 65 func (c Condition) OrNot(expr string, args ...interface{}) *Condition {
65 if expr == "" || len(args) == 0 { 66 if expr == "" || len(args) == 0 {
66 panic("<Condition.OrNot> args cannot empty") 67 panic(fmt.Errorf("<Condition.OrNot> args cannot empty"))
67 } 68 }
68 c.params = append(c.params, condValue{exprs: strings.Split(expr, ExprSep), args: args, isNot: true, isOr: true}) 69 c.params = append(c.params, condValue{exprs: strings.Split(expr, ExprSep), args: args, isNot: true, isOr: true})
69 return &c 70 return &c
...@@ -72,7 +73,7 @@ func (c Condition) OrNot(expr string, args ...interface{}) *Condition { ...@@ -72,7 +73,7 @@ func (c Condition) OrNot(expr string, args ...interface{}) *Condition {
72 func (c *Condition) OrCond(cond *Condition) *Condition { 73 func (c *Condition) OrCond(cond *Condition) *Condition {
73 c = c.clone() 74 c = c.clone()
74 if c == cond { 75 if c == cond {
75 panic("cannot use self as sub cond") 76 panic(fmt.Errorf("<Condition.OrCond> cannot use self as sub cond"))
76 } 77 }
77 if cond != nil { 78 if cond != nil {
78 c.params = append(c.params, condValue{cond: cond, isCond: true, isOr: true}) 79 c.params = append(c.params, condValue{cond: cond, isCond: true, isOr: true})
......
...@@ -23,10 +23,10 @@ func (o *insertSet) Insert(md interface{}) (int64, error) { ...@@ -23,10 +23,10 @@ func (o *insertSet) Insert(md interface{}) (int64, error) {
23 typ := ind.Type() 23 typ := ind.Type()
24 name := getFullName(typ) 24 name := getFullName(typ)
25 if val.Kind() != reflect.Ptr { 25 if val.Kind() != reflect.Ptr {
26 panic(fmt.Sprintf("<Inserter.Insert> cannot use non-ptr model struct `%s`", name)) 26 panic(fmt.Errorf("<Inserter.Insert> cannot use non-ptr model struct `%s`", name))
27 } 27 }
28 if name != o.mi.fullName { 28 if name != o.mi.fullName {
29 panic(fmt.Sprintf("<Inserter.Insert> need model `%s` but found `%s`", o.mi.fullName, name)) 29 panic(fmt.Errorf("<Inserter.Insert> need model `%s` but found `%s`", o.mi.fullName, name))
30 } 30 }
31 id, err := o.orm.alias.DbBaser.InsertStmt(o.stmt, o.mi, ind, o.orm.alias.TZ) 31 id, err := o.orm.alias.DbBaser.InsertStmt(o.stmt, o.mi, ind, o.orm.alias.TZ)
32 if err != nil { 32 if err != nil {
......
...@@ -67,7 +67,7 @@ func (o querySet) RelatedSel(params ...interface{}) QuerySeter { ...@@ -67,7 +67,7 @@ func (o querySet) RelatedSel(params ...interface{}) QuerySeter {
67 case int: 67 case int:
68 o.relDepth = val 68 o.relDepth = val
69 default: 69 default:
70 panic(fmt.Sprintf("<QuerySeter.RelatedSel> wrong param kind: %v", val)) 70 panic(fmt.Errorf("<QuerySeter.RelatedSel> wrong param kind: %v", val))
71 } 71 }
72 } 72 }
73 } 73 }
......
...@@ -314,7 +314,7 @@ func (o *rawSet) loopSetRefs(refs []interface{}, sIdxes [][]int, sInds []reflect ...@@ -314,7 +314,7 @@ func (o *rawSet) loopSetRefs(refs []interface{}, sIdxes [][]int, sInds []reflect
314 314
315 func (o *rawSet) QueryRow(containers ...interface{}) error { 315 func (o *rawSet) QueryRow(containers ...interface{}) error {
316 if len(containers) == 0 { 316 if len(containers) == 0 {
317 panic("<RawSeter.QueryRow> need at least one arg") 317 panic(fmt.Errorf("<RawSeter.QueryRow> need at least one arg"))
318 } 318 }
319 319
320 refs := make([]interface{}, 0, len(containers)) 320 refs := make([]interface{}, 0, len(containers))
...@@ -327,7 +327,7 @@ func (o *rawSet) QueryRow(containers ...interface{}) error { ...@@ -327,7 +327,7 @@ func (o *rawSet) QueryRow(containers ...interface{}) error {
327 ind := reflect.Indirect(val) 327 ind := reflect.Indirect(val)
328 328
329 if val.Kind() != reflect.Ptr { 329 if val.Kind() != reflect.Ptr {
330 panic("<RawSeter.QueryRow> all args must be use ptr") 330 panic(fmt.Errorf("<RawSeter.QueryRow> all args must be use ptr"))
331 } 331 }
332 332
333 etyp := ind.Type() 333 etyp := ind.Type()
...@@ -377,7 +377,7 @@ func (o *rawSet) QueryRows(containers ...interface{}) (int64, error) { ...@@ -377,7 +377,7 @@ func (o *rawSet) QueryRows(containers ...interface{}) (int64, error) {
377 val := reflect.ValueOf(container) 377 val := reflect.ValueOf(container)
378 sInd := reflect.Indirect(val) 378 sInd := reflect.Indirect(val)
379 if val.Kind() != reflect.Ptr || sInd.Kind() != reflect.Slice { 379 if val.Kind() != reflect.Ptr || sInd.Kind() != reflect.Slice {
380 panic("<RawSeter.QueryRows> all args must be use ptr slice") 380 panic(fmt.Errorf("<RawSeter.QueryRows> all args must be use ptr slice"))
381 } 381 }
382 382
383 etyp := sInd.Type().Elem() 383 etyp := sInd.Type().Elem()
...@@ -440,7 +440,7 @@ func (o *rawSet) readValues(container interface{}) (int64, error) { ...@@ -440,7 +440,7 @@ func (o *rawSet) readValues(container interface{}) (int64, error) {
440 case *ParamsList: 440 case *ParamsList:
441 typ = 3 441 typ = 3
442 default: 442 default:
443 panic(fmt.Sprintf("<RawSeter> unsupport read values type `%T`", container)) 443 panic(fmt.Errorf("<RawSeter> unsupport read values type `%T`", container))
444 } 444 }
445 445
446 query := o.query 446 query := o.query
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!