# uuid

> Package uuid generates version 7 UUIDs (RFC 9562), the form zelk gives new session IDs.

<!-- Generated from the Go source of github.com/barevoidco/zelk/core/uuid (cmd/zelk/internal/reference TestReferenceGoAPI). Don't edit: change the code, then run make reference. -->

```go
import "github.com/barevoidco/zelk/core/uuid"
```

Package uuid generates version 7 UUIDs (RFC 9562), the form zelk gives new session IDs.

A version 7 UUID starts with its creation time in milliseconds, so IDs sort by when they were made, and fills the rest with 74 random bits, so IDs made by different processes never need to coordinate. The package generates and formats UUIDs only: zelk accepts any string as a session ID, so it never needs to parse one.


## UUID

```go
type UUID [16]byte
```

UUID is a 128-bit universally unique identifier.


### New

```go
func New() UUID
```

New returns a version 7 UUID stamped with the current time.

UUIDs made in different milliseconds sort in time order; within one millisecond their order is random. New is safe for concurrent use.

**Example**

```go
id := uuid.New().String()
fmt.Println(len(id), id[14:15])
// Output: 36 7
```

Output:

```text
36 7
```


### UUID.String

```go
func (id UUID) String() string
```

String returns id in the canonical lowercase form, xxxxxxxx-xxxx-7xxx-yxxx-xxxxxxxxxxxx.
