Merge branch 'master' of github.com:nullbio/sqlboiler

This commit is contained in:
Patrick O'brien 2016-07-17 13:33:49 +10:00
commit 20ce662a67
4 changed files with 7 additions and 8 deletions

View file

@ -152,6 +152,5 @@ var templateFunctions = template.FuncMap{
"columnNames": bdb.ColumnNames,
"columnTypes": bdb.ColumnTypes,
"columnDBTypes": bdb.ColumnDBTypes,
"toManyRelationships": bdb.ToManyRelationships,
"defaultValues": bdb.DefaultValues,
}

View file

@ -2,7 +2,7 @@
{{- else -}}
{{- $dot := . }}
{{- $table := .Table }}
{{- range toManyRelationships .Table.Name .Tables -}}
{{- range .Table.ToManyRelationships -}}
{{- $rel := textsFromRelationship $dot.Tables $table . -}}
// {{$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}}.

View file

@ -2,7 +2,7 @@
{{- else -}}
{{- $dot := . }}
{{- $table := .Table }}
{{- range toManyRelationships .Table.Name .Tables -}}
{{- range .Table.ToManyRelationships -}}
{{- $rel := textsFromRelationship $dot.Tables $table . -}}
func Test{{$rel.LocalTable.NameGo}}ToMany{{$rel.Function.Name}}(t *testing.T) {
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 */ -}}

View file

@ -113,7 +113,7 @@ func TestTextsFromRelationship(t *testing.T) {
expect.ForeignTable.NameSingular = "video"
expect.ForeignTable.NamePluralGo = "Videos"
expect.ForeignTable.NameHumanReadable = "videos"
expect.ForeignTable.Slice = "videoSlice"
expect.ForeignTable.Slice = "VideoSlice"
expect.Function.Name = "Videos"
expect.Function.Receiver = "u"
@ -133,7 +133,7 @@ func TestTextsFromRelationship(t *testing.T) {
expect.ForeignTable.NameSingular = "notification"
expect.ForeignTable.NamePluralGo = "Notifications"
expect.ForeignTable.NameHumanReadable = "notifications"
expect.ForeignTable.Slice = "notificationSlice"
expect.ForeignTable.Slice = "NotificationSlice"
expect.Function.Name = "Notifications"
expect.Function.Receiver = "u"
@ -153,7 +153,7 @@ func TestTextsFromRelationship(t *testing.T) {
expect.ForeignTable.NameSingular = "notification"
expect.ForeignTable.NamePluralGo = "Notifications"
expect.ForeignTable.NameHumanReadable = "notifications"
expect.ForeignTable.Slice = "notificationSlice"
expect.ForeignTable.Slice = "NotificationSlice"
expect.Function.Name = "SourceNotifications"
expect.Function.Receiver = "u"
@ -173,7 +173,7 @@ func TestTextsFromRelationship(t *testing.T) {
expect.ForeignTable.NameSingular = "video"
expect.ForeignTable.NamePluralGo = "Videos"
expect.ForeignTable.NameHumanReadable = "videos"
expect.ForeignTable.Slice = "videoSlice"
expect.ForeignTable.Slice = "VideoSlice"
expect.Function.Name = "Videos"
expect.Function.Receiver = "u"