gobeanstalk
gobeanstalk copied to clipboard
About yaml-parse
We now have stats
, stats-job
, stats-tube.
which returns yaml strings.
But from a user perspective, we do not want to deal with yaml. We want data wraped in yaml, not yaml itself.
To achieve this, I have API modification related problem and Implementation-related problem
API modification related problem
Which one looks good to you?
- provides a new api, which returns a dict.
parsed_item, err := beanstalkc_conn.StatsTube_Parsed("default")
- Modify the existing API definition. 2a)
parsed_item, err := beanstalkc_conn.StatsTube("default", func(_ string) map[string]interface{} {
panic("do something")
})
2b)
parsed_item, err:= beanstalkc_conn.StatsTube("default")
Implementation-related problem
Which one looks good to you?
Of course. If you prefer 2a, we can leave this to users to decide.
-
use https://github.com/kr/beanstalk/blob/master/parse.go This will not have any dependence introduced. and since kr used that, It shall looks good to us.
-
use https://github.com/go-yaml/yaml A huge but seems well-tested library
@slayercat thanks for this. I will check it over the weekend. Very busy this last 2 weeks.