OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // adapted from github.com/golang/appengine/datastore | 5 // adapted from github.com/golang/appengine/datastore |
6 | 6 |
7 package rawdatastore | 7 package datastore |
8 | 8 |
9 import ( | 9 import ( |
10 "bytes" | 10 "bytes" |
11 "encoding/base64" | 11 "encoding/base64" |
12 "errors" | 12 "errors" |
13 "strconv" | 13 "strconv" |
14 "strings" | 14 "strings" |
15 | 15 |
16 » pb "github.com/luci/gae/service/rawdatastore/internal/protos/datastore" | 16 » pb "github.com/luci/gae/service/datastore/internal/protos/datastore" |
17 | 17 |
18 "github.com/golang/protobuf/proto" | 18 "github.com/golang/protobuf/proto" |
19 ) | 19 ) |
20 | 20 |
21 // KeyEncode encodes the provided key as a base64-encoded protobuf. | 21 // KeyEncode encodes the provided key as a base64-encoded protobuf. |
22 // | 22 // |
23 // This encoding is compatible with the SDK-provided encoding and is agnostic | 23 // This encoding is compatible with the SDK-provided encoding and is agnostic |
24 // to the underlying implementation of the Key. | 24 // to the underlying implementation of the Key. |
25 func KeyEncode(k Key) string { | 25 func KeyEncode(k Key) string { |
26 n := 0 | 26 n := 0 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 for i := k; i != nil; i = i.Parent() { | 223 for i := k; i != nil; i = i.Parent() { |
224 n-- | 224 n-- |
225 toks[n].IntID = i.IntID() | 225 toks[n].IntID = i.IntID() |
226 toks[n].StringID = i.StringID() | 226 toks[n].StringID = i.StringID() |
227 toks[n].Kind = i.Kind() | 227 toks[n].Kind = i.Kind() |
228 } | 228 } |
229 appID = k.AppID() | 229 appID = k.AppID() |
230 namespace = k.Namespace() | 230 namespace = k.Namespace() |
231 return | 231 return |
232 } | 232 } |
OLD | NEW |