func dsR2FProp(in datastore.Property) (ds.Property, error) { val := in.Value switch x := val.(type) { case datastore.ByteString: val = []byte(x) case *datastore.Key: val = dsR2F(x) case appengine.BlobKey: val = bs.Key(x) case appengine.GeoPoint: val = ds.GeoPoint(x) case time.Time: // "appengine" layer instantiates with Local timezone. if x.IsZero() { val = time.Time{} } else { val = x.UTC() } default: val = maybeIndexValue(val) } ret := ds.Property{} is := ds.ShouldIndex if in.NoIndex { is = ds.NoIndex } err := ret.SetValue(val, is) return ret, err }
func (tf *typeFilter) Load(props []datastore.Property) error { tf.pm = make(ds.PropertyMap, len(props)) for _, p := range props { val := p.Value switch x := val.(type) { case datastore.ByteString: val = []byte(x) case *datastore.Key: val = dsR2F(x) case appengine.BlobKey: val = bs.Key(x) case appengine.GeoPoint: val = ds.GeoPoint(x) case time.Time: // "appengine" layer instantiates with Local timezone. val = x.UTC() default: val = maybeIndexValue(val) } prop := ds.Property{} is := ds.ShouldIndex if p.NoIndex { is = ds.NoIndex } if err := prop.SetValue(val, is); err != nil { return err } tf.pm[p.Name] = append(tf.pm[p.Name], prop) } return nil }