From 70a0f984b2818adc905a5f2c9fabfb1746b7b70f Mon Sep 17 00:00:00 2001 From: godcong Date: Thu, 11 Jul 2024 19:53:16 +0800 Subject: [PATCH] feat(ident): Keep only the definitions and move all implementations to the runtime package --- ident/ident.go | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/ident/ident.go b/ident/ident.go index 329f701..9f7adba 100644 --- a/ident/ident.go +++ b/ident/ident.go @@ -10,41 +10,3 @@ type Identifier interface { Validate(id string) bool Size() int } - -var defaultGenerator Identifier - -func init() { - defaultGenerator = newNumber() -} - -// Use sets the defaultGenerator ident. -func Use(ident Identifier) { - defaultGenerator = ident -} - -// Default method returns the default defaultGenerator ident. -func Default() Identifier { - return defaultGenerator -} - -// GenID The function "GenID" generates a new unique identifier and returns it as a string. -func GenID() string { - return defaultGenerator.Gen() -} - -// GenSize The function "GenSize" returns the size of the generated identifier -func GenSize() int { - return defaultGenerator.Size() -} - -// Validate The function "Validate" checks whether the given identifier is valid or not. -func Validate(id string) bool { - return defaultGenerator.Validate(id) -} - -var ( - _ = Use - _ = GenID - _ = GenSize - _ = Validate -)