Skip to content

Commit

Permalink
Merge pull request #10
Browse files Browse the repository at this point in the history
Parse xid func
  • Loading branch information
heartwilltell authored Sep 12, 2024
2 parents b30d8bb + 4ae28ee commit 0438d03
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions idkit/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ func ValidateXID(id string) error {
return nil
}

// ParseXID returns XID identifier as object.
func ParseXID(id string) (xid.ID, error) {
xID, err := xid.FromString(id)
if err != nil {
return [12]byte{}, ErrInvalidID
}

return xID, nil
}

// DigiCode returns 6-digit code as a string.
func DigiCode() string {
var (
Expand Down

0 comments on commit 0438d03

Please sign in to comment.