Indexの数は考慮されず、操作したEntityの数のみがカウントされるように変更
Entity Reads : $0.06 per 100,000 entities Entity Writes : $0.18 per 100,000 entities Entity Deletes : $0.02 per 100,000 entities
type User struct { ID int // key value AccountName string NickName string Email string // uniqueにするのが難しい } // Login時に利用するKind type EmailToUser struct { Email string // key value UserID int Password string }
q := datastore.NewQuery("Item").Order("-UpdatedAt").Limit(limit) if len(cursorParam) > 0 { cursor, err := datastore.DecodeCursor(cursorParam) if err == nil { q = q.Start(cursor) } }
q := datastore.NewQuery("Item").KeysOnly()
type Item struct { Title string `json:"title" datastore:",noindex"` }
type Item struct { KeyStr string `json:"key" datastore:"-"` Title string `json:"title" datastore:",noindex"` Category string `json:"category"` DelFlg bool `json:"delFlg"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
type Item struct { KeyStr string `json:"key" datastore:"-"` Title string `json:"title" datastore:",noindex"` Category string `json:"category"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
for key := range keys { err := datastore.Get(ctx, key, dst) }
err := datastore.GetMulti(ctx, keys, dst)
集計はputされる時に、やることが多い。
var entries []Entry var comments []Comment var friends []Friend var footprint []Footprint _, err := datastore.NewQuery("Entry").GetAll(ctx, &entries) _, err = datastore.NewQuery("Comment").GetAll(ctx, &comments) _, err = datastore.NewQuery("Friend").GetAll(ctx, &friends) _, err = datastore.NewQuery("Footprint").GetAll(ctx, &footprint)
var entries []Entry var comments []Comment var friends []Friend var footprint []Footprint errc := make(chan error) go func() { _, err := datastore.NewQuery("Entry").GetAll(ctx, &entries) errc <- err }() go func() { _, err := datastore.NewQuery("Comment").GetAll(ctx, &comments) errc <- err }() go func() { _, err := datastore.NewQuery("Friend").GetAll(ctx, &friends) errc <- err }() go func() { _, err := datastore.NewQuery("Footprint").GetAll(ctx, &footprint) errc <- err }() err1, err2, err3, err4 := <-errc, <-errc, <-errc, <-errc
datastore.NewKey(c, "Item", fmt.Sprintf("%s-_-%s-_-%s", uuid.New(), title, category) , 0, nil)
Google Cloud Platform Training
YAPC Asia 2015「Google Cloud Platformの謎テクノロジーを掘り下げる」のまとめ
TOPGATE GAEマイスター