mirror of
				https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
				synced 2025-10-29 09:05:30 +00:00 
			
		
		
		
	Clear function to clear things on reparse
This commit is contained in:
		| @@ -27,9 +27,6 @@ func (r *Resolver[T]) Add(typeName, refID string, item Resolved[T]) { | ||||
| } | ||||
|  | ||||
| func (r *Resolver[T]) Get(typeName, refID string) ([]Resolved[T], error) { | ||||
| 	r.mu.Lock() | ||||
| 	defer r.mu.Unlock() | ||||
|  | ||||
| 	if typeIndex, exists := r.index[typeName]; exists { | ||||
| 		if items, ok := typeIndex[refID]; ok { | ||||
| 			return items, nil | ||||
| @@ -38,3 +35,10 @@ func (r *Resolver[T]) Get(typeName, refID string) ([]Resolved[T], error) { | ||||
| 	} | ||||
| 	return nil, fmt.Errorf("no index exists for type '%s'", typeName) | ||||
| } | ||||
|  | ||||
| func (r *Resolver[T]) Clear() { | ||||
| 	r.mu.Lock() | ||||
| 	defer r.mu.Unlock() | ||||
|  | ||||
| 	r.index = make(map[string]map[string][]Resolved[T]) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Simon Martens
					Simon Martens