Index: service/datastore/properties.go |
diff --git a/service/datastore/properties.go b/service/datastore/properties.go |
index 63156fe68da97b5f7ddf9f4c4600aa2c53861d49..672fdbabac68d37f90a2c18a84cf70c2cf6291f2 100644 |
--- a/service/datastore/properties.go |
+++ b/service/datastore/properties.go |
@@ -112,7 +112,7 @@ type PropertyType byte |
// https://cloud.google.com/appengine/docs/go/datastore/entities#Go_Value_type_ordering |
// with a slight divergence for the Int/Time split. |
// NOTE: this enum can only occupy 7 bits, because we use the high bit to encode |
-// indexed/non-indexed. See typData.WriteBinary. |
+// indexed/non-indexed. See serialize.WriteProperty. |
const ( |
PTNull PropertyType = iota |
PTInt |
@@ -146,9 +146,19 @@ const ( |
PTKey |
PTBlobKey |
+ // NOTE: THIS MUST BE LAST VALUE FOR THE init() ASSERTION BELOW TO WORK. |
PTUnknown |
) |
+func init() { |
+ if PTUnknown > 0x7f { |
dnj (Google)
2015/08/23 06:50:07
IMO put this check in "serialize", as it owns the
iannucci
2015/08/23 18:19:43
It's better here. There are actually 2 modules tha
|
+ panic( |
+ "PTUnknown (and therefore PropertyType) exceeds 0x7f. This conflicts " + |
+ "with serialize.WriteProperty's use of the high bit to indicate " + |
+ "NoIndex.") |
+ } |
+} |
+ |
func (t PropertyType) String() string { |
switch t { |
case PTNull: |