How to return dynamic type struct in Golang?
<p>I am using Golang Revel for some web project and I did like 12 projects in that so far. In all of them I have a lot of code redundancy because of return types. Look at this two functions:</p>

<pre><code>func (c Helper) Brands() []*models.Brand{

    //do some select on rethinkdb and populate correct model
    var brands []*models.Brand
    rows.All(&amp;brands)

    return brands

}

func (c Helper) BlogPosts() []*models.Post{

    //do some select on rethinkdb and populate correct model
    var posts []*models.Post
    rows.All(&amp;posts)

    return posts

}
</code></pre>

<p>As you can see they they both returns same type of data (type struct).
My idea was just to pass string var like this:</p>

<pre><code>func (c Helper) ReturnModels(modelName string) []*interface{} {

    //do rethinkdb select with modelName and return []*interface{} for modelName
}
</code></pre>

<p>Like this I can have just one helper for returning data types instead of
doing same thing over and over again for different models but same data type.</p>

<p>My questions are:</p>

<ol>
<li>Is this possible at all</li>
<li>If yes can you point me to right docs</li>
<li>If no, I will be more then happy to return your answer :)</li>
</ol>