From 93ee4df02477065ed220551494288bd6f4ffff1a Mon Sep 17 00:00:00 2001 From: Nam Huynh Date: Mon, 5 Dec 2022 15:17:39 +0700 Subject: [PATCH] add func get value by key with binding --- get_by_key.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/get_by_key.go b/get_by_key.go index 1e30cff..ced4a23 100644 --- a/get_by_key.go +++ b/get_by_key.go @@ -16,11 +16,11 @@ func (s Server) GetValueByKey(ctx context.Context, key string) string { return value } -// GetValueByKeyWithBinding ... -func (s Server) GetValueByKeyWithBinding(ctx context.Context, key string, result interface{}) error { +// GetValueByKeyWithBindData ... +func (s Server) GetValueByKeyWithBindData(ctx context.Context, key string, result interface{}) error { v := s.GetValueByKey(ctx, key) if v == "" { return errors.New("key not found") } - return json.Unmarshal([]byte(v), result) + return json.Unmarshal([]byte(v), &result) }