通过ID获取实体

I am using gorilla mux for my routes and I pass an id.

Using that Id how can I get a entity from datastore.

param := mux.Vars(r)
c := appengine.NewContext(r)
item := []Item{}
pr, err := datastore.NewQuery("Item").Filter("ID = ", param["id"]).GetAll(c, &item)

And here I'm stuck, I tried using filter but it doesn't work.

What do I have to do next?

You don't say if you are using integer or string ids for entities. I'll assume integer because it requires a little more code. First, create a key:

 n, err := strconv.ParseInt(param["id"], 10, 64)
 if err != nil {
    // handle error
 }
 key := datastore.NewKey(c, "Item", "", n, nil)

Now that you have key, you can fetch the entity:

 var item Item
 if err := datastore.Get(c, key, &item); err != nil {
     // handle error
 }

It's more efficient to get the entity than to query for the entity. If you do want to query by id, then see key filters in the App Engine docs.

If you have an id, you don't need to use a query. A faster and cheaper way is to create a key and retrieve this entity directly from the Datastore.

https://cloud.google.com/appengine/docs/go/datastore/entities#Go_Retrieving_an_entity