Skip to content

Commit faaf0c6

Browse files
committed
Bumped version & wrote small documentation on bee.functional
1 parent 71afda3 commit faaf0c6

File tree

4 files changed

+55
-3
lines changed

4 files changed

+55
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Some changes are currently being made:
2626
* `bee.persistent`
2727
Easier data handling for GraphQL + JPA, [documentation](./bee.persistent/README.md)
2828
* `bee.functional`
29-
Functional kotlin bindings, integration with DGS, `bee.persistent` & more
29+
Functional Kotlin bindings, integration with DGS, `bee.persistent` & more, [documentation](./bee.functional/README.md)
3030
* `bee.buzz`
3131
Simple event manager based on the mediator pattern, based on C#'s [MediatR library](https://github.com/jbogard/MediatR)
3232

bee.fetched/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pluginManagement {
4444
```kotlin
4545
plugins {
4646
id("bee.generative")
47-
id("com.google.devtools.ksp") version "1.8.0-1.0.9"
47+
id("com.google.devtools.ksp") version "1.9.10-1.0.13"
4848
}
4949

5050
dependencies {

bee.functional/README.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<div align="center">
2+
<h1><code>bee.functional</code></h1>
3+
<p>
4+
<strong>Functional Kotlin bindings, integration with DGS, bee.persistent & more</strong>
5+
</p>
6+
</div>
7+
8+
9+
10+
## bee.functional
11+
12+
Predefined error types, extensions & more for [`com.github.michaelbull.result.Result`](https://github.com/michaelbull/kotlin-result).
13+
14+
```kotlin
15+
typealias AppResult<V> = Result<V, AppError>
16+
17+
open class BadRequestError : AppError
18+
open class InternalAppError : AppError
19+
```
20+
21+
## bee.functional.dgs
22+
23+
Adds support for result data fetchers.
24+
25+
```kotlin
26+
@DgsQuery
27+
fun bar(): Bar {
28+
return Bar(listOf("Bar"))
29+
}
30+
31+
@DgsData(
32+
parentType = DgsConstants.BAR.TYPE_NAME,
33+
field = DgsConstants.BAR.Waldos
34+
)
35+
fun barWaldos(): AppResult<List<Waldo>> {
36+
return Err(BadRequestError("Bar"))
37+
}
38+
```
39+
40+
Redefines certain graphql invocations at runtime via ByteBuddy & provides custom exception handler in order to work.
41+
42+
> ⚠️ 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.
43+
>
44+
> 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.
45+
46+
> ⚠️ 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.
47+
48+
## bee.functional.persistent
49+
50+
Provides `@TransactionalResult` annotation & corresponding aspect that provides JPA transactions support for methods that return a `Result`.
51+
52+
Based on the timeless `@Transactional` annotation from Spring.

gradle/libs.versions.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
bee-built = "0.3.1-SNAPSHOT"
2+
bee-built = "0.4.0-SNAPSHOT"
33
springboot-base = "3.1.4"
44
springboot-dependencymanagement = "1.1.3"
55
kotlin-base = "1.9.10"

0 commit comments

Comments
 (0)