graphql

package
v0.0.0-...-6237511 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorizedID = "authID"

AuthorizedID is a context.Context key where an authorized ID value stored

Variables

This section is empty.

Functions

func BuildCategorySchema

func BuildCategorySchema(repository blog.CategoryRepository) func(*schemabuilder.Schema)

BuildCategorySchema builds all category related schemas

func BuildFileSchema

func BuildFileSchema(repository storage.FileRepository) func(*schemabuilder.Schema)

BuildFileSchema builds all file related schemas

func BuildGraphAPISchema

func BuildGraphAPISchema(baseURL string, c facebook.Client) func(*schemabuilder.Schema)

BuildGraphAPISchema builds all Facebook Graph API related schemas

func BuildPostSchema

func BuildPostSchema(repository blog.PostRepository) func(*schemabuilder.Schema)

BuildPostSchema builds all post related schemas

func BuildSchema

func BuildSchema(buildSchemaFunc ...func(*schemabuilder.Schema)) (*graphql.Schema, error)

BuildSchema accepts build schema function(s) for applying to the schemabuilding.Schema object

func BuildTagSchema

func BuildTagSchema(repository blog.TagRepository) func(*schemabuilder.Schema)

BuildTagSchema builds all tag related schemas

func CreatePostFieldFunc

func CreatePostFieldFunc(repository blog.PostRepository) interface{}

CreatePostFieldFunc handles the following mutation ```graphql

mutation {
	createPost { ... }
}

```

func FindAllAttachmentsBelongedToPostFieldFunc

func FindAllAttachmentsBelongedToPostFieldFunc(repository storage.FileRepository) interface{}

FindAllAttachmentsBelongedToPostFieldFunc handles the following query in the Post type ```graphql

{
	Post {
		...
		attachments { ... }
	}
}

```

func FindAllCategoriesBelongedToPostFieldFunc

func FindAllCategoriesBelongedToPostFieldFunc(repository blog.CategoryRepository) interface{}

FindAllCategoriesBelongedToPostFieldFunc handles the following query in the Post type ```graphql

{
	Post {
		...
		categories { ... }
	}
}

```

func FindAllCategoriesFieldFunc

func FindAllCategoriesFieldFunc(repository blog.CategoryRepository) interface{}

FindAllCategoriesFieldFunc handles the following query ```graphql

{
	categories { ... }
}

```

func FindAllLPPBelongedToCategoryFieldFunc

func FindAllLPPBelongedToCategoryFieldFunc(repository blog.PostRepository) interface{}

FindAllLPPBelongedToCategoryFieldFunc handles the following query in the Category type ```graphql

{
	Category {
		...
		latestPublishedPosts(offset: int!, limit: int!) { ... }
	}
}

```

func FindAllLPPBelongedToTagFieldFunc

func FindAllLPPBelongedToTagFieldFunc(repository blog.PostRepository) interface{}

FindAllLPPBelongedToTagFieldFunc handles the following query in the Tag type ```graphql

{
	Tag {
		...
		latestPublishedPosts(offset: int!, limit: int!) { ... }
	}
}

```

func FindAllLatestPublishedPostsFieldFunc

func FindAllLatestPublishedPostsFieldFunc(repository blog.PostRepository) interface{}

FindAllLatestPublishedPostsFieldFunc handles the following query ```graphql

{
	latestPublishedPosts(offset: int!, limit: int!) { ... }
}

```

func FindAllMyPostsFieldFunc

func FindAllMyPostsFieldFunc(repository blog.PostRepository) interface{}

FindAllMyPostsFieldFunc handles the following query ```graphql

{
	myPosts(offset: int!, limit: int!) { ... }
}

```

func FindAllTagsBelongedToPostFieldFunc

func FindAllTagsBelongedToPostFieldFunc(repository blog.TagRepository) interface{}

FindAllTagsBelongedToPostFieldFunc handles the following query in the Post type ```graphql

{
	Post {
		...
		tags { ... }
	}
}

```

func FindAllTagsFieldFunc

func FindAllTagsFieldFunc(repository blog.TagRepository) interface{}

FindAllTagsFieldFunc handles the following query ```graphql

{
	tags { ... }
}

```

func FindCategoryBySlugFieldFunc

func FindCategoryBySlugFieldFunc(repository blog.CategoryRepository) interface{}

