instance_command.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. package dps
  2. import (
  3. "git.sxidc.com/service-supports/dps-sdk/client"
  4. "git.sxidc.com/service-supports/fslog"
  5. )
  6. func Insert(req *client.InsertRequest, tx client.Transaction) error {
  7. var statement string
  8. var err error
  9. if tx == nil {
  10. statement, err = dpsClient.Insert(req)
  11. } else {
  12. statement, err = tx.InsertTx(req)
  13. }
  14. if err != nil {
  15. return err
  16. }
  17. fslog.Info(statement)
  18. return nil
  19. }
  20. func InsertBatch(req *client.InsertBatchRequest, tx client.Transaction) error {
  21. var statement string
  22. var err error
  23. if tx == nil {
  24. statement, err = dpsClient.InsertBatch(req)
  25. } else {
  26. statement, err = tx.InsertBatchTx(req)
  27. }
  28. if err != nil {
  29. return err
  30. }
  31. fslog.Info(statement)
  32. return nil
  33. }
  34. func Delete(req *client.DeleteRequest, tx client.Transaction) error {
  35. var statement string
  36. var err error
  37. if tx == nil {
  38. statement, err = dpsClient.Delete(req)
  39. } else {
  40. statement, err = tx.DeleteTx(req)
  41. }
  42. if err != nil {
  43. return err
  44. }
  45. fslog.Info(statement)
  46. return nil
  47. }
  48. func DeleteWhere(req *client.DeleteWhereRequest, tx client.Transaction) error {
  49. var statement string
  50. var err error
  51. if tx == nil {
  52. statement, err = dpsClient.DeleteWhere(req)
  53. } else {
  54. statement, err = tx.DeleteWhereTx(req)
  55. }
  56. if err != nil {
  57. return err
  58. }
  59. fslog.Info(statement)
  60. return nil
  61. }
  62. func Update(req *client.UpdateRequest, tx client.Transaction) error {
  63. var statement string
  64. var err error
  65. if tx == nil {
  66. statement, err = dpsClient.Update(req)
  67. } else {
  68. statement, err = tx.UpdateTx(req)
  69. }
  70. if err != nil {
  71. return err
  72. }
  73. fslog.Info(statement)
  74. return nil
  75. }
  76. func UpdateWhere(req *client.UpdateWhereRequest, tx client.Transaction) error {
  77. var statement string
  78. var err error
  79. if tx == nil {
  80. statement, err = dpsClient.UpdateWhere(req)
  81. } else {
  82. statement, err = tx.UpdateWhereTx(req)
  83. }
  84. if err != nil {
  85. return err
  86. }
  87. fslog.Info(statement)
  88. return nil
  89. }
  90. func Replay(req *client.ReplayRequest) error {
  91. var statement string
  92. var err error
  93. statement, err = dpsClient.Replay(req)
  94. if err != nil {
  95. return err
  96. }
  97. fslog.Info(statement)
  98. return nil
  99. }