예제 #1
0
func (w *WithinMetadataMatcher) Match(v interface{}) bool {
	for _, el := range w.list {
		if common.CrossTypeEqual(v, el) {
			return true
		}
	}

	return false
}
예제 #2
0
func (e *graphElement) matchMetadata(f Metadata) bool {
	for k, v := range f {
		switch v.(type) {
		case MetadataMatcher:
			nv, ok := e.metadata[k]
			matcher := v.(MetadataMatcher)
			if !ok || !matcher.Match(nv) {
				return false
			}
		default:
			nv, ok := e.metadata[k]
			if !ok || !common.CrossTypeEqual(nv, v) {
				return false
			}
		}
	}

	return true
}