github.com/go-swagger/go-swagger@v0.31.0/generator/templates/validation/multipleOf.gotmpl (about)

     1  {{- if and (hasPrefix .UnderlyingType "int") (isInteger .MultipleOf) }}{{/* if the type is an integer, but the multiple factor is not, fall back to the float64 version of the validator */}}
     2    {{- if and (hasPrefix .UnderlyingType "int64") (not .IsAliased) }}
     3  if err := validate.MultipleOfInt({{ path . }}, {{ printf "%q" .Location }}, {{ if .IsNullable }}*{{ end }}{{.ValueExpression }}, {{.MultipleOf }}); err != nil {
     4    {{- else }}
     5  if err := validate.MultipleOfInt({{ path . }}, {{ printf "%q" .Location }}, int64({{ if .IsNullable }}*{{ end }}{{.ValueExpression }}), {{.MultipleOf }}); err != nil {
     6    {{- end }}
     7  {{- else }}
     8    {{- if and (hasPrefix .UnderlyingType "uint") (isInteger .MultipleOf) }}
     9      {{- if and (hasPrefix .UnderlyingType "uint64") (not .IsAliased) }}
    10  if err := validate.MultipleOfUint({{ path . }}, {{ printf "%q" .Location }}, {{ if .IsNullable }}*{{ end }}{{.ValueExpression }}, {{.MultipleOf }}); err != nil {
    11      {{- else }}
    12  if err := validate.MultipleOfUint({{ path . }}, {{ printf "%q" .Location }}, uint64({{ if .IsNullable }}*{{ end }}{{.ValueExpression }}), {{.MultipleOf }}); err != nil {
    13      {{- end }}
    14    {{- else }}
    15      {{- if and (eq .UnderlyingType "float64") (not .IsAliased) }}
    16  if err := validate.MultipleOf({{ path . }}, {{ printf "%q" .Location }}, {{ if .IsNullable }}*{{ end }}{{.ValueExpression }}, {{.MultipleOf }}); err != nil {
    17      {{- else }}
    18  if err := validate.MultipleOf({{ path . }}, {{ printf "%q" .Location }}, float64({{ if .IsNullable }}*{{ end }}{{.ValueExpression }}), {{.MultipleOf }}); err != nil {
    19      {{- end }}
    20    {{- end }}
    21  {{- end }}
    22    return err
    23  }