FindCategoryBySlugFieldFunc handles the following query ```graphql

{
	category(slug: string!) { ... }
}

```

func FindFeaturedImageBelongedToPostFieldFunc

func FindFeaturedImageBelongedToPostFieldFunc(repository storage.FileRepository) interface{}

FindFeaturedImageBelongedToPostFieldFunc handles the following query in the Post type ```graphql

{
	Post {
		...
		featuredImage { .. }
	}
}

```

func FindPostBySlugFieldFunc

func FindPostBySlugFieldFunc(repository blog.PostRepository) interface{}

FindPostBySlugFieldFunc handles the following query ```graphql

{
	post(slug: string!) { ... }
}

```

func FindTagBySlugFieldFunc

func FindTagBySlugFieldFunc(repository blog.TagRepository) interface{}

FindTagBySlugFieldFunc handles the following query ```graphql

{
	tag(slug: string!) { ... }
}

```

func GetURLNodeShareCountFieldFunc

func GetURLNodeShareCountFieldFunc(baseURL string, c facebook.Client) interface{}

GetURLNodeShareCountFieldFunc handles the following query in the Post type ```graphql

{
	Post {
		...
		engagement { ... }
	}
}

```

func Handler

func Handler(schema *graphql.Schema, middlewares ...graphql.MiddlewareFunc) http.Handler

Handler is a wrapped function to the original graphql.HTTPHandler for avoiding package name conflict

func ServeGraphiqlHandlerFunc

func ServeGraphiqlHandlerFunc(tmpl []byte) http.HandlerFunc

ServeGraphiqlHandlerFunc provides a GraphQL Playground page

func UpdatePostAttachmentsFieldFunc

func UpdatePostAttachmentsFieldFunc(repository blog.PostRepository) interface{}

UpdatePostAttachmentsFieldFunc handles the following mutation ```graphql

mutation {
	updatePostAttachments(slug: string!, attachmentSlugs: [string!]!) { ... }
}

```

func UpdatePostCategoriesFieldFunc

func UpdatePostCategoriesFieldFunc(repository blog.PostRepository) interface{}

UpdatePostCategoriesFieldFunc handles the following mutation ```graphql

mutation {
	updatePostCategories(slug: string!, categorySlugs: [string!]!) { ... }
}

```

func UpdatePostContentFieldFunc

func UpdatePostContentFieldFunc(repository blog.PostRepository) interface{}

UpdatePostContentFieldFunc handles the following mutation ```graphql

mutation {
	updatePostContent(slug: string!, markdown: string!) { ... }
}

```

func UpdatePostFeaturedImageFieldFunc

func UpdatePostFeaturedImageFieldFunc(repository blog.PostRepository) interface{}

UpdatePostFeaturedImageFieldFunc handles the following mutation ```graphql

mutation {
	updatePostFeaturedImage(slug: string!, featuredImageSlug: string!) { ... }
}

```

func UpdatePostStatusFieldFunc

func UpdatePostStatusFieldFunc(repository blog.PostRepository) interface{}

UpdatePostStatusFieldFunc handles the following mutation ```graphql

mutation {
	updatePostStatus(slug: string!, status: Status!) { ... }
}

```

func UpdatePostTagsFieldFunc

func UpdatePostTagsFieldFunc(repository blog.PostRepository) interface{}

UpdatePostTagsFieldFunc handles the following mutation ```graphql

mutation {
	updatePostTags(slug: string!, tags: [string!]!) { ... }
}

```

func UpdatePostTitleFieldFunc

func UpdatePostTitleFieldFunc(repository blog.PostRepository) interface{}

UpdatePostTitleFieldFunc handles the following mutation ```graphql

mutation {
	updatePostTitle(slug: string!, title: string!) { ... }
}

```

func VerifyAuthorityMiddleware

func VerifyAuthorityMiddleware(input *graphql.ComputationInput, next graphql.MiddlewareNextFunc) *graphql.ComputationOutput

VerifyAuthorityMiddleware looks on the request header for the authorization token

Types

type Slug

type Slug string

Slug is a valid URL string composes with title and ID

func (Slug) GetID

func (s Slug) GetID() (interface{}, error)

GetID returns an ID from the slug string

func (Slug) MustGetID

func (s Slug) MustGetID() interface{}

MustGetID always return ID from the slug string

Jump to

Keyboard shortcuts

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