graph

package
v0.0.0-...-98da0ec Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Schema string

Schema is the GraphQL schema

Functions

func AssertPermissions

func AssertPermissions(ctx context.Context, verb string, subject interface{}, args interface{}, input interface{}) ([]qm.QueryMod, error)

func QueryModPagination

func QueryModPagination(sinceID *graphql.ID, pageNum, pageSize *int32) []qm.QueryMod

QueryModPagination returns SQLBoiler QueryMods for pagination Supports limit-offset and keyset pagination techniques based on the arguments provided

Limit-offset is used to paginate arbitrary queries. Please note that there are performance and inconsistency implications when using this technique. Sample: `QueryModPagination(nil, 5, 25)` Retrieves page 5 (from 125 - 150), using default order

Keyset pagination is used to paginate ordered queries (by indexed column - ID) Typically used if performance and page result consistency is important. Sample: `QueryModPagination("123", nil, 25)` Retrieves all next 25 records *after* ID 123, ordered by ID

Note: If both sinceID and pageNum is provided, sinceID (keyset pagination) will be used. Reference: https://www.citusdata.com/blog/2016/03/30/five-ways-to-paginate/

func QueryModSearch

func QueryModSearch(input interface{}) []qm.QueryMod

QueryModSearch returns a list of search QueryMod based on the struct values

Types

type Base64

type Base64 string

Base64 represents a custom GraphQL "Base64" scalar type Implements graphql.Unmarshaler

func (Base64) ImplementsGraphQLType

func (Base64) ImplementsGraphQLType(name string) bool

ImplementsGraphQLType returns the GraphQL type name

func (Base64) MarshalJSON

func (i Base64) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON marshalling

func (*Base64) ToGo

func (i *Base64) ToGo() ([]byte, error)

ToGo converts the custom scalar type to Go type

func (*Base64) UnmarshalGraphQL

func (i *Base64) UnmarshalGraphQL(input interface{}) error

UnmarshalGraphQL unmarshals the GraphQL type

type Comment

type Comment struct {
	// contains filtered or unexported fields
}

Comment is an object to back GraphQL type

func NewComment

func NewComment(db boil.Executor, model dbmodel.Comment) Comment

NewComment returns a new Comment instance

func (Comment) Author

func (o Comment) Author() string

Author is the Comment author

func (Comment) Body

func (o Comment) Body() string

Body is the Comment body

func (Comment) CreatedAt

func (o Comment) CreatedAt() *graphql.Time

CreatedAt is the Comment created_at

func (Comment) ID

func (o Comment) ID() graphql.ID

ID is the Comment id

func (Comment) Notes

func (o Comment) Notes() *string

Notes is the Comment notes

func (Comment) Post

func (o Comment) Post() *Post

Post pointed to by the foreign key

func (Comment) PostID

func (o Comment) PostID() int32

PostID is the Comment post_id

func (Comment) RowID

func (o Comment) RowID() string

RowID is the Comment GUID

func (Comment) UpdatedAt

func (o Comment) UpdatedAt() *graphql.Time

UpdatedAt is the Comment updated_at

type CommentsCollection

type CommentsCollection struct {
	// contains filtered or unexported fields
}

CommentsCollection is the struct representing a collection of GraphQL types

func NewCommentsCollection

func NewCommentsCollection(db boil.Executor, slice dbmodel.CommentSlice) CommentsCollection

NewCommentsCollection returns a new CommentsCollection instance

func (CommentsCollection) Nodes

func (c CommentsCollection) Nodes(ctx context.Context) []Comment

Nodes returns the list of GraphQL types

type Int64

type Int64 string

Int64 represents a custom GraphQL "Int64" scalar type Implements graphql.Unmarshaler

func (Int64) ImplementsGraphQLType

func (Int64) ImplementsGraphQLType(name string) bool

ImplementsGraphQLType returns the GraphQL type name

func (Int64) MarshalJSON

func (i Int64) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON marshalling

func (*Int64) ToGo

func (i *Int64) ToGo() (int64, error)

ToGo converts the custom scalar type to Go type

func (*Int64) UnmarshalGraphQL

func (i *Int64) UnmarshalGraphQL(input interface{}) error

UnmarshalGraphQL unmarshals the GraphQL type

type Post

type Post struct {
	// contains filtered or unexported fields
}

Post is an object to back GraphQL type

func NewPost

func NewPost(db boil.Executor, model dbmodel.Post) Post

NewPost returns a new Post instance

func (Post) Author

