通过字符串制作Google App Engine数据存储区密钥

通过字符串制作Google App Engine数据存储区密钥,第1张

通过字符串制作Google App Engine数据存储区密钥
c := appengine.NewContext(r)//Retrieve the entity ID from the submitted form. Convert to an int64entity_id := r.FormValue("entity_id")entity_id_int, err := strconv.ParseInt(entity_id, 10, 64) if err != nil {  fmt.Fprint(w, "Unable to parse key")  return;}//We manufacture a datastore key based on the Kind and the //entity ID (passed to us via the HTTP request parameter.key := datastore.NewKey(c, kind, "", entity_id_int, nil)//Load the Entity this key represents.//We have to state the variable first, then conduct the Get operation //so the datastore understands the struct representing the entity.var entity CustomStructdatastore.Get(c, key, &entity)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5476586.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-12
下一篇 2022-12-12

发表评论

登录后才能评论

评论列表(0条)

保存