Skip to content

Commit

Permalink
feat(code-gen/go): add args to builder
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Nov 13, 2024
1 parent 74871e2 commit f60e895
Show file tree
Hide file tree
Showing 249 changed files with 2,417 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@ type ${type.name}Builder interface {
With<#if field.isOptionalField()>Optional</#if>${field.name?cap_first}Builder(func(${helper.getLanguageTypeNameForTypeReference(typeRef)}Builder)${helper.getLanguageTypeNameForTypeReference(typeRef)}Builder) ${type.name}Builder
</#if>
</#list>
<#if filteredParserArgumentsLocalToType?has_content>
<#list filteredParserArgumentsLocalToType as parserArgument>
// WithArg${parserArgument.name?cap_first} sets a parser argument
WithArg${parserArgument.name?cap_first}(${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}) ${type.name}Builder
</#list>
</#if>
<#if type.isAbstract()>
<#list type.switchField.orElseThrow().cases as case>
// As${case.name} converts this build to a subType of ${type.name}. It is always possible to return to current builder using Done()
Expand Down Expand Up @@ -453,6 +459,15 @@ func (b *_${type.name}Builder) With<#if field.isOptionalField()>Optional</#if>${
</#if>
</#list>

<#if filteredParserArgumentsLocalToType?has_content>
<#list filteredParserArgumentsLocalToType as parserArgument>
func (b *_${type.name}Builder) WithArg${parserArgument.name?cap_first}(${parserArgument.name} ${helper.getLanguageTypeNameForTypeReference(parserArgument.type)}) ${type.name}Builder {
b.${parserArgument.name?cap_first} = ${parserArgument.name}
return b
}
</#list>
</#if>

func (b *_${type.name}Builder) <#if type.isAbstract()>Partial</#if>Build() (${type.name}<#if type.isAbstract()>Contract</#if>,error) {
<#list type.propertyFields?filter(field->!field.isOptionalField()) as field>
<#if field.type.isComplexTypeReference() || helper.needsPointerAccess(field)>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions plc4go/protocols/abeth/readwrite/model/DF1ResponseMessage.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions plc4go/protocols/bacnetip/readwrite/model/APDU.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f60e895

Please sign in to comment.