laisky_blog_graphql

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2019 License: MIT Imports: 15 Imported by: 0

README

laisky-blog-graphql

graphql backend for laisky-blog

Run:

go run -race entrypoints/main.go --debug --addr=127.0.0.1:8080 --dbaddr=127.0.0.1:27017

Build:

docker build . -t ppcelery/laisky-blog-graphql:0.1

Documentation

Index

Constants

View Source
const (
	TWITTER_DB_NAME  = "twitter"
	TWITTER_COL_NAME = "tweets"
)

Variables

View Source
var (
	Server = iris.New()
)

Functions

func DialDB

func DialDB(addr string)

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func RunServer

func RunServer(addr string)

Types

type ComplexityRoot

type ComplexityRoot struct {
	Query struct {
		Tweets func(childComplexity int, page *Pagination, topic string, regexp string) int
	}

	Tweet struct {
		CreatedAt func(childComplexity int) int
		MongoID   func(childComplexity int) int
		Text      func(childComplexity int) int
		Topics    func(childComplexity int) int
		TweetID   func(childComplexity int) int
		User      func(childComplexity int) int
	}

	TwitterUser struct {
		Description func(childComplexity int) int
		ID          func(childComplexity int) int
		Name        func(childComplexity int) int
		ScreenName  func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type Pagination

type Pagination struct {
	Page int `json:"page"`
	Size int `json:"size"`
}

type QueryResolver

type QueryResolver interface {
	Tweets(ctx context.Context, page *Pagination, topic string, regexp string) ([]twitter.Tweet, error)
}

type Resolver

type Resolver struct{}

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

func (*Resolver) Tweet

func (r *Resolver) Tweet() TweetResolver

func (*Resolver) TwitterUser

func (r *Resolver) TwitterUser() TwitterUserResolver

type ResolverRoot

type ResolverRoot interface {
	Query() QueryResolver
	Tweet() TweetResolver
	TwitterUser() TwitterUserResolver
}

type TweetResolver

type TweetResolver interface {
	MongoID(ctx context.Context, obj *twitter.Tweet) (string, error)
	TweetID(ctx context.Context, obj *twitter.Tweet) (int, error)
	CreatedAt(ctx context.Context, obj *twitter.Tweet) (string, error)
}

type TwitterUserResolver

type TwitterUserResolver interface {
	Description(ctx context.Context, obj *twitter.User) (*string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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