add func get value by key with binding
This commit is contained in:
parent
5d14b794dd
commit
93ee4df024
|
@ -16,11 +16,11 @@ func (s Server) GetValueByKey(ctx context.Context, key string) string {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetValueByKeyWithBinding ...
|
// GetValueByKeyWithBindData ...
|
||||||
func (s Server) GetValueByKeyWithBinding(ctx context.Context, key string, result interface{}) error {
|
func (s Server) GetValueByKeyWithBindData(ctx context.Context, key string, result interface{}) error {
|
||||||
v := s.GetValueByKey(ctx, key)
|
v := s.GetValueByKey(ctx, key)
|
||||||
if v == "" {
|
if v == "" {
|
||||||
return errors.New("key not found")
|
return errors.New("key not found")
|
||||||
}
|
}
|
||||||
return json.Unmarshal([]byte(v), result)
|
return json.Unmarshal([]byte(v), &result)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue