我无法弄清楚如何打电话cloud.WithContext,google.DefaultClient如果我有appengine.Context,不知道context.Context.
有(旧)"appengine"和(新)"google.golang.org/appengine"包.第一个自定义带来了appengine.Context当第二个带有context.Context从"golang.org/x/net/context"
整体google.golang.org/cloud预期context.Context.
我很乐意转向使用新的"google.golang.org/appengine",但我坚持使用runtime.RunInBackground尚未移植的.来自https://github.com/golang/appengine:
appengine/aetest,appengine/cloudsql并且appengine/runtime还没有被移植.
如果appengine/runtime已经移植了我可以写的东西:
import (
"golang.org/x/net/context"
"google.golang.org/appengine"
"google.golang.org/appengine/runtime"
"google.golang.org/cloud"
"google.golang.org/cloud/storage"
)
func handler(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
runtime.RunInBackground(c, func(ctx context.Context) {
hc, _ := google.DefaultClient(ctx, storage.ScopeFullControl)
cc := cloud.WithContext(ctx, appengine.AppID(ctx), hc)
…
})
}
Run Code Online (Sandbox Code Playgroud)
但还没有"google.golang.org/appengine/runtime".所以我有
runtime.RunInBackground(c, func(ctx appengine.Context) {
Run Code Online (Sandbox Code Playgroud) 我希望 JOOQ 生成... in (?)并绑定列表作为数组参数(Postgres)。我的代码看起来像
.where(
Tables.TABLE.FIELD.in(idsList)
)
Run Code Online (Sandbox Code Playgroud)
in (?, ?, ?, ?, ...)