gql

package
v0.0.0-...-027ea5e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBAddContact

func DBAddContact(input *NewContact, userId int64) (int64, error)

func DBCreateUser

func DBCreateUser(input *NewUser) (int64, error)

func DBDeleteContact

func DBDeleteContact(userId, cid int64) error

func DBGetUser

func DBGetUser(user *User) error

func DBUpdateContact

func DBUpdateContact(input *ContactUpdate, userId int64) (int64, error)

func MarshalID

func MarshalID(id int64) graphql.Marshaler

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func UnmarshalID

func UnmarshalID(v interface{}) (int64, error)

Types

type ComplexityRoot

type ComplexityRoot struct {
	Contact struct {
		Address func(childComplexity int) int
		Cid     func(childComplexity int) int
		Email   func(childComplexity int) int
		Name    func(childComplexity int) int
		Phone   func(childComplexity int) int
	}

	Mutation struct {
		AddContacts    func(childComplexity int, input []NewContact) int
		CreateUser     func(childComplexity int, input NewUser) int
		DeleteContacts func(childComplexity int, input []int64) int
		UpdateContacts func(childComplexity int, input []ContactUpdate) int
	}

	Query struct {
		User func(childComplexity int) int
	}

	User struct {
		Contacts func(childComplexity int, limit *int, offset *int) int
		Email    func(childComplexity int) int
		Uid      func(childComplexity int) int
		Username func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

func NewRootResolvers

func NewRootResolvers() Config

type Contact

type Contact struct {
	Cid     int64
	Name    string
	Phone   string
	Address string
	Email   string
}

func DBGetContacts

func DBGetContacts(userId int64, limit int, offset int) ([]Contact, error)

type ContactUpdate

type ContactUpdate struct {
	Cid     int64  `json:"cid"`
	Name    string `json:"name"`
	Phone   string `json:"phone"`
	Address string `json:"address"`
	Email   string `json:"email"`
}

type DirectiveRoot

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

type MutationResolver

type MutationResolver interface {
	CreateUser(ctx context.Context, input NewUser) (*User, error)
	AddContacts(ctx context.Context, input []NewContact) ([]*int64, error)
	DeleteContacts(ctx context.Context, input []int64) ([]*int64, error)
	UpdateContacts(ctx context.Context, input []ContactUpdate) ([]*int64, error)
}

type NewContact

type NewContact struct {
	Name    string `json:"name"`
	Phone   string `json:"phone"`
	Address string `json:"address"`
	Email   string `json:"email"`
}

type NewUser

type NewUser struct {
	Username string `json:"username"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

type QueryResolver

type QueryResolver interface {
	User(ctx context.Context) (*User, error)
}

type Resolver

type Resolver struct{}

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

func (*Resolver) User

func (r *Resolver) User() UserResolver

type ResolverRoot

type ResolverRoot interface {
	Mutation() MutationResolver
	Query() QueryResolver
	User() UserResolver
}

type User

type User struct {
	Uid      int64
	Username string
	Email    string
}

type UserResolver

type UserResolver interface {
	Contacts(ctx context.Context, obj *User, limit *int, offset *int) ([]Contact, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL