Merge branch 'master' of github.com:nullbio/sqlboiler
This commit is contained in:
commit
20ce662a67
4 changed files with 7 additions and 8 deletions
|
@ -152,6 +152,5 @@ var templateFunctions = template.FuncMap{
|
||||||
"columnNames": bdb.ColumnNames,
|
"columnNames": bdb.ColumnNames,
|
||||||
"columnTypes": bdb.ColumnTypes,
|
"columnTypes": bdb.ColumnTypes,
|
||||||
"columnDBTypes": bdb.ColumnDBTypes,
|
"columnDBTypes": bdb.ColumnDBTypes,
|
||||||
"toManyRelationships": bdb.ToManyRelationships,
|
|
||||||
"defaultValues": bdb.DefaultValues,
|
"defaultValues": bdb.DefaultValues,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $dot := . }}
|
{{- $dot := . }}
|
||||||
{{- $table := .Table }}
|
{{- $table := .Table }}
|
||||||
{{- range toManyRelationships .Table.Name .Tables -}}
|
{{- range .Table.ToManyRelationships -}}
|
||||||
{{- $rel := textsFromRelationship $dot.Tables $table . -}}
|
{{- $rel := textsFromRelationship $dot.Tables $table . -}}
|
||||||
// {{$rel.Function.Name}} retrieves all the {{$rel.LocalTable.NameSingular}}'s {{$rel.ForeignTable.NameHumanReadable}}
|
// {{$rel.Function.Name}} retrieves all the {{$rel.LocalTable.NameSingular}}'s {{$rel.ForeignTable.NameHumanReadable}}
|
||||||
{{- if not (eq $rel.Function.Name $rel.ForeignTable.NamePluralGo)}} via {{.ForeignColumn}} column{{- end}}.
|
{{- if not (eq $rel.Function.Name $rel.ForeignTable.NamePluralGo)}} via {{.ForeignColumn}} column{{- end}}.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $dot := . }}
|
{{- $dot := . }}
|
||||||
{{- $table := .Table }}
|
{{- $table := .Table }}
|
||||||
{{- range toManyRelationships .Table.Name .Tables -}}
|
{{- range .Table.ToManyRelationships -}}
|
||||||
{{- $rel := textsFromRelationship $dot.Tables $table . -}}
|
{{- $rel := textsFromRelationship $dot.Tables $table . -}}
|
||||||
func Test{{$rel.LocalTable.NameGo}}ToMany{{$rel.Function.Name}}(t *testing.T) {
|
func Test{{$rel.LocalTable.NameGo}}ToMany{{$rel.Function.Name}}(t *testing.T) {
|
||||||
var err error
|
var err error
|
||||||
|
@ -75,5 +75,5 @@ func Test{{$rel.LocalTable.NameGo}}ToMany{{$rel.Function.Name}}(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{ end -}}{{- /* range */ -}}
|
{{end -}}{{- /* range */ -}}
|
||||||
{{- end -}}{{- /* outer if join table */ -}}
|
{{- end -}}{{- /* outer if join table */ -}}
|
||||||
|
|
|
@ -113,7 +113,7 @@ func TestTextsFromRelationship(t *testing.T) {
|
||||||
expect.ForeignTable.NameSingular = "video"
|
expect.ForeignTable.NameSingular = "video"
|
||||||
expect.ForeignTable.NamePluralGo = "Videos"
|
expect.ForeignTable.NamePluralGo = "Videos"
|
||||||
expect.ForeignTable.NameHumanReadable = "videos"
|
expect.ForeignTable.NameHumanReadable = "videos"
|
||||||
expect.ForeignTable.Slice = "videoSlice"
|
expect.ForeignTable.Slice = "VideoSlice"
|
||||||
|
|
||||||
expect.Function.Name = "Videos"
|
expect.Function.Name = "Videos"
|
||||||
expect.Function.Receiver = "u"
|
expect.Function.Receiver = "u"
|
||||||
|
@ -133,7 +133,7 @@ func TestTextsFromRelationship(t *testing.T) {
|
||||||
expect.ForeignTable.NameSingular = "notification"
|
expect.ForeignTable.NameSingular = "notification"
|
||||||
expect.ForeignTable.NamePluralGo = "Notifications"
|
expect.ForeignTable.NamePluralGo = "Notifications"
|
||||||
expect.ForeignTable.NameHumanReadable = "notifications"
|
expect.ForeignTable.NameHumanReadable = "notifications"
|
||||||
expect.ForeignTable.Slice = "notificationSlice"
|
expect.ForeignTable.Slice = "NotificationSlice"
|
||||||
|
|
||||||
expect.Function.Name = "Notifications"
|
expect.Function.Name = "Notifications"
|
||||||
expect.Function.Receiver = "u"
|
expect.Function.Receiver = "u"
|
||||||
|
@ -153,7 +153,7 @@ func TestTextsFromRelationship(t *testing.T) {
|
||||||
expect.ForeignTable.NameSingular = "notification"
|
expect.ForeignTable.NameSingular = "notification"
|
||||||
expect.ForeignTable.NamePluralGo = "Notifications"
|
expect.ForeignTable.NamePluralGo = "Notifications"
|
||||||
expect.ForeignTable.NameHumanReadable = "notifications"
|
expect.ForeignTable.NameHumanReadable = "notifications"
|
||||||
expect.ForeignTable.Slice = "notificationSlice"
|
expect.ForeignTable.Slice = "NotificationSlice"
|
||||||
|
|
||||||
expect.Function.Name = "SourceNotifications"
|
expect.Function.Name = "SourceNotifications"
|
||||||
expect.Function.Receiver = "u"
|
expect.Function.Receiver = "u"
|
||||||
|
@ -173,7 +173,7 @@ func TestTextsFromRelationship(t *testing.T) {
|
||||||
expect.ForeignTable.NameSingular = "video"
|
expect.ForeignTable.NameSingular = "video"
|
||||||
expect.ForeignTable.NamePluralGo = "Videos"
|
expect.ForeignTable.NamePluralGo = "Videos"
|
||||||
expect.ForeignTable.NameHumanReadable = "videos"
|
expect.ForeignTable.NameHumanReadable = "videos"
|
||||||
expect.ForeignTable.Slice = "videoSlice"
|
expect.ForeignTable.Slice = "VideoSlice"
|
||||||
|
|
||||||
expect.Function.Name = "Videos"
|
expect.Function.Name = "Videos"
|
||||||
expect.Function.Receiver = "u"
|
expect.Function.Receiver = "u"
|
||||||
|
|
Loading…
Reference in a new issue