diff --git a/templates/03_finishers.tpl b/templates/03_finishers.tpl index 429a276..0cc7e78 100644 --- a/templates/03_finishers.tpl +++ b/templates/03_finishers.tpl @@ -45,7 +45,7 @@ func (q {{$varNameSingular}}Query) AllP() {{$tableNameSingular}}Slice { // All returns all {{$tableNameSingular}} records from the query. func (q {{$varNameSingular}}Query) All() ({{$tableNameSingular}}Slice, error) { - var o {{$tableNameSingular}}Slice + var o []*{{$tableNameSingular}} err := q.Bind(&o) if err != nil { diff --git a/templates/07_relationship_to_one_eager.tpl b/templates/07_relationship_to_one_eager.tpl index 4af84ca..dd1481a 100644 --- a/templates/07_relationship_to_one_eager.tpl +++ b/templates/07_relationship_to_one_eager.tpl @@ -5,7 +5,6 @@ {{- $txt := txtsFromFKey $dot.Tables $dot.Table . -}} {{- $varNameSingular := $dot.Table.Name | singular | camelCase -}} {{- $arg := printf "maybe%s" $txt.LocalTable.NameGo -}} - {{- $slice := printf "%sSlice" $txt.LocalTable.NameGo}} // Load{{$txt.Function.Name}} allows an eager lookup of values, cached into the // loaded structs of the objects. func ({{$varNameSingular}}L) Load{{$txt.Function.Name}}(e boil.Executor, singular bool, {{$arg}} interface{}) error { @@ -16,7 +15,7 @@ func ({{$varNameSingular}}L) Load{{$txt.Function.Name}}(e boil.Executor, singula if singular { object = {{$arg}}.(*{{$txt.LocalTable.NameGo}}) } else { - slice = *{{$arg}}.(*{{$slice}}) + slice = *{{$arg}}.(*[]*{{$txt.LocalTable.NameGo}}) count = len(slice) } diff --git a/templates/08_relationship_one_to_one_eager.tpl b/templates/08_relationship_one_to_one_eager.tpl index 7363b69..37d1af0 100644 --- a/templates/08_relationship_one_to_one_eager.tpl +++ b/templates/08_relationship_one_to_one_eager.tpl @@ -5,7 +5,6 @@ {{- $txt := txtsFromOneToOne $dot.Tables $dot.Table . -}} {{- $varNameSingular := $dot.Table.Name | singular | camelCase -}} {{- $arg := printf "maybe%s" $txt.LocalTable.NameGo -}} - {{- $slice := printf "%sSlice" $txt.LocalTable.NameGo}} // Load{{$txt.Function.Name}} allows an eager lookup of values, cached into the // loaded structs of the objects. func ({{$varNameSingular}}L) Load{{$txt.Function.Name}}(e boil.Executor, singular bool, {{$arg}} interface{}) error { @@ -16,7 +15,7 @@ func ({{$varNameSingular}}L) Load{{$txt.Function.Name}}(e boil.Executor, singula if singular { object = {{$arg}}.(*{{$txt.LocalTable.NameGo}}) } else { - slice = *{{$arg}}.(*{{$slice}}) + slice = *{{$arg}}.(*[]*{{$txt.LocalTable.NameGo}}) count = len(slice) } diff --git a/templates/09_relationship_to_many_eager.tpl b/templates/09_relationship_to_many_eager.tpl index f1a7f5d..1603188 100644 --- a/templates/09_relationship_to_many_eager.tpl +++ b/templates/09_relationship_to_many_eager.tpl @@ -5,7 +5,6 @@ {{- $varNameSingular := $dot.Table.Name | singular | camelCase -}} {{- $txt := txtsFromToMany $dot.Tables $dot.Table . -}} {{- $arg := printf "maybe%s" $txt.LocalTable.NameGo -}} - {{- $slice := printf "%sSlice" $txt.LocalTable.NameGo -}} {{- $schemaForeignTable := .ForeignTable | $dot.SchemaTable}} // Load{{$txt.Function.Name}} allows an eager lookup of values, cached into the // loaded structs of the objects. @@ -17,7 +16,7 @@ func ({{$varNameSingular}}L) Load{{$txt.Function.Name}}(e boil.Executor, singula if singular { object = {{$arg}}.(*{{$txt.LocalTable.NameGo}}) } else { - slice = *{{$arg}}.(*{{$slice}}) + slice = *{{$arg}}.(*[]*{{$txt.LocalTable.NameGo}}) count = len(slice) } diff --git a/templates_test/relationship_one_to_one.tpl b/templates_test/relationship_one_to_one.tpl index 4e253e5..27c13ef 100644 --- a/templates_test/relationship_one_to_one.tpl +++ b/templates_test/relationship_one_to_one.tpl @@ -50,7 +50,7 @@ func test{{$txt.LocalTable.NameGo}}OneToOne{{$txt.ForeignTable.NameGo}}Using{{$t } slice := {{$txt.LocalTable.NameGo}}Slice{&local} - if err = local.L.Load{{$txt.Function.Name}}(tx, false, &slice); err != nil { + if err = local.L.Load{{$txt.Function.Name}}(tx, false, (*[]*{{$txt.LocalTable.NameGo}})(&slice)); err != nil { t.Fatal(err) } if local.R.{{$txt.Function.Name}} == nil { diff --git a/templates_test/relationship_to_many.tpl b/templates_test/relationship_to_many.tpl index 0080688..0402609 100644 --- a/templates_test/relationship_to_many.tpl +++ b/templates_test/relationship_to_many.tpl @@ -87,7 +87,7 @@ func test{{$txt.LocalTable.NameGo}}ToMany{{$txt.Function.Name}}(t *testing.T) { } slice := {{$txt.LocalTable.NameGo}}Slice{&a} - if err = a.L.Load{{$txt.Function.Name}}(tx, false, &slice); err != nil { + if err = a.L.Load{{$txt.Function.Name}}(tx, false, (*[]*{{$txt.LocalTable.NameGo}})(&slice)); err != nil { t.Fatal(err) } if got := len(a.R.{{$txt.Function.Name}}); got != 2 { diff --git a/templates_test/relationship_to_one.tpl b/templates_test/relationship_to_one.tpl index 3c66bf7..e95c61a 100644 --- a/templates_test/relationship_to_one.tpl +++ b/templates_test/relationship_to_one.tpl @@ -50,7 +50,7 @@ func test{{$txt.LocalTable.NameGo}}ToOne{{$txt.ForeignTable.NameGo}}Using{{$txt. } slice := {{$txt.LocalTable.NameGo}}Slice{&local} - if err = local.L.Load{{$txt.Function.Name}}(tx, false, &slice); err != nil { + if err = local.L.Load{{$txt.Function.Name}}(tx, false, (*[]*{{$txt.LocalTable.NameGo}})(&slice)); err != nil { t.Fatal(err) } if local.R.{{$txt.Function.Name}} == nil {