Skip to content

Instantly share code, notes, and snippets.

View svenhakvoort's full-sized avatar

Sven Hakvoort svenhakvoort

View GitHub Profile
@svenhakvoort
svenhakvoort / .block
Created April 4, 2018 18:46 — forked from mbostock/.block
Hierarchical Bar Chart
license: gpl-3.0
@svenhakvoort
svenhakvoort / DemoQuery.kt
Created May 17, 2020 15:36
Demo GraphQL Query
package com.example.demographql.query
import com.expediagroup.graphql.spring.operations.Query
import org.springframework.stereotype.Controller
@Controller
class DemoQuery: Query {
fun demo(): String {
return "Our query works"
@svenhakvoort
svenhakvoort / DemoModel.kt
Last active May 17, 2020 15:53
DemoModel
package com.example.demographql.model
import com.expediagroup.graphql.annotations.GraphQLID
import org.springframework.data.annotation.Id
import java.util.*
data class Demo(
val someText: String
) {
@GraphQLID @Id
package com.example.demographql.service
import com.example.demographql.model.Demo
import com.example.demographql.repository.DemoRepository
import org.springframework.stereotype.Service
import reactor.core.publisher.Mono
@Service
class DemoService(val demoRepository: DemoRepository) {
package com.example.demographql.mutation
import com.example.demographql.model.Demo
import com.example.demographql.service.DemoService
import com.expediagroup.graphql.spring.operations.Mutation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Controller
import reactor.core.publisher.Mono
@Controller
@svenhakvoort
svenhakvoort / CustomDataFetcher.kt
Last active May 17, 2020 16:09
CustomDataFetcher
package com.example.demographql.config
import com.expediagroup.graphql.execution.FunctionDataFetcher
import graphql.schema.DataFetchingEnvironment
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import kotlin.reflect.KFunction
class CustomFunctionDataFetcher(target: Any?, fn: KFunction<*>) : FunctionDataFetcher(target, fn) {
@svenhakvoort
svenhakvoort / DemoQuery.kt
Created May 17, 2020 16:17
Modified DemoQuery
package com.example.demographql.query
import com.example.demographql.model.Demo
import com.example.demographql.service.DemoService
import com.expediagroup.graphql.spring.operations.Query
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Controller
import reactor.core.publisher.Mono
@Controller
@svenhakvoort
svenhakvoort / application.yml
Created August 21, 2020 06:43
GraphQL demo application.yml
spring:
profiles: default
data.mongodb:
host: localhost:27017
database: demo
graphql:
packages: "com.example.demographql"