Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GUID ¶
type GUID interface { CreatedAt() time.Time WriteTo(w io.Writer) (int64, error) Bytes() []byte String() string }
GUID is an interface unifying identifiers of different lengths
type GUID128 ¶
type GUID128 [16]byte
GUID128 is a 16-byte globally unique identifier
func New128 ¶
func New128() GUID128
New128 creates a 128bit/16byte global identifier
Example ¶
package main import ( "encoding/hex" "fmt" guid "github.com/bsm/go-guid" ) func main() { // Create a new 16-byte globally-unique identifier id := guid.New128() fmt.Println(hex.EncodeToString(id.Bytes())) }
Output:
type GUID96 ¶
type GUID96 [12]byte
GUID96 is a 12-byte globally unique identifier
func New96 ¶
func New96() GUID96
New96 creates a 96bit/12byte global identifier
Example ¶
package main import ( "encoding/hex" "fmt" guid "github.com/bsm/go-guid" ) func main() { // Create a new 12-byte globally-unique identifier id := guid.New96() fmt.Println(hex.EncodeToString(id.Bytes())) }
Output:
Click to show internal directories.
Click to hide internal directories.