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
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue