1

Go言語を使用してデータストアにエンティティを追加します。すべてのエンティティをクエリできますが、キーごとにエンティティを取得する方法、エンティティのキ​​ーを取得する方法、および次のようにキーごとにクエリを実行する方法:select * from Blog where key =?

c := appengine.NewContext(r)
g := Blog{
Title: r.FormValue("title"),
    Content: r.FormValue("content"),
}
_, err := datastore.Put(c, datastore.NewIncompleteKey(c, "Blog", nil), &g)

ありがとう

4

1 に答える 1

2

Go ランタイムのデータストア ドキュメントを参照してください。

var b Blog
err := datastore.Get(c, key, &b)
于 2012-06-06T15:45:32.673 に答える