Golang示例不适用于添加Activity

时间:2016-11-14 20:33:31

标签: go getstream-io

我试图让这个工作起来越来越沮丧。我已经使用了文档中的示例,但是它们会抛出错误。

特别是这个字段:

To: [&UserFeed]

引发此错误:

does not compile: expected type, found ','

以下是代码段:

getstream_client, err := getstream.New(&getstream.Config{
    APIKey:      os.Getenv("STREAM_API_KEY"),
    APISecret:   os.Getenv("STREAM_API_SECRET"),
    AppID:       os.Getenv("STREAM_APP_ID"),
    Location:    "us-west",
  })
  if err != nil {
    log.Println("ERR :", err)
  }

    UserFeed, err := getstream_client.FlatFeed("user", u.StreamId)
    if err != nil {
        return err
    }
    GlobalFeed, err := getstream_client.FlatFeed("user", "global")
    if err != nil {
        return err
    }
    activity := &getstream.Activity{
        Actor: UserFeed.FeedID(),
        ForeignID: uuid.New(),
        To: [&UserFeed],
        Verb: "attempt",
    };
    activity, err = GlobalFeed.AddActivity(activity);
    if err != nil {
        return err
    }

1 个答案:

答案 0 :(得分:2)

TO字段应如下所示。希望这有助于某人:

"SELECT * FROM TABLE WHERE ..."