From 84286cd1986c48bd6fd9f3de8d1373dac273c18d Mon Sep 17 00:00:00 2001 From: Nam Huynh Date: Thu, 19 Aug 2021 15:40:48 +0700 Subject: [PATCH] check query select --- action_upsert.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/action_upsert.go b/action_upsert.go index 025c941..4bc60b7 100644 --- a/action_upsert.go +++ b/action_upsert.go @@ -83,6 +83,9 @@ func (s Service) Upsert(payload UpsertPayload) { // Find device id existed or not device := s.findByDeviceID(ctx, deviceID) + pretty.Println("device.ID", device.ID) + pretty.Println("mongodb.IsValidID(device.ID)", mongodb.IsValidID(device.ID)) + if !mongodb.IsValidID(device.ID) { // If not exist, create new stm, args, _ := s.Builder.Insert(TableDeviceMngt). @@ -99,8 +102,6 @@ func (s Service) Upsert(payload UpsertPayload) { ).ToSql() pretty.Println("Create new") - pretty.Println("stm -", stm) - pretty.Println("args -", args) if _, err := s.DB.ExecContext(ctx, stm, args...); err != nil { logger.Error("devicemngt - Upsert: Create new", logger.LogData{ @@ -128,8 +129,6 @@ func (s Service) Upsert(payload UpsertPayload) { ToSql() pretty.Println("Update") - pretty.Println("stm -", stm) - pretty.Println("args -", args) if _, err := s.DB.ExecContext(ctx, stm, args...); err != nil { logger.Error("devicemngt - Upsert: Update", logger.LogData{