Beispiel #1
0
func (d *dataStoreData) fixKeyLocked(ents *memCollection, key *ds.Key) (*ds.Key, error) {
	if key.Incomplete() {
		id, err := d.allocateIDsLocked(ents, key, 1)
		if err != nil {
			return key, err
		}
		key = ds.NewKey(key.AppID(), key.Namespace(), key.Kind(), "", id, key.Parent())
	}
	return key, nil
}
Beispiel #2
0
// PartialValid returns true iff this key is suitable for use in a Put
// operation. This is the same as Valid(k, false, ...), but also allowing k to
// be Incomplete().
func PartialValid(k ds.Key, aid, ns string) bool {
	if k.Incomplete() {
		k = New(k.AppID(), k.Namespace(), k.Kind(), "", 1, k.Parent())
	}
	return Valid(k, false, aid, ns)
}