Skip to content

Instantly share code, notes, and snippets.

View Andy2003's full-sized avatar

Andreas Berger Andy2003

  • Freelancer
  • Germany
View GitHub Profile
@Andy2003
Andy2003 / docker macvlan
Created December 4, 2021 16:21
Docker macvlan with ip range and binding to concrete interface
docker network create -d macvlan --subnet=192.168.178.0/24 --ip-range=192.168.178.248/29 --gateway=192.168.178.1 -o parent=ovs_eth1 macvlan-ovs_eth1
https://mxtoolbox.com/subnetcalculator.aspx
@Andy2003
Andy2003 / type-safe-projection.kt
Created October 29, 2021 11:30
Type-safe projection
val graphQLQueryRequest = GraphQLQueryRequest(
MoviesGraphQLQuery(),
MoviesProjectionRoot().also { movie ->
movie.title()
movie.bar()
movie.javaData().also { javaData ->
javaData.name()
}
}
)
@Andy2003
Andy2003 / plugin.xml
Created October 29, 2021 11:26
Maven plugin configuration
<plugin>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-graphql-augmented-schema-generator-maven-plugin</artifactId>
<version>1.4.1-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>generate-schema</goal>
</goals>
<configuration>
@Andy2003
Andy2003 / combindes-request.graphql
Created October 29, 2021 11:11
Request retrieving combined data
query {
movies{
title
bar
javaData {
name
}
}
}
@Andy2003
Andy2003 / AdditionalDataFetcher.kt
Created October 29, 2021 11:07
Extend augmented schema by custom logic
@DgsComponent
class AdditionalDataFetcher {
@DgsData(parentType = "Movie", field = "bar")
fun bar(): String {
return "foo"
}
@DgsData(parentType = "Movie", field = "javaData")
fun javaData(env: DataFetchingEnvironment): List<JavaData> {
val title = env.getSource<Map<String, *>>()["title"]
@Andy2003
Andy2003 / GraphQLConfiguration.kt
Created October 29, 2021 10:55
GraphQLConfiguration.kt
@DgsComponent
open class GraphQLConfiguration {
@Value("classpath:neo4j.graphql")
lateinit var graphQl: Resource
@Autowired(required = false)
lateinit var dataFetchingInterceptor: DataFetchingInterceptor
lateinit var schemaBuilder: SchemaBuilder
@Andy2003
Andy2003 / schema.graphql
Created October 29, 2021 10:50
Application schema
extend type Movie {
bar: String @ignore
javaData: [JavaData!] @ignore
}
type JavaData {
name: String
}
extend type Query {
@Andy2003
Andy2003 / neo4j.graphql
Created October 29, 2021 10:45
Schema to be augmented by our library
type Movie {
title: String
}
@Andy2003
Andy2003 / example2.graphql
Created October 29, 2021 10:21
Query, using default sorting
{
genre {
name
}
}
@Andy2003
Andy2003 / new-style-paging-and-sorting.graphql
Created October 29, 2021 10:20
Defaults for paging and sorting (new style)
type Movie {
id: ID
title: String
genres: [Genre!] @relation(name: "HAS_GENRE", direction: OUT)
}
type Genre {
id: ID
name: String
}
input GenreOptions {