Skip to content

Commit

Permalink
feat: v2 refactor and new features
Browse files Browse the repository at this point in the history
- feat: add `uuid-kotlinx` module for kotlinx serialization
  integration library

- feat: implement kotlinx serialization for uuids

- chore: initial refactor into multi-module project

- chore: update lockfiles and verification metadata

Signed-off-by: Sam Gammon <[email protected]>
  • Loading branch information
sgammon committed Jan 29, 2024
1 parent b2afff8 commit 553bb18
Show file tree
Hide file tree
Showing 36 changed files with 1,735 additions and 1,090 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
project adheres to [Semantic Versioning](https://semver.org/).

## [2.0.0-Beta3-0.20.0-rc1] - 2024-01-28
### Changed
- Coming soon.

## [0.8.22] - 2023-07-29
### Changed
- Upgrade to Kotlin 1.9.0
Expand Down
54 changes: 43 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,57 @@ K/N UUID. This brings a UUID that matches UUIDs on various platforms:

- iOS/Mac: `NSUUID`
- Java: `java.util.UUID`
- Native: Source implementation

### `UUID`
### Features

- Frozen
- Thread-safe (thread-safe randomness in native)
- Adheres to RFC4122
- Tested
- Tested against macOS/iOS UUID to verify correctness
- All Kotlin targets, including WASM/WASI
- Serializable on JVM
- Support for `uuid3`, `uuid4`, and `uuid5`
- Frozen and thread-safe (thread-safe randomness in native)
- Tested on all platforms, and against macOS/iOS UUID to verify correctness
- Aggressively optimized for performance and safety
- Updated for new versions of Kotlin
- πŸ†• All Kotlin targets, including WASM/WASI and Android/Native
- πŸ†• Serializable on JVM
- πŸ†• Serializable with KotlinX
- πŸ†• Zero-overhead model

### Setup

In your build.gradle(.kts):
**In your `build.gradle(.kts)`:**

- Add `mavenCentral()` to your repositories
- Add `implementation "dev.elide:elide-uuid:<version>"` as a dependency in your `commonMain` `sourceSets`
```kotlin
dependencies {
implementation("dev.elide:uuid:<version>")
}
```

This library publishes Gradle module metadata. If you're using Gradle prior to version 6, you should have `enableFeaturePreview("GRADLE_METADATA")` in your settings.gradle(.kts).
**From an Elide application:**
```kotlin
dependencies {
implementation(elide.uuid)
}
```

### Usage

From any Kotlin source set:
```kotlin
val uuid = uuid4()
println(uuid.toString())
// 1b4e28ba-2fa1-11d2-883f-0016d3cca427
```

#### "Zero-overhead" abstraction

This library is designed to offer a compile-time option for dealing with UUIDs; internally, UUIDs are stored as a simple
`Pair<Long, Long>` to minimize allocations, and the main `Uuid` class is a `@JvmInline value class`.

Thus, your UUIDs are strictly typed and validated but also remain very lightweight.

#### Serialization

Both JVM serialization and KotlinX serialization are supported out of the box.

### Contributing

Expand Down
Loading

0 comments on commit 553bb18

Please sign in to comment.