{{- if .Table.IsJoinTable -}} {{- else -}} {{- $dot := . -}} {{- $table := .Table -}} {{- range .Table.ToManyRelationships -}} {{- $varNameSingular := .ForeignTable | singular | camelCase -}} {{- if (and .ForeignColumnUnique (not .ToJoinTable)) -}} {{- template "relationship_to_one_setops_helper" (textsFromOneToOneRelationship $dot.PkgName $dot.Tables $table .) -}} {{- else -}} {{- $rel := textsFromRelationship $dot.Tables $table .}} // Add{{$rel.Function.Name}} adds the given related objects to the existing relationships // of the {{$table.Name | singular}}, optionally inserting them as new records. // Appends related to R.{{$rel.Function.Name}}. func ({{$rel.Function.Receiver}} *{{$rel.LocalTable.NameGo}}) Add{{$rel.Function.Name}}(exec boil.Executor, insert bool, related ...*{{$rel.ForeignTable.NameGo}}) error { return nil } {{- if .ForeignColumnNullable}} // Set{{$rel.Function.Name}} removes all previously related items of the // {{$table.Name | singular}} replacing them completely with the passed // in related items, optionally inserting them as new records. // Replaces R.{{$rel.Function.Name}} with related. func ({{$rel.Function.Receiver}} *{{$rel.LocalTable.NameGo}}) Set{{$rel.Function.Name}}(exec boil.Executor, insert bool, related ...*{{$rel.ForeignTable.NameGo}}) error { return nil } // Remove{{$rel.Function.Name}} relationships from objects passed in. // Removes related items from R.{{$rel.Function.Name}}. func ({{$rel.Function.Receiver}} *{{$rel.LocalTable.NameGo}}) Remove{{$rel.Function.Name}}(exec boil.Executor, related ...*{{$rel.ForeignTable.NameGo}}) error { return nil } {{end -}} {{- end -}}{{- /* if unique foreign key */ -}} {{- end -}}{{- /* range relationships */ -}} {{- end -}}{{- /* outer if join table */ -}}