fix insert and update args
This commit is contained in:
parent
9edabb1140
commit
942c45a95c
|
@ -102,7 +102,7 @@ func (s Service) Upsert(payload UpsertPayload) {
|
||||||
pretty.Println("stm -", stm)
|
pretty.Println("stm -", stm)
|
||||||
pretty.Println("args -", args)
|
pretty.Println("args -", args)
|
||||||
|
|
||||||
if _, err := s.DB.ExecContext(ctx, stm, args); err != nil {
|
if _, err := s.DB.ExecContext(ctx, stm, args...); err != nil {
|
||||||
logger.Error("devicemngt - Upsert: Create new", logger.LogData{
|
logger.Error("devicemngt - Upsert: Create new", logger.LogData{
|
||||||
"payload": payload,
|
"payload": payload,
|
||||||
"error": err.Error(),
|
"error": err.Error(),
|
||||||
|
@ -131,7 +131,7 @@ func (s Service) Upsert(payload UpsertPayload) {
|
||||||
pretty.Println("stm -", stm)
|
pretty.Println("stm -", stm)
|
||||||
pretty.Println("args -", args)
|
pretty.Println("args -", args)
|
||||||
|
|
||||||
if _, err := s.DB.ExecContext(ctx, stm, args); err != nil {
|
if _, err := s.DB.ExecContext(ctx, stm, args...); err != nil {
|
||||||
logger.Error("devicemngt - Upsert: Update", logger.LogData{
|
logger.Error("devicemngt - Upsert: Update", logger.LogData{
|
||||||
"payload": payload,
|
"payload": payload,
|
||||||
"error": err.Error(),
|
"error": err.Error(),
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
func (s Service) findByDeviceID(ctx context.Context, id string) (result Device) {
|
func (s Service) findByDeviceID(ctx context.Context, id string) (result Device) {
|
||||||
stm, args, _ := s.Builder.Select("*").From(TableDeviceMngt).Where("device_id = ?", id).ToSql()
|
stm, args, _ := s.Builder.Select("*").From(TableDeviceMngt).Where("device_id = ?", id).ToSql()
|
||||||
|
|
||||||
if err := s.DB.GetContext(ctx, &result, stm, args...); err != nil {
|
if err := s.DB.SelectContext(ctx, &result, stm, args...); err != nil {
|
||||||
logger.Error("devicemngt - findByDeviceID", logger.LogData{
|
logger.Error("devicemngt - findByDeviceID", logger.LogData{
|
||||||
"device_id": id,
|
"device_id": id,
|
||||||
"error": err.Error(),
|
"error": err.Error(),
|
||||||
|
|
Loading…
Reference in New Issue