gen

package
v0.0.0-...-5227f5e Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyPrincipalID      key    = iota
	KeyLoaders          key    = iota
	KeyExecutableSchema key    = iota
	KeyJWTClaims        key    = iota
	SchemaSDL           string = `` /* 2406-byte string literal not displayed */

)

Variables

Functions

func ApplyChanges

func ApplyChanges(changes map[string]interface{}, to interface{}) error

used to convert map[string]interface{} to EntityChanges struct

func DeleteAllCommentsHandler

func DeleteAllCommentsHandler(ctx context.Context, r *GeneratedResolver) (bool, error)

func GetHTTPServeMux

func GetHTTPServeMux(r ResolverRoot, db *DB) *http.ServeMux

func GetLoaders

func GetLoaders(db *DB) map[string]*dataloader.Loader

func Marshal_Any

func Marshal_Any(v interface{}) graphql.Marshaler

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func Unmarshal_Any

func Unmarshal_Any(v interface{}) (interface{}, error)

Types

type Comment

type Comment struct {
	ID          string     `json:"id" gorm:"column:id;primary_key"`
	Text        *string    `json:"text" gorm:"column:text;type:text"`
	Reference   *string    `json:"reference" gorm:"column:reference"`
	ReferenceID *string    `json:"referenceID" gorm:"column:referenceID"`
	UpdatedAt   *time.Time `json:"updatedAt" gorm:"column:updatedAt"`
	CreatedAt   time.Time  `json:"createdAt" gorm:"column:createdAt"`
	UpdatedBy   *string    `json:"updatedBy" gorm:"column:updatedBy"`
	CreatedBy   *string    `json:"createdBy" gorm:"column:createdBy"`
}

func CreateCommentHandler

func CreateCommentHandler(ctx context.Context, r *GeneratedResolver, input map[string]interface{}) (item *Comment, err error)

func DeleteCommentHandler

func DeleteCommentHandler(ctx context.Context, r *GeneratedResolver, id string) (item *Comment, err error)

func UpdateCommentHandler

func UpdateCommentHandler(ctx context.Context, r *GeneratedResolver, id string, input map[string]interface{}) (item *Comment, err error)

func (*Comment) Is_Entity

func (m *Comment) Is_Entity()

type CommentChanges

type CommentChanges struct {
	ID          string
	Text        *string
	Reference   *string
	ReferenceID *string
	UpdatedAt   *time.Time
	CreatedAt   time.Time
	UpdatedBy   *string
	CreatedBy   *string
}

type CommentFilterType

type CommentFilterType struct {
	And             []*CommentFilterType `json:"AND"`
	Or              []*CommentFilterType `json:"OR"`
	ID              *string              `json:"id"`
	IDNe            *string              `json:"id_ne"`
	IDGt            *string              `json:"id_gt"`
	IDLt            *string              `json:"id_lt"`
	IDGte           *string              `json:"id_gte"`
	IDLte           *string              `json:"id_lte"`
	IDIn            []string             `json:"id_in"`
	Text            *string              `json:"text"`
	TextNe          *string              `json:"text_ne"`
	TextGt          *string              `json:"text_gt"`
	TextLt          *string              `json:"text_lt"`
	TextGte         *string              `json:"text_gte"`
	TextLte         *string              `json:"text_lte"`
	TextIn          []string             `json:"text_in"`
	TextLike        *string              `json:"text_like"`
	TextPrefix      *string              `json:"text_prefix"`
	TextSuffix      *string              `json:"text_suffix"`
	Reference       *string              `json:"reference"`
	ReferenceNe     *string              `json:"reference_ne"`
	ReferenceGt     *string              `json:"reference_gt"`
	ReferenceLt     *string              `json:"reference_lt"`
	ReferenceGte    *string              `json:"reference_gte"`
	ReferenceLte    *string              `json:"reference_lte"`
	ReferenceIn     []string             `json:"reference_in"`
	ReferenceLike   *string              `json:"reference_like"`
	ReferencePrefix *string              `json:"reference_prefix"`
	ReferenceSuffix *string              `json:"reference_suffix"`
	ReferenceID     *string              `json:"referenceID"`
	ReferenceIDNe   *string              `json:"referenceID_ne"`
	ReferenceIDGt   *string              `json:"referenceID_gt"`
	ReferenceIDLt   *string              `json:"referenceID_lt"`
	ReferenceIDGte  *string              `json:"referenceID_gte"`
	ReferenceIDLte  *string              `json:"referenceID_lte"`
	ReferenceIDIn   []string             `json:"referenceID_in"`
	UpdatedAt       *time.Time           `json:"updatedAt"`
	UpdatedAtNe     *time.Time           `json:"updatedAt_ne"`
	UpdatedAtGt     *time.Time           `json:"updatedAt_gt"`
	UpdatedAtLt     *time.Time           `json:"updatedAt_lt"`
	UpdatedAtGte    *time.Time           `json:"updatedAt_gte"`
	UpdatedAtLte    *time.Time           `json:"updatedAt_lte"`
	UpdatedAtIn     []*time.Time         `json:"updatedAt_in"`
	CreatedAt       *time.Time           `json:"createdAt"`
	CreatedAtNe     *time.Time           `json:"createdAt_ne"`
	CreatedAtGt     *time.Time           `json:"createdAt_gt"`
	CreatedAtLt     *time.Time           `json:"createdAt_lt"`
	CreatedAtGte    *time.Time           `json:"createdAt_gte"`
	CreatedAtLte    *time.Time           `json:"createdAt_lte"`
	CreatedAtIn     []*time.Time         `json:"createdAt_in"`
	UpdatedBy       *string              `json:"updatedBy"`
	UpdatedByNe     *string              `json:"updatedBy_ne"`
	UpdatedByGt     *string              `json:"updatedBy_gt"`
	UpdatedByLt     *string              `json:"updatedBy_lt"`
	UpdatedByGte    *string              `json:"updatedBy_gte"`
	UpdatedByLte    *string              `json:"updatedBy_lte"`
	UpdatedByIn     []string             `json:"updatedBy_in"`
	CreatedBy       *string              `json:"createdBy"`
	CreatedByNe     *string              `json:"createdBy_ne"`
	CreatedByGt     *string              `json:"createdBy_gt"`
	CreatedByLt     *string              `json:"createdBy_lt"`
	CreatedByGte    *string              `json:"createdBy_gte"`
	CreatedByLte    *string              `json:"createdBy_lte"`
	CreatedByIn     []string             `json:"createdBy_in"`
}

func (*CommentFilterType) AndWith

AndWith convenience method for combining two or more filters with AND statement

func (*CommentFilterType) Apply

func (f *CommentFilterType) Apply(ctx context.Context, dialect gorm.Dialect, wheres *[]string, values *[]interface{}, joins *[]string) error

func (*CommentFilterType) ApplyWithAlias

func (f *CommentFilterType) ApplyWithAlias(ctx context.Context, dialect gorm.Dialect, alias string, wheres *[]string, values *[]interface{}, joins *[]string) error

func (*CommentFilterType) IsEmpty

func (f *CommentFilterType) IsEmpty(ctx context.Context, dialect gorm.Dialect) bool

func (*CommentFilterType) OrWith

OrWith convenience method for combining two or more filters with OR statement

func (*CommentFilterType) WhereContent

func (f *CommentFilterType) WhereContent(dialect gorm.Dialect, aliasPrefix string) (conditions []string, values []interface{})

type CommentQueryFilter

type CommentQueryFilter struct {
	Query *string
}

func (*CommentQueryFilter) Apply

func (qf *CommentQueryFilter) Apply(ctx context.Context, dialect gorm.Dialect, selectionSet *ast.SelectionSet, wheres *[]string, values *[]interface{}, joins *[]string) error

type CommentResultType

type CommentResultType struct {
	resolvers.EntityResultType
}

type CommentResultTypeResolver

