You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
544 B
17 lines
544 B
package cc |
|
|
|
const anyTpl = `{{ $f := .Field }}{{ $r := .Rules }} |
|
{{ template "required" . }} |
|
|
|
{{ if $r.In }} |
|
{{ $table := lookup $f "InLookup" }} |
|
if ({{ hasAccessor . }} && {{ $table }}.find({{ accessor . }}.type_url()) == {{ $table }}.end()) { |
|
{{ err . "type URL must be in list " $r.In }} |
|
} |
|
{{ else if $r.NotIn }} |
|
{{ $table := lookup $f "NotInLookup" }} |
|
if ({{ hasAccessor . }} && {{ $table }}.find({{ accessor . }}.type_url()) != {{ $table }}.end()) { |
|
{{ err . "type URL must not be in list " $r.NotIn }} |
|
} |
|
{{ end }} |
|
`
|
|
|