gqlgen: github.com/99designs/gqlgen/example/chat Index | Files | Directories

package chat

import "github.com/99designs/gqlgen/example/chat"

Index

Package Files

generated.go models_gen.go resolvers.go

func NewExecutableSchema Uses

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

type Chatroom Uses

type Chatroom struct {
    Name      string
    Messages  []Message
    Observers map[string]struct {
        Username string
        Message  chan *Message
    }
}

type ComplexityRoot Uses

type ComplexityRoot struct {
    Chatroom struct {
        Messages func(childComplexity int) int
        Name     func(childComplexity int) int
    }

    Message struct {
        CreatedAt func(childComplexity int) int
        CreatedBy func(childComplexity int) int
        ID        func(childComplexity int) int
        Text      func(childComplexity int) int
    }

    Mutation struct {
        Post func(childComplexity int, text string, username string, roomName string) int
    }

    Query struct {
        Room func(childComplexity int, name string) int
    }

    Subscription struct {
        MessageAdded func(childComplexity int, roomName string) int
    }
}

type Config Uses

type Config struct {
    Resolvers  ResolverRoot
    Directives DirectiveRoot
    Complexity ComplexityRoot
}

func New Uses

func New() Config

type DirectiveRoot Uses

type DirectiveRoot struct {
    User func(ctx context.Context, obj interface{}, next graphql.Resolver, username string) (res interface{}, err error)
}

type Message Uses

type Message struct {
    ID        string    `json:"id"`
    Text      string    `json:"text"`
    CreatedBy string    `json:"createdBy"`
    CreatedAt time.Time `json:"createdAt"`
}

type MutationResolver Uses

type MutationResolver interface {
    Post(ctx context.Context, text string, username string, roomName string) (*Message, error)
}

type QueryResolver Uses

type QueryResolver interface {
    Room(ctx context.Context, name string) (*Chatroom, error)
}

type ResolverRoot Uses

type ResolverRoot interface {
    Mutation() MutationResolver
    Query() QueryResolver
    Subscription() SubscriptionResolver
}

type SubscriptionResolver Uses

type SubscriptionResolver interface {
    MessageAdded(ctx context.Context, roomName string) (<-chan *Message, error)
}

Directories

PathSynopsis
server

Package chat imports 12 packages (graph) and is imported by 2 packages. Updated 2020-07-28. Refresh now. Tools for package owners.