cufyorg / graphkt Goto Github PK
View Code? Open in Web Editor NEWA DSL based graphql server library for kotlin backed by graphql-java.
License: Apache License 2.0
A DSL based graphql server library for kotlin backed by graphql-java.
License: Apache License 2.0
Sometimes database (or any) operations can be merged into one (or at least fewer) operations
Like, in queries, instead of getting a whole document (or row) just to return a few fields
or getting the same related document of multiple documents with multiple queries.
It all can be merged into one query.
Or, in mutations, instead of updating a document multiple times, it can be merged into a single operation.
Fields can return a lazily evaluated values that can be merged together after request execution.
The library would expose an interface for lazily evaluated values.
interface LazyEvaluatedValue<T>
An adapter implements those interfaces
data class DatabaseGetOperation<T>(
val collectionName: String,
val filter: DatabaseFilter, // made up class name
val field: String
) : LazyEvaluatedValue<T>
data class DatabaseSetOperation<T>(
val collectionName: String,
val filter: DatabaseFilter, // made up class name
val field: String,
val value: DatabaseValue // made up class name
) : LazyEvaluatedValue<T>
A graphql configuration variable can be set
graphql {
engine {
lazyValueEvaluator<DatabaseGetOperation> { values: List<DatabaseGetOperation> ->
databaseClient.performOperations(values) // made up function name
}
lazyValueEvaluator<DatabaseSetOperation> { values: List<DatabaseSetOperation> ->
databaseClient.performOperations(values) // made up function name
}
}
}
now the fields would look like:
field("getMyField") {
//...
getLazyEvaluatedValue {
DatabaseGetOperation(
collectionName ="myCollection",
filter = DatabaseFilter("id=${instance.id}"),
field = "myField"
)
}
}
field("setMyField") {
val arg = argument { /*...*/ }
getLazyEvaluatedValue {
val argValue = arg()
DatabaseSetOperation(
collectionName = "myCollection",
filter = DatabaseFilter("id=${instance.id}"),
field = "myField",
value = DatabaseValue(argValue)
)
}
}
It is good to be able to add code to all the getters.
It would make plugins more powerful
It would make directives more useful
Schema.onGet
and Schema.onGetBlocking
Directive.onGet
and Directive.onGetBlocking
?A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.