Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7736145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:40:24+00:00 2026-06-01T07:40:24+00:00

Here is an Example of the app. The essential code is in: golang-code/handler/handler.go (After

  • 0

Here is an Example of the app. The essential code is in: golang-code/handler/handler.go (After the subject should appear an ID!)

Im trying to build a little blog system in Golang on Google Appengine and use Mustache as template engine.

So, i have a struct:

type Blogposts struct {
    PostTitle   string
    PostPreview string
    Content     string
    Creator     string
    Date        time.Time
}

The data is passed to GAE via

    datastore.Put(c, datastore.NewIncompleteKey(c, "Blogposts", nil), &blogposts)

So, GAE assigns automatically a intID (int64).
Now I tried to get the latest blogposts

// Get the latest blogposts
c := appengine.NewContext(r)
q := datastore.NewQuery("Blogposts").Order("-Date").Limit(10)

var blogposts []Blogposts
_, err := q.GetAll(c, &blogposts)

Until there all things works fine, but when I try to access intID (or stringID, whatever) I dont have access to this 🙁

<h3><a href="/blog/read/{{{intID}}}">{{{PostTitle}}}</a></h3>

(PostTitle works, intID not, i’ve tried thousand of things, nothing worked 🙁 )

Anyone an idea? This would be great!

Edit:
I use mustache.

http://mustache.github.com/

In the code I use:

x["Blogposts"] = blogposts
data := mustache.RenderFile("templates/about.mustache", x)
sendData(w, data) // Equivalent to fmt.Fprintf

And then the data can be accessed in the .mustache template with {{{Content}}} or {{{PostTitle}}} etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:40:25+00:00Added an answer on June 1, 2026 at 7:40 am

    intID is an internal property of a Key not the struct, and is accessible through a getter:

    id := key.IntID()
    

    GetAll returns []*Key, which you’re not using:

    _, err := q.GetAll(c, &blogposts)
    

    One way to get around this is to create a viewmodel struct that has both your post and key info (untested, but this is the gist of it):

      //... handler code ...
    
      keys, err := q.GetAll(c, &blogposts)
      if err != nil {
        http.Error(w, "Problem fetching posts.", http.StatusInternalServerError)
        return
      }
    
      models := make([]BlogPostVM, len(blogposts))
      for i := 0; i < len(blogposts); i++ {
        models[i].Id = keys[i].IntID()
        models[i].Title = blogposts[i].Title
        models[i].Content = blogposts[i].Content
      }
    
      //... render with mustache ...
    }
    
    type BlogPostVM struct {
      Id int
      Title string
      Content string
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build an example app in Google App Engine using django-nonrel.
Here's an example of PTT app https://itunes.apple.com/us/app/iptt-push-to-talk/id311931218?mt=8 I just wondered how it works ?
I am using the MWFeedParser (found here: https://github.com/mwaterfall/MWFeedParser ). I followed his example app,
I've used JRab's example here http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/App-specific-system-menu/td-p/693 ... to add a header menu to my
I am creating an application based on the Speak Here example app . I
Trying to create a todo example app to mess around with backbone. I cannot
The output I'm getting for my little example app is the following: Welcome to
Here an example http://jsfiddle.net/EhLsT/ $(window).scroll(function () { if ($(window).scrollTop() > $(#header).offset().top) { $(#floating).show(); }
Here is example which I have try <?php include 'spider/classes/simple_html_dom.php'; $html = new simple_html_dom();
Here an example http://jsfiddle.net/7aVXc/ Let' say current image height is 400px . How do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.