Skip to content

Commit

Permalink
add supported UUID libraries to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jackspirou committed Sep 15, 2024
1 parent 8dc5889 commit c32bc97
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,54 @@
The `uuidkey` package encodes UUIDs to a readable `Key` format via the Base32-Crockford codec.
## UUID Library Compatibility
This package is designed to work with the following UUID libraries:
- [github.com/gofrs/uuid](https://github.com/gofrs/uuid) (v4.4.0+)
- [github.com/google/uuid](https://github.com/google/uuid) (v1.6.0+)
We maintain compatibility with these specific versions as test dependencies. While newer versions may work, these are the ones we officially support and test against.
## Installation
To install the `uuidkey` package, use the following command:
```sh
go get github.com/agentstation/uuidkey
```
## Usage
To use the `uuidkey` package in your Go code, follow these steps:
1. Import the package:
```go
import "github.com/agentstation/uuidkey"
```
2. Encode a UUID to a Key:
```go
uuid := "d1756360-5da0-40df-9926-a76abff5601d"
key := uuidkey.Encode(uuid)
fmt.Println(key) // Output: 38QARV0-1ET0G6Z-2CJD9VA-2ZZAR0X
```
3. Decode a Key to a UUID:
```go
key := "38QARV0-1ET0G6Z-2CJD9VA-2ZZAR0X"
uuid, err := uuidkey.FromString(key)
if err != nil {
fmt.Println("Error:", err)
}
fmt.Println(uuid) // Output: d1756360-5da0-40df-9926-a76abff5601d
```
## Documentation
<!-- gomarkdoc:embed:start -->
<!-- Code generated by gomarkdoc. DO NOT EDIT -->
Expand Down Expand Up @@ -180,4 +228,4 @@ BenchmarkUUIDStringValid-12 4940355 246.7 ns/op
BenchmarkUUIDStringInvalid-12 70641040 16.33 ns/op
PASS
ok github.com/agentstation/uuidkey 13.168s
```
```

0 comments on commit c32bc97

Please sign in to comment.