func (o Post) Author() string

Author is the Post author

func (Post) Body

func (o Post) Body() string

Body is the Post body

func (Post) Comments

func (o Post) Comments() *CommentsCollection

Comments returns the list of Comments that has a foreign key pointing to Post

func (Post) CreatedAt

func (o Post) CreatedAt() *graphql.Time

CreatedAt is the Post created_at

func (Post) ID

func (o Post) ID() graphql.ID

ID is the Post id

func (Post) Notes

func (o Post) Notes() *string

Notes is the Post notes

func (Post) RowID

func (o Post) RowID() string

RowID is the Post GUID

func (Post) Title

func (o Post) Title() string

Title is the Post title

func (Post) UpdatedAt

func (o Post) UpdatedAt() *graphql.Time

UpdatedAt is the Post updated_at

type PostsCollection

type PostsCollection struct {
	// contains filtered or unexported fields
}

PostsCollection is the struct representing a collection of GraphQL types

func NewPostsCollection

func NewPostsCollection(db boil.Executor, slice dbmodel.PostSlice) PostsCollection

NewPostsCollection returns a new PostsCollection instance

func (PostsCollection) Nodes

func (c PostsCollection) Nodes(ctx context.Context) []Post

Nodes returns the list of GraphQL types

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver is the root GraphQL resolver

func NewResolver

func NewResolver(databaseURL string) (*Resolver, error)

NewResolver returns a new root GraphQL resolver

func (*Resolver) CommentByID

func (r *Resolver) CommentByID(ctx context.Context, args struct {
	ID graphql.ID
}) (Comment, error)

CommentByID retrieves Comment by ID

func (*Resolver) CreateComment

func (r *Resolver) CreateComment(ctx context.Context, args struct {
	Input createCommentInput
}) (Comment, error)

CreateComment creates a Comment based on the provided input

func (*Resolver) CreatePost

func (r *Resolver) CreatePost(ctx context.Context, args struct {
	Input createPostInput
}) (Post, error)

CreatePost creates a Post based on the provided input

func (*Resolver) DeleteCommentByID

func (r *Resolver) DeleteCommentByID(ctx context.Context, args struct {
	ID graphql.ID
}) (Comment, error)

DeleteCommentByID deletes a Comment based on the provided ID

func (*Resolver) DeletePostByID

func (r *Resolver) DeletePostByID(ctx context.Context, args struct {
	ID graphql.ID
}) (Post, error)

DeletePostByID deletes a Post based on the provided ID

func (*Resolver) PostByID

func (r *Resolver) PostByID(ctx context.Context, args struct {
	ID graphql.ID
}) (Post, error)

PostByID retrieves Post by ID

func (*Resolver) SearchComments

func (r *Resolver) SearchComments(ctx context.Context, args struct {
	SinceID    *graphql.ID
	PageNumber *int32
	PageSize   *int32
	Input      *searchCommentInput
}) (CommentsCollection, error)

SearchComments retrieves Comments based on the provided search parameters

func (*Resolver) SearchPosts

func (r *Resolver) SearchPosts(ctx context.Context, args struct {
	SinceID    *graphql.ID
	PageNumber *int32
	PageSize   *int32
	Input      *searchPostInput
}) (PostsCollection, error)

SearchPosts retrieves Posts based on the provided search parameters

func (*Resolver) UpdateCommentByID

func (r *Resolver) UpdateCommentByID(ctx context.Context, args struct {
	ID    graphql.ID
	Input updateCommentInput
}) (Comment, error)

UpdateCommentByID updates a Comment based on the provided ID and input

func (*Resolver) UpdatePostByID

func (r *Resolver) UpdatePostByID(ctx context.Context, args struct {
	ID    graphql.ID
	Input updatePostInput
}) (Post, error)

UpdatePostByID updates a Post based on the provided ID and input

type Text

type Text string

Text represents a custom GraphQL "Text" scalar type Implements graphql.Unmarshaler

func (Text) ImplementsGraphQLType

func (Text) ImplementsGraphQLType(name string) bool

ImplementsGraphQLType returns the GraphQL type name

func (Text) MarshalJSON

func (i Text) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON marshalling

func (*Text) ToGo

func (i *Text) ToGo() ([]byte, error)

ToGo converts the custom scalar type to Go type

func (*Text) UnmarshalGraphQL

func (i *Text) UnmarshalGraphQL(input interface{}) error

UnmarshalGraphQL unmarshals the GraphQL type

Jump to

Keyboard shortcuts

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