functest.go 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. package postgre
  2. type FuncTest struct {
  3. }
  4. func (f FuncTest) TestAdd(optUserId int, jsonStr string, verfStr string) (err error) {
  5. result := map[string]interface{}{}
  6. //err = getClient().Exec("select demo_tmp_user_add(? ,? ,? )",optUserId,jsonStr,verfStr).Error
  7. err = getClient().Raw("select demo_tmp_user_add(? ,? ,? )", optUserId, jsonStr, verfStr).Scan(&result).Error
  8. return
  9. }
  10. func (f FuncTest) TestQuery32(optUserId int, jsonStr string, verfStr string) (rst string, err error) {
  11. var result string
  12. //row1,err_ := getClient().Raw("select demo_tmp_user_query(? ,? ,? )",optUserId,jsonStr,verfStr).Rows()
  13. err = getClient().Raw("select demo_tmp_user_query(? ,? ,? )", optUserId, jsonStr, verfStr).Scan(&result).Error
  14. //row1.Scan(&result)
  15. //println(result)
  16. //if err != nil {
  17. // st := err.Error()
  18. // t1 := strings.Split(st, ";")[0]
  19. // comma1 := strings.Index(t1, "errcode:")
  20. // comma2 := strings.Index(t1, "errmemo:")
  21. // println(comma1, comma2)
  22. // pos := strings.Index(t1[comma1:], ",err")
  23. // println(pos)
  24. // println(t1[comma1:13])
  25. // println(t1[comma2:])
  26. //}
  27. return
  28. }