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.
18 lines
544 B
18 lines
544 B
2 years ago
|
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 }}
|
||
|
`
|