// GetRepo will fetch the data about the repo from the database. // If the repo exist, return the RepoInfo populated // If the repo doesn't exist in the database, return Repo with Exist = false // Return an error only if something unexepected happened. func (db Datastore) GetRepo(repo string) (github.RepoInfo, *datastore.Key, error) { var repoInfo github.RepoInfo key := new(datastore.Key) q := datastore.NewQuery(kind).Ancestor(repoInfoKey(db.Context)).Filter("Name =", repo) for t := q.Run(db.Context); ; { var info github.RepoInfo var err error key, err = t.Next(&info) if err == datastore.Done { break } if err != nil { return repoInfo, nil, err } repoInfo = info repoInfo.SetExist(true) } return repoInfo, key, nil }