gobeanstalk icon indicating copy to clipboard operation
gobeanstalk copied to clipboard

About yaml-parse

Open slayercat opened this issue 9 years ago • 1 comments

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?

  1. provides a new api, which returns a dict.
parsed_item, err := beanstalkc_conn.StatsTube_Parsed("default")
  1. 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.

  1. 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.

  2. use https://github.com/go-yaml/yaml A huge but seems well-tested library

slayercat avatar Aug 14 '15 04:08 slayercat

@slayercat thanks for this. I will check it over the weekend. Very busy this last 2 weeks.

iwanbk avatar Aug 21 '15 10:08 iwanbk