Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thatscalaguy/ulid4cats
https://github.com/thatscalaguy/ulid4cats
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/thatscalaguy/ulid4cats
- Owner: ThatScalaGuy
- Created: 2020-12-14T12:18:48.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-12T05:16:15.000Z (4 months ago)
- Last Synced: 2024-09-12T14:48:52.864Z (4 months ago)
- Language: Scala
- Size: 93.8 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ulid4cats
![Cats Friendly Badge](https://typelevel.org/cats/img/cats-badge-tiny.png)
[![ulid4cats Scala version support](https://index.scala-lang.org/thatscalaguy/ulid4cats/ulid4cats/latest-by-scala-version.svg?platform=jvm)](https://index.scala-lang.org/thatscalaguy/ulid4cats/ulid4cats)
[![Maven Central](https://img.shields.io/maven-central/v/de.thatscalaguy/ulid4cats_2.13.svg)](https://maven-badges.herokuapp.com/maven-central/de.thatscalaguy/ulid4cats_2.13)Small cats-effect wrapper around the [airframe-ulid](https://github.com/wvlet/airframe/tree/master/airframe-ulid) library.
## Scala3 Sample
Add dependency to yor sbt file
```scala
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % "3.5.0", // must be provided
"de.thatscalaguy" %% "ulid4cats" % "1.3.0",
)
```
Application print a new ulid to the console.
```scala
import cats.effect.{IO, IOApp, ExitCode}
import de.thatscalaguy.ulid4cats.FULIDobject Main extends IOApp:
def run(args: List[String]): IO[ExitCode] = for {
id <- FULID[IO].generate
_ <- IO.println(id)
} yield ExitCode.Success
```