-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b754ec
commit 53af274
Showing
4 changed files
with
86 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# schemabuilder4cats | ||
A referentially transparent FFI to `org.apache.avro.SchemaBuilder` | ||
|
||
### Welcome to `schemabuilder4cats` | ||
|
||
Let's build schemas secure in the knowledge that we won't be causing side-effects. | ||
|
||
##### Add the dependency | ||
|
||
``` | ||
"com.julianpeeters" %% "schemabuilder4cats" % "@VERSION@" | ||
``` | ||
|
||
### Usage | ||
|
||
The `SchemaBuilder` API is modelled after `org.apache.avro.SchemaBuilder`. | ||
Please see the corresponding Apache Avro Java @AVRO@ API | ||
[Javadoc](https://avro.apache.org/docs/@AVRO@/api/java/) for documentation. | ||
|
||
##### Example: | ||
|
||
```scala mdoc:silent | ||
import cats.effect.IO | ||
import org.apache.avro.Schema | ||
import schemabuilder4cats.SchemaBuilder | ||
|
||
// define B as a contextual abstraction in order to import extension methodss | ||
given B: SchemaBuilder[IO] = SchemaBuilder[IO] | ||
val record: IO[Schema] = B.record("myrecord").fields.endRecord | ||
``` | ||
|
||
##### Result: | ||
```scala mdoc | ||
import cats.effect.unsafe.implicits.global | ||
|
||
// example usage only, avoid unsafe methods in real code | ||
record.unsafeRunSync().toString(true) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.7" ) |