I found this article by Nick Gauthier from 2016.  
https://www.meetspaceapp.com/2016/05/23/writing-a-data-mapper-in-go-without-an-orm.html.
  
The original idea is contributed to Martin Fowler.

Someone else has solved this problem before.  

On Friday, September 7, 2012 at 4:45:07 PM UTC-4, Paddy Foran wrote:
>
> Consider the following: 
>
> In package fmt: func Println(a …interface{})
>
> One would think the following code would work:
>
> func main() {
> testslice := []string { "this", "is", "a", "test" }
> fmt.Println(testslice…)
> }
>
> One would subsequently be met with "cannot use testslice (type []string) 
> as type []interface {} in function argument" (
> http://play.golang.org/p/H3349TDJnS)
>
> On the other hand, if one were to try:
>
> func print(words …string) {
> for _, word := range words {
> fmt.Printf("%s", word)
> }
> }
>
> func main() {
> testslice := []string { "this", "is", "a", "test" }
> print(testslice…)
> }
>
> Everything works as expected (http://play.golang.org/p/1ZnIwge19V). Can 
> anyone explain why the empty interface in variadic parameters prevents me 
> from using argument expansion?
>
> God, I hope I used the right names for all these things.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/47536abf-c826-4b11-ad21-6435cc5d9ad7%40googlegroups.com.

Reply via email to