Skip to content

Instantly share code, notes, and snippets.

View VictorKabata's full-sized avatar
💻
Knock, knock. Race condition. Who's there?

Victor Kabata VictorKabata

💻
Knock, knock. Race condition. Who's there?
View GitHub Profile
...
var sandboxHTML = []byte(`
<!DOCTYPE html>
<html lang="en">
<body style="margin: 0; overflow-x: hidden; overflow-y: hidden">
<div id="sandbox" style="height:100vh; width:100vw;"></div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js"></script>
<script>
new window.EmbeddedSandbox({
go get github.com/graphql-go/graphql // GraphQL-Go
go get github.com/graphql-go/handler // GraphQL-Go-Handler
@VictorKabata
VictorKabata / graphql-go.go
Created October 29, 2022 16:50
Simple graphQL API built using Golang
package main
import (
"fmt"
"github.com/graphql-go/graphql"
"github.com/graphql-go/handler"
"log"
"net/http"
"time"
)
...
"note": &graphql.Field{
Name: "Get note by ID",
Type: noteType,
Description: "Get note by ID",
Args: graphql.FieldConfigArgument{"id": &graphql.ArgumentConfig{Type: graphql.Int}},
Resolve: func(params graphql.ResolveParams) (interface{}, error) {
id, isValid := params.Args["id"].(int)
if isValid {
fields := graphql.Fields{
"notes": &graphql.Field{
Name: "Get all notes",
Type: graphql.NewList(noteType),
Description: "Get list of all notes",
Resolve: func(params graphql.ResolveParams) (interface{}, error) {
return notes, nil
},
},
package main
import (
"fmt"
"github.com/graphql-go/graphql"
"github.com/graphql-go/handler"
"log"
"net/http"
"time"
)
// Greet -> build.gradle.kts
tasks.matching { it.name != "loadMamboMotoFile" }.all {
println("Executing task: ${this.name}")
this.dependsOn("loadMamboMotoFile")
}
tasks.register("loadMamboMotoFile") {
println("Executing task: ${this.name}")