go - Is it possible for Google App Engine string and integer datastore keys to clash? -
this question has answer here:
- can use allocateids “string” ? datastore 3 answers
i have datastore entity of kind myentity
, want use stringid
keys , other times use intid
keys generated allocateids
.
can safely mix string , integer ids without worrying string id might surreptitiously overwrite integer id generated allocateids
, vice versa?
the reason ask because assume string , integer ids use same index. possible accidentally have sequence of bytes represent string id same sequence of bytes represent integer id on same index? or string , integer ids namespaced in way prevent collisions?
yes, can safely mix string & int ids same kind - same key (entity) can not use both @ same time. there no danger of overlapping. guess under hood use protocol buffers serialize key []byte
.
i used in production without issues.
though maybe not best design depends on case.
Comments
Post a Comment