Skip to content

Commit e0a3023

Browse files
author
phuonghn
committed
add debug lgo
1 parent 8068289 commit e0a3023

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

field/custom_field.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,15 @@ func setBy(ctx context.Context, doc interface{}, fieldName string, ctxKey string
173173
}
174174
e := reflect.ValueOf(doc).Elem()
175175
ca := e.FieldByName(fieldName)
176+
fmt.Printf("Set time e:%v\n", e)
177+
fmt.Printf("Set time ca:%v ---> can set %v\n", ca, ca.CanSet())
176178
if ca.CanSet() {
179+
fmt.Printf("ca type %v ", ca.Interface())
177180
switch a := ca.Interface().(type) {
178181
case string:
179182
by := ctx.Value(ctxKey)
180-
ca.SetString(by.((string)))
183+
fmt.Printf("ctx value %v --> %v", ctxKey, by.(string))
184+
ca.SetString(by.(string))
181185
default:
182186
fmt.Println("unsupported type to SetBy", a)
183187
}
@@ -193,8 +197,8 @@ func setTime(ctx context.Context, doc interface{}, fieldName string, overWrite b
193197
}
194198
e := reflect.ValueOf(doc).Elem()
195199
ca := e.FieldByName(fieldName)
196-
fmt.Printf("Set time e:%v", e)
197-
fmt.Printf("Set time ca:%v ---> can set %v", ca, ca.CanSet())
200+
fmt.Printf("Set time e:%v\n", e)
201+
fmt.Printf("Set time ca:%v ---> can set %v\n", ca, ca.CanSet())
198202
if ca.CanSet() {
199203
tt := time.Now()
200204
atype := ca.Interface()

0 commit comments

Comments
 (0)