type CommentResultTypeResolver interface {
	Items(ctx context.Context, obj *CommentResultType) ([]*Comment, error)
	Count(ctx context.Context, obj *CommentResultType) (int, error)
}

type CommentSortType

type CommentSortType string
const (
	CommentSortTypeIDAsc           CommentSortType = "ID_ASC"
	CommentSortTypeIDDesc          CommentSortType = "ID_DESC"
	CommentSortTypeTextAsc         CommentSortType = "TEXT_ASC"
	CommentSortTypeTextDesc        CommentSortType = "TEXT_DESC"
	CommentSortTypeReferenceAsc    CommentSortType = "REFERENCE_ASC"
	CommentSortTypeReferenceDesc   CommentSortType = "REFERENCE_DESC"
	CommentSortTypeReferenceIDAsc  CommentSortType = "REFERENCE_ID_ASC"
	CommentSortTypeReferenceIDDesc CommentSortType = "REFERENCE_ID_DESC"
	CommentSortTypeUpdatedAtAsc    CommentSortType = "UPDATED_AT_ASC"
	CommentSortTypeUpdatedAtDesc   CommentSortType = "UPDATED_AT_DESC"
	CommentSortTypeCreatedAtAsc    CommentSortType = "CREATED_AT_ASC"
	CommentSortTypeCreatedAtDesc   CommentSortType = "CREATED_AT_DESC"
	CommentSortTypeUpdatedByAsc    CommentSortType = "UPDATED_BY_ASC"
	CommentSortTypeUpdatedByDesc   CommentSortType = "UPDATED_BY_DESC"
	CommentSortTypeCreatedByAsc    CommentSortType = "CREATED_BY_ASC"
	CommentSortTypeCreatedByDesc   CommentSortType = "CREATED_BY_DESC"
)

func (CommentSortType) IsValid

func (e CommentSortType) IsValid() bool

func (CommentSortType) MarshalGQL

func (e CommentSortType) MarshalGQL(w io.Writer)

func (CommentSortType) String

func (e CommentSortType) String() string

func (*CommentSortType) UnmarshalGQL

func (e *CommentSortType) UnmarshalGQL(v interface{}) error

type ComplexityRoot

type ComplexityRoot struct {
	Comment struct {
		CreatedAt   func(childComplexity int) int
		CreatedBy   func(childComplexity int) int
		ID          func(childComplexity int) int
		Reference   func(childComplexity int) int
		ReferenceID func(childComplexity int) int
		Text        func(childComplexity int) int
		UpdatedAt   func(childComplexity int) int
		UpdatedBy   func(childComplexity int) int
	}

	CommentResultType struct {
		Count func(childComplexity int) int
		Items func(childComplexity int) int
	}

	Mutation struct {
		CreateComment     func(childComplexity int, input map[string]interface{}) int
		DeleteAllComments func(childComplexity int) int
		DeleteComment     func(childComplexity int, id string) int
		UpdateComment     func(childComplexity int, id string, input map[string]interface{}) int
	}

	Query struct {
		Comment  func(childComplexity int, id *string, q *string, filter *CommentFilterType) int
		Comments func(childComplexity int, offset *int, limit *int, q *string, sort []CommentSortType, filter *CommentFilterType) int
		// contains filtered or unexported fields
	}
	// contains filtered or unexported fields
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DB

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

DB ...

func NewDB

func NewDB(db *gorm.DB) *DB

NewDB ...

func NewDBFromEnvVars

func NewDBFromEnvVars() *DB

NewDBFromEnvVars Create database client using DATABASE_URL environment variable

func NewDBWithString

func NewDBWithString(urlString string) *DB

NewDBWithString ...

func (*DB) AutoMigrate

func (db *DB) AutoMigrate() *gorm.DB

AutoMigrate ...

func (*DB) Close

func (db *DB) Close() error

Close ...

func (*DB) Ping

func (db *DB) Ping() error

func (*DB) Query

func (db *DB) Query() *gorm.DB

Query ...

type DirectiveRoot

type DirectiveRoot struct {
}

type GeneratedCommentResultTypeResolver

type GeneratedCommentResultTypeResolver struct{ *GeneratedResolver }

func (*GeneratedCommentResultTypeResolver) Count

func (*GeneratedCommentResultTypeResolver) Items

type GeneratedMutationResolver

type GeneratedMutationResolver struct{ *GeneratedResolver }

func (*GeneratedMutationResolver) CreateComment

func (r *GeneratedMutationResolver) CreateComment(ctx context.Context, input map[string]interface{}) (item *Comment, err error)

func (*GeneratedMutationResolver) DeleteAllComments

func (r *GeneratedMutationResolver) DeleteAllComments(ctx context.Context) (bool, error)

func (*GeneratedMutationResolver) DeleteComment

func (r *GeneratedMutationResolver) DeleteComment(ctx context.Context, id string) (item *Comment, err error)

func (*GeneratedMutationResolver) UpdateComment

func (r *GeneratedMutationResolver) UpdateComment(ctx context.Context, id string, input map[string]interface{}) (item *Comment, err error)

type GeneratedQueryResolver

type GeneratedQueryResolver struct{ *GeneratedResolver }

func (*GeneratedQueryResolver) Comment

func (r *GeneratedQueryResolver) Comment(ctx context.Context, id *string, q *string, filter *CommentFilterType) (*Comment, error)

func (*GeneratedQueryResolver) Comments

func (r *GeneratedQueryResolver) Comments(ctx context.Context, offset *int, limit *int, q *string, sort []CommentSortType, filter *CommentFilterType) (*CommentResultType, error)

type GeneratedResolver

type GeneratedResolver struct {
	Handlers        ResolutionHandlers
	DB              *DB
	EventController *events.EventController
}

type JWTClaims

type JWTClaims struct {
	jwtgo.StandardClaims
	Scope *string
}

type MutationResolver

type MutationResolver interface {
	CreateComment(ctx context.Context, input map[string]interface{}) (*Comment, error)
	UpdateComment(ctx context.Context, id string, input map[string]interface{}) (*Comment, error)
	DeleteComment(ctx context.Context, id string) (*Comment, error)
	DeleteAllComments(ctx context.Context) (bool, error)
}

type NotFoundError

type NotFoundError struct {
	Entity string
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type QueryCommentHandlerOptions

type QueryCommentHandlerOptions struct {
	ID     *string
	Q      *string
	Filter *CommentFilterType
}

type QueryCommentsHandlerOptions

type QueryCommentsHandlerOptions struct {
	Offset *int
	Limit  *int
	Q      *string
	Sort   []CommentSortType
	Filter *CommentFilterType
}

type QueryResolver

type QueryResolver interface {
	Comment(ctx context.Context, id *string, q *string, filter *CommentFilterType) (*Comment, error)
	Comments(ctx context.Context, offset *int, limit *int, q *string, sort []CommentSortType, filter *CommentFilterType) (*CommentResultType, error)
	// contains filtered or unexported methods
}

type ResolutionHandlers

type ResolutionHandlers struct {
	CreateComment     func(ctx context.Context, r *GeneratedResolver, input map[string]interface{}) (item *Comment, err error)
	UpdateComment     func(ctx context.Context, r *GeneratedResolver, id string, input map[string]interface{}) (item *Comment, err error)
	DeleteComment     func(ctx context.Context, r *GeneratedResolver, id string) (item *Comment, err error)
	DeleteAllComments func(ctx context.Context, r *GeneratedResolver) (bool, error)
	QueryComment      func(ctx context.Context, r *GeneratedResolver, opts QueryCommentHandlerOptions) (*Comment, error)
	QueryComments     func(ctx context.Context, r *GeneratedResolver, opts QueryCommentsHandlerOptions) (*CommentResultType, error)
}

func DefaultResolutionHandlers

func DefaultResolutionHandlers() ResolutionHandlers

type ResolverRoot

type ResolverRoot interface {
	CommentResultType() CommentResultTypeResolver
	Mutation() MutationResolver
	Query() QueryResolver
}

Jump to

Keyboard shortcuts

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