Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewExecutableSchema ¶
func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
Types ¶
type ComplexityRoot ¶
type ComplexityRoot struct { FeedItem struct { CommentsCount func(childComplexity int) int Domain func(childComplexity int) int ID func(childComplexity int) int Points func(childComplexity int) int Time func(childComplexity int) int TimeAgo func(childComplexity int) int Title func(childComplexity int) int Type func(childComplexity int) int URL func(childComplexity int) int User func(childComplexity int) int } Item struct { Comments func(childComplexity int) int CommentsCount func(childComplexity int) int Content func(childComplexity int) int Dead func(childComplexity int) int Deleted func(childComplexity int) int Domain func(childComplexity int) int ID func(childComplexity int) int Level func(childComplexity int) int Points func(childComplexity int) int Time func(childComplexity int) int TimeAgo func(childComplexity int) int Title func(childComplexity int) int Type func(childComplexity int) int URL func(childComplexity int) int User func(childComplexity int) int } Query struct { Feeds func(childComplexity int, typeArg string, index int) int Item func(childComplexity int, id int) int User func(childComplexity int, id string) int } User struct { About func(childComplexity int) int Created func(childComplexity int) int CreatedTime func(childComplexity int) int ID func(childComplexity int) int Karma func(childComplexity int) int } }
type Config ¶
type Config struct { Resolvers ResolverRoot Directives DirectiveRoot Complexity ComplexityRoot }
type DirectiveRoot ¶
type DirectiveRoot struct { }
type FeedItem ¶
type FeedItem struct { ID int `json:"id"` Title string `json:"title"` Points *int `json:"points"` User *string `json:"user"` Time int `json:"time"` TimeAgo string `json:"time_ago"` CommentsCount int `json:"comments_count"` Type string `json:"type"` URL string `json:"url"` Domain string `json:"domain"` }
type Item ¶
type Item struct { ID int `json:"id"` Title *string `json:"title"` Points *int `json:"points"` User *string `json:"user"` Time int `json:"time"` TimeAgo string `json:"time_ago"` Content string `json:"content"` Deleted bool `json:"deleted"` Dead bool `json:"dead"` Type string `json:"type"` URL string `json:"url"` Domain string `json:"domain"` Comments []*Item `json:"comments"` Level int `json:"level"` CommentsCount int `json:"comments_count"` }
type QueryResolver ¶
type Resolver ¶
type Resolver struct{}
func (*Resolver) Query ¶
func (r *Resolver) Query() QueryResolver
type ResolverRoot ¶
type ResolverRoot interface {
Query() QueryResolver
}
Directories ¶
Path | Synopsis |
---|---|
package main import ( "log" "net/http" "os" "github.com/99designs/gqlgen/handler" hackernews_gqlgen_server "github.com/abodhare/hackernews-gqlgen-server" ) const defaultPort = "4000" func main() { port := os.Getenv("PORT") if port == "" { port = defaultPort } http.Handle("/playground", handler.Playground("GraphQL playground", "/")) http.Handle("/", handler.GraphQL(hackernews_gqlgen_server.NewExecutableSchema(hackernews_gqlgen_server.Config{Resolvers: &hackernews_gqlgen_server.Resolver{}}))) log.Printf("connect to http://localhost:%s/ for GraphQL playground", port) log.Fatal(http.ListenAndServe(":"+port, nil)) }
|
package main import ( "log" "net/http" "os" "github.com/99designs/gqlgen/handler" hackernews_gqlgen_server "github.com/abodhare/hackernews-gqlgen-server" ) const defaultPort = "4000" func main() { port := os.Getenv("PORT") if port == "" { port = defaultPort } http.Handle("/playground", handler.Playground("GraphQL playground", "/")) http.Handle("/", handler.GraphQL(hackernews_gqlgen_server.NewExecutableSchema(hackernews_gqlgen_server.Config{Resolvers: &hackernews_gqlgen_server.Resolver{}}))) log.Printf("connect to http://localhost:%s/ for GraphQL playground", port) log.Fatal(http.ListenAndServe(":"+port, nil)) } |
Click to show internal directories.
Click to hide internal directories.