Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add func (*FormatCheckerChain).Empty() #326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add func (*FormatCheckerChain).Empty()
Signed-off-by: Pierre Fenoll <pierrefenoll@gmail.com>
  • Loading branch information
fenollp committed Mar 4, 2021
commit 9219c6803d4ebd5b1eb43ab8da3adb4055454eaf
7 changes: 7 additions & 0 deletions format_checkers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down