Skip to content

Commit

Permalink
feat(ident): Keep only the definitions and move all implementations t…
Browse files Browse the repository at this point in the history
…o the runtime package
  • Loading branch information
godcong committed Jul 11, 2024
1 parent 7562f3d commit 70a0f98
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions ident/ident.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

0 comments on commit 70a0f98

Please sign in to comment.