title: Unable to get the record based on struct value from datastore using golang
body: <p>I am writing a service for search functionality.  when i am passing values in the body to get the specific record i am unable to get it based on the struct value.
  ex:phone number or username</p>
  
  <p><strong>Edit1:</strong></p>
  
  <pre><code>type PatientData struct {
      ID            int64    datastore:"-"
      FirstName     string   json:"firstname,omitempty"
      LastName      string   json:"lastname,omitempty"
      UserName      string   json:"username,omitempty"
      Phone         string   json:"phone,omitempty"     
  }
  </code></pre>
  
  <p>I want to get the full struct values based on Username or Phone. Below is  my code:</p>
  
  <pre><code>func searchValue (res http.ResponseWriter, req *http.Request){
  
      log.Printf("%#v Getting values url - x ", "called search")
  
      patient := &amp;PatientData{}
      if err := json.NewDecoder(req.Body).Decode(patient); err != nil {
          panic(err)
      }
      ctx := appengine.NewContext(req)
      ctx, err := appengine.Namespace(ctx, NAMESPACENAME)
      if err != nil {
          panic(err)
      }
  
      m := patient.Phone
      i, err := strconv.ParseInt(m, 10, 64)
      log.Printf("%#v Getting values m ", m)
      log.Printf("%#v Getting values url -yyy ",i)
  
      key := datastore.NewKey(ctx, "Patient","" , i, nil)
      log.Printf("%#v Getting values url - key ", key)
      err = datastore.Get(ctx, key, patient)
      if err := json.NewEncoder(res).Encode(patient); err != nil {
          panic(err)
      }
  
  }
  </code></pre>
  
  <p>As i am passing PHONE in my Newkey i am unable to generate  the values based on PHONE</p>
  
  <p>I don't want to use Newkey in put functionality to generate a keyname and based on that KEYNAME i dont want to get Values.</p>