Skip to content

Instantly share code, notes, and snippets.

View anujdecoder's full-sized avatar

Anuj A Gupta anujdecoder

  • MindTickle
  • Nagpur
View GitHub Profile
type MagicalCreature struct {
schemabuilder.Interface
*Spider
*Snake
}
func (s *Server) RegisterInterface(sb *schemabuilder.Schema) {
sb.Query().FieldFunc("magicalCreature", func(ctx context.Context, args struct {
Id schemabuilder.ID
}) *MagicalCreature {
type MagicalObject struct {
schemabuilder.Union
*Wand
*Broomstick
}
func (s *Server) RegisterUnion(sb *schemabuilder.Schema) {
sb.Query().FieldFunc("magicalObject", func(ctx context.Context, args struct {
Id schemabuilder.ID
}) *MagicalObject {
func main() {
s := &Server{
Wands: []*Wand{},
Broomsticks: []*Broomstick{},
Snakes: []*Snake{},
Spiders: []*Spider{},
}
sb := schemabuilder.NewSchema()
RegisterWand(sb)
package main
import (
"context"
"github.com/google/uuid"
"log"
"net/http"
"go.appointy.com/jaal"
"go.appointy.com/jaal/introspection"