From 9219c6803d4ebd5b1eb43ab8da3adb4055454eaf Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Thu, 4 Mar 2021 16:20:37 +0100 Subject: [PATCH] Add `func (*FormatCheckerChain).Empty()` Signed-off-by: Pierre Fenoll --- format_checkers.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/format_checkers.go b/format_checkers.go index 1e770464..5dd0ef42 100644 --- a/format_checkers.go +++ b/format_checkers.go @@ -144,6 +144,13 @@ var ( lock = new(sync.RWMutex) ) +// Empty resets the FormatCheckerChain +func (c *FormatCheckerChain) Empty() { + lock.Lock() + c.formatters = make(map[string]FormatChecker) + lock.Unlock() +} + // Add adds a FormatChecker to the FormatCheckerChain // The name used will be the value used for the format key in your json schema func (c *FormatCheckerChain) Add(name string, f FormatChecker) *FormatCheckerChain {