Skip to content

Commit

Permalink
Bumped version & wrote small documentation on bee.functional
Browse files Browse the repository at this point in the history
  • Loading branch information
kurbaniec committed Nov 4, 2023
1 parent 71afda3 commit faaf0c6
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Some changes are currently being made:
* `bee.persistent`
Easier data handling for GraphQL + JPA, [documentation](./bee.persistent/README.md)
* `bee.functional`
Functional kotlin bindings, integration with DGS, `bee.persistent` & more
Functional Kotlin bindings, integration with DGS, `bee.persistent` & more, [documentation](./bee.functional/README.md)
* `bee.buzz`
Simple event manager based on the mediator pattern, based on C#'s [MediatR library](https://github.com/jbogard/MediatR)

2 changes: 1 addition & 1 deletion bee.fetched/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pluginManagement {
```kotlin
plugins {
id("bee.generative")
id("com.google.devtools.ksp") version "1.8.0-1.0.9"
id("com.google.devtools.ksp") version "1.9.10-1.0.13"
}

dependencies {
Expand Down
52 changes: 52 additions & 0 deletions bee.functional/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<div align="center">
<h1><code>bee.functional</code></h1>
<p>
<strong>Functional Kotlin bindings, integration with DGS, bee.persistent & more</strong>
</p>
</div>



## bee.functional

Predefined error types, extensions & more for [`com.github.michaelbull.result.Result`](https://github.com/michaelbull/kotlin-result).

```kotlin
typealias AppResult<V> = Result<V, AppError>

open class BadRequestError : AppError
open class InternalAppError : AppError
```

## bee.functional.dgs

Adds support for result data fetchers.

```kotlin
@DgsQuery
fun bar(): Bar {
return Bar(listOf("Bar"))
}

@DgsData(
parentType = DgsConstants.BAR.TYPE_NAME,
field = DgsConstants.BAR.Waldos
)
fun barWaldos(): AppResult<List<Waldo>> {
return Err(BadRequestError("Bar"))
}
```

Redefines certain graphql invocations at runtime via ByteBuddy & provides custom exception handler in order to work.

> ⚠️ When Spring is started, an attempt is made to install a ByteBuddy agent. If this fails and is not supported by the JVM platform used, one can use the older error handling model.
>
> One needs to provide a configuration based on the `ResultFetcherAspectConfiguration` class. This will create an aspect that handles `DataFetcherResults` like typical `Results`. Please note that the data fetcher must also return `DataFetcherResult`. One can convert a `Result` into one using the `getDataFetcher()` extension method. Directly returing a `Result` type is not supported in this model.
> ⚠️ Usage with data loader is currently evaluated and not supported. Please transform `Results` manually to [`Try`](https://netflix.github.io/dgs/data-loaders/#implementing-a-data-loader-with-try) if needed.
## bee.functional.persistent

Provides `@TransactionalResult` annotation & corresponding aspect that provides JPA transactions support for methods that return a `Result`.

Based on the timeless `@Transactional` annotation from Spring.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
bee-built = "0.3.1-SNAPSHOT"
bee-built = "0.4.0-SNAPSHOT"
springboot-base = "3.1.4"
springboot-dependencymanagement = "1.1.3"
kotlin-base = "1.9.10"
Expand Down

0 comments on commit faaf0c6

Please sign in to comment.