gen

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 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
	KeyMutationTransaction key    = iota
	KeyMutationEvents      key    = iota
	SchemaSDL              string = `` /* 6012-byte string literal not displayed */

)

Variables

Functions

func AddMutationEvent added in v0.2.0

func AddMutationEvent(ctx context.Context, e events.Event)

func ApplyChanges

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

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

func AutoMigrate added in v0.2.0

func AutoMigrate(db *gorm.DB) error

func DeleteAllCommentsHandler

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

func EnrichContextWithMutations added in v0.2.0

func EnrichContextWithMutations(ctx context.Context, r *GeneratedResolver) context.Context

func FinishMutationContext added in v0.2.0

func FinishMutationContext(ctx context.Context, r *GeneratedResolver) (err error)

func GetHTTPServeMux

func GetHTTPServeMux(r ResolverRoot, db *DB, migrations []*gormigrate.Migration) *http.ServeMux

func GetItem

func GetItem(ctx context.Context, db *gorm.DB, out interface{}, id *string) error

func GetItemForRelation

func GetItemForRelation(ctx context.Context, db *gorm.DB, obj interface{}, relation string, out interface{}) error

func GetLoaders

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

func GetPrincipalIDFromContext

func GetPrincipalIDFromContext(ctx context.Context) *string

func Marshal_Any

func Marshal_Any(v interface{}) graphql.Marshaler

func Migrate added in v0.2.0

func Migrate(db *gorm.DB, options *gormigrate.Options, migrations []*gormigrate.Migration) error

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func RollbackMutationContext added in v0.2.0

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

func TableName

func TableName(name string) string

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"`
	Reference   string     `json:"reference" gorm:"column:reference;index:fetch"`
	ReferenceID string     `json:"referenceID" gorm:"column:referenceID;index:fetch"`
	Text        *string    `json:"text" gorm:"column:text;type:text"`
	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
	Reference   string
	ReferenceID string
	Text        *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"`
	IDMin              *string              `json:"idMin"`
	IDMax              *string              `json:"idMax"`
	IDNe               *string              `json:"id_ne"`
	IDMinNe            *string              `json:"idMin_ne"`
	IDMaxNe            *string              `json:"idMax_ne"`
	IDGt               *string              `json:"id_gt"`
	IDMinGt            *string              `json:"idMin_gt"`
	IDMaxGt            *string              `json:"idMax_gt"`
	IDLt               *string              `json:"id_lt"`
	IDMinLt            *string              `json:"idMin_lt"`
	IDMaxLt            *string              `json:"idMax_lt"`
	IDGte              *string              `json:"id_gte"`
	IDMinGte           *string              `json:"idMin_gte"`
	IDMaxGte           *string              `json:"idMax_gte"`
	IDLte              *string              `json:"id_lte"`
	IDMinLte           *string              `json:"idMin_lte"`
	IDMaxLte           *string              `json:"idMax_lte"`
	IDIn               []string             `json:"id_in"`
	IDMinIn            []string             `json:"idMin_in"`
	IDMaxIn            []string             `json:"idMax_in"`
	IDNull             *bool                `json:"id_null"`
	Reference          *string              `json:"reference"`
	ReferenceMin       *string              `json:"referenceMin"`
	ReferenceMax       *string              `json:"referenceMax"`
	ReferenceNe        *string              `json:"reference_ne"`
	ReferenceMinNe     *string              `json:"referenceMin_ne"`
	ReferenceMaxNe     *string              `json:"referenceMax_ne"`
	ReferenceGt        *string              `json:"reference_gt"`
	ReferenceMinGt     *string              `json:"referenceMin_gt"`
	ReferenceMaxGt     *string              `json:"referenceMax_gt"`
	ReferenceLt        *string              `json:"reference_lt"`
	ReferenceMinLt     *string              `json:"referenceMin_lt"`
	ReferenceMaxLt     *string              `json:"referenceMax_lt"`
	ReferenceGte       *string              `json:"reference_gte"`
	ReferenceMinGte    *string              `json:"referenceMin_gte"`
	ReferenceMaxGte    *string              `json:"referenceMax_gte"`
	ReferenceLte       *string              `json:"reference_lte"`
	ReferenceMinLte    *string              `json:"referenceMin_lte"`
	ReferenceMaxLte    *string              `json:"referenceMax_lte"`
	ReferenceIn        []string             `json:"reference_in"`
	ReferenceMinIn     []string             `json:"referenceMin_in"`
	ReferenceMaxIn     []string             `json:"referenceMax_in"`
	ReferenceLike      *string              `json:"reference_like"`
	ReferenceMinLike   *string              `json:"referenceMin_like"`
	ReferenceMaxLike   *string              `json:"referenceMax_like"`
	ReferencePrefix    *string              `json:"reference_prefix"`
	ReferenceMinPrefix *string              `json:"referenceMin_prefix"`
	ReferenceMaxPrefix *string              `json:"referenceMax_prefix"`
	ReferenceSuffix    *string              `json:"reference_suffix"`
	ReferenceMinSuffix *string              `json:"referenceMin_suffix"`
	ReferenceMaxSuffix *string              `json:"referenceMax_suffix"`
	ReferenceNull      *bool                `json:"reference_null"`
	ReferenceID        *string              `json:"referenceID"`
	ReferenceIDMin     *string              `json:"referenceIDMin"`
	ReferenceIDMax     *string              `json:"referenceIDMax"`
	ReferenceIDNe      *string              `json:"referenceID_ne"`
	ReferenceIDMinNe   *string              `json:"referenceIDMin_ne"`
	ReferenceIDMaxNe   *string              `json:"referenceIDMax_ne"`
	ReferenceIDGt      *string              `json:"referenceID_gt"`
	ReferenceIDMinGt   *string              `json:"referenceIDMin_gt"`
	ReferenceIDMaxGt   *string              `json:"referenceIDMax_gt"`
	ReferenceIDLt      *string              `json:"referenceID_lt"`
	ReferenceIDMinLt   *string              `json:"referenceIDMin_lt"`
	ReferenceIDMaxLt   *string              `json:"referenceIDMax_lt"`
	ReferenceIDGte     *string              `json:"referenceID_gte"`
	ReferenceIDMinGte  *string              `json:"referenceIDMin_gte"`
	ReferenceIDMaxGte  *string              `json:"referenceIDMax_gte"`
	ReferenceIDLte     *string              `json:"referenceID_lte"`
	ReferenceIDMinLte  *string              `json:"referenceIDMin_lte"`
	ReferenceIDMaxLte  *string              `json:"referenceIDMax_lte"`
	ReferenceIDIn      []string             `json:"referenceID_in"`
	ReferenceIDMinIn   []string             `json:"referenceIDMin_in"`
	ReferenceIDMaxIn   []string             `json:"referenceIDMax_in"`
	ReferenceIDNull    *bool                `json:"referenceID_null"`
	Text               *string              `json:"text"`
	TextMin            *string              `json:"textMin"`
	TextMax            *string              `json:"textMax"`
	TextNe             *string              `json:"text_ne"`
	TextMinNe          *string              `json:"textMin_ne"`
	TextMaxNe          *string              `json:"textMax_ne"`
	TextGt             *string              `json:"text_gt"`
	TextMinGt          *string              `json:"textMin_gt"`
	TextMaxGt          *string              `json:"textMax_gt"`
	TextLt             *string              `json:"text_lt"`
	TextMinLt          *string              `json:"textMin_lt"`
	TextMaxLt          *string              `json:"textMax_lt"`
	TextGte            *string              `json:"text_gte"`
	TextMinGte         *string              `json:"textMin_gte"`
	TextMaxGte         *string              `json:"textMax_gte"`
	TextLte            *string              `json:"text_lte"`
	TextMinLte         *string              `json:"textMin_lte"`
	TextMaxLte         *string              `json:"textMax_lte"`
	TextIn             []string             `json:"text_in"`
	TextMinIn          []string             `json:"textMin_in"`
	TextMaxIn          []string             `json:"textMax_in"`
	TextLike           *string              `json:"text_like"`
	TextMinLike        *string              `json:"textMin_like"`
	TextMaxLike        *string              `json:"textMax_like"`
	TextPrefix         *string              `json:"text_prefix"`
	TextMinPrefix      *string              `json:"textMin_prefix"`
	TextMaxPrefix      *string              `json:"textMax_prefix"`
	TextSuffix         *string              `json:"text_suffix"`
	TextMinSuffix      *string              `json:"textMin_suffix"`
	TextMaxSuffix      *string              `json:"textMax_suffix"`
	TextNull           *bool                `json:"text_null"`
	UpdatedAt          *time.Time           `json:"updatedAt"`
	UpdatedAtMin       *time.Time           `json:"updatedAtMin"`
	UpdatedAtMax       *time.Time           `json:"updatedAtMax"`
	UpdatedAtNe        *time.Time           `json:"updatedAt_ne"`
	UpdatedAtMinNe     *time.Time           `json:"updatedAtMin_ne"`
	UpdatedAtMaxNe     *time.Time           `json:"updatedAtMax_ne"`
	UpdatedAtGt        *time.Time           `json:"updatedAt_gt"`
	UpdatedAtMinGt     *time.Time           `json:"updatedAtMin_gt"`
	UpdatedAtMaxGt     *time.Time           `json:"updatedAtMax_gt"`
	UpdatedAtLt        *time.Time           `json:"updatedAt_lt"`
	UpdatedAtMinLt     *time.Time           `json:"updatedAtMin_lt"`
	UpdatedAtMaxLt     *time.Time           `json:"updatedAtMax_lt"`
	UpdatedAtGte       *time.Time           `json:"updatedAt_gte"`
	UpdatedAtMinGte    *time.Time           `json:"updatedAtMin_gte"`
	UpdatedAtMaxGte    *time.Time           `json:"updatedAtMax_gte"`
	UpdatedAtLte       *time.Time           `json:"updatedAt_lte"`
	UpdatedAtMinLte    *time.Time           `json:"updatedAtMin_lte"`
	UpdatedAtMaxLte    *time.Time           `json:"updatedAtMax_lte"`
	UpdatedAtIn        []*time.Time         `json:"updatedAt_in"`
	UpdatedAtMinIn     []*time.Time         `json:"updatedAtMin_in"`
	UpdatedAtMaxIn     []*time.Time         `json:"updatedAtMax_in"`
	UpdatedAtNull      *bool                `json:"updatedAt_null"`
	CreatedAt          *time.Time           `json:"createdAt"`
	CreatedAtMin       *time.Time           `json:"createdAtMin"`
	CreatedAtMax       *time.Time           `json:"createdAtMax"`
	CreatedAtNe        *time.Time           `json:"createdAt_ne"`
	CreatedAtMinNe     *time.Time           `json:"createdAtMin_ne"`
	CreatedAtMaxNe     *time.Time           `json:"createdAtMax_ne"`
	CreatedAtGt        *time.Time           `json:"createdAt_gt"`
	CreatedAtMinGt     *time.Time           `json:"createdAtMin_gt"`
	CreatedAtMaxGt     *time.Time           `json:"createdAtMax_gt"`
	CreatedAtLt        *time.Time           `json:"createdAt_lt"`
	CreatedAtMinLt     *time.Time           `json:"createdAtMin_lt"`
	CreatedAtMaxLt     *time.Time           `json:"createdAtMax_lt"`
	CreatedAtGte       *time.Time           `json:"createdAt_gte"`
	CreatedAtMinGte    *time.Time           `json:"createdAtMin_gte"`
	CreatedAtMaxGte    *time.Time           `json:"createdAtMax_gte"`
	CreatedAtLte       *time.Time           `json:"createdAt_lte"`
	CreatedAtMinLte    *time.Time           `json:"createdAtMin_lte"`
	CreatedAtMaxLte    *time.Time           `json:"createdAtMax_lte"`
	CreatedAtIn        []*time.Time         `json:"createdAt_in"`
	CreatedAtMinIn     []*time.Time         `json:"createdAtMin_in"`
	CreatedAtMaxIn     []*time.Time         `json:"createdAtMax_in"`
	CreatedAtNull      *bool                `json:"createdAt_null"`
	UpdatedBy          *string              `json:"updatedBy"`
	UpdatedByMin       *string              `json:"updatedByMin"`
	UpdatedByMax       *string              `json:"updatedByMax"`
	UpdatedByNe        *string              `json:"updatedBy_ne"`
	UpdatedByMinNe     *string              `json:"updatedByMin_ne"`
	UpdatedByMaxNe     *string              `json:"updatedByMax_ne"`
	UpdatedByGt        *string              `json:"updatedBy_gt"`
	UpdatedByMinGt     *string              `json:"updatedByMin_gt"`
	UpdatedByMaxGt     *string              `json:"updatedByMax_gt"`
	UpdatedByLt        *string              `json:"updatedBy_lt"`
	UpdatedByMinLt     *string              `json:"updatedByMin_lt"`
	UpdatedByMaxLt     *string              `json:"updatedByMax_lt"`
	UpdatedByGte       *string              `json:"updatedBy_gte"`
	UpdatedByMinGte    *string              `json:"updatedByMin_gte"`
	UpdatedByMaxGte    *string              `json:"updatedByMax_gte"`
	UpdatedByLte       *string              `json:"updatedBy_lte"`
	UpdatedByMinLte    *string              `json:"updatedByMin_lte"`
	UpdatedByMaxLte    *string              `json:"updatedByMax_lte"`
	UpdatedByIn        []string             `json:"updatedBy_in"`
	UpdatedByMinIn     []string             `json:"updatedByMin_in"`
	UpdatedByMaxIn     []string             `json:"updatedByMax_in"`
	UpdatedByNull      *bool                `json:"updatedBy_null"`
	CreatedBy          *string              `json:"createdBy"`
	CreatedByMin       *string              `json:"createdByMin"`
	CreatedByMax       *string              `json:"createdByMax"`
	CreatedByNe        *string              `json:"createdBy_ne"`
	CreatedByMinNe     *string              `json:"createdByMin_ne"`
	CreatedByMaxNe     *string              `json:"createdByMax_ne"`
	CreatedByGt        *string              `json:"createdBy_gt"`
	CreatedByMinGt     *string              `json:"createdByMin_gt"`
	CreatedByMaxGt     *string              `json:"createdByMax_gt"`
	CreatedByLt        *string              `json:"createdBy_lt"`
	CreatedByMinLt     *string              `json:"createdByMin_lt"`
	CreatedByMaxLt     *string              `json:"createdByMax_lt"`
	CreatedByGte       *string              `json:"createdBy_gte"`
	CreatedByMinGte    *string              `json:"createdByMin_gte"`
	CreatedByMaxGte    *string              `json:"createdByMax_gte"`
	CreatedByLte       *string              `json:"createdBy_lte"`
	CreatedByMinLte    *string              `json:"createdByMin_lte"`
	CreatedByMaxLte    *string              `json:"createdByMax_lte"`
	CreatedByIn        []string             `json:"createdBy_in"`
	CreatedByMinIn     []string             `json:"createdByMin_in"`
	CreatedByMaxIn     []string             `json:"createdByMax_in"`
	CreatedByNull      *bool                `json:"createdBy_null"`
}

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, whereValues *[]interface{}, havings *[]string, havingValues *[]interface{}, joins *[]string) error

func (*CommentFilterType) ApplyWithAlias

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

func (*CommentFilterType) HavingContent added in v0.2.0

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

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 CommentResolver

type CommentResolver interface {
	CreatedByUser(ctx context.Context, obj *Comment) (*User, error)
}

type CommentResultType

type CommentResultType struct {
	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 struct {
	ID             *ObjectSortType `json:"id"`
	IDMin          *ObjectSortType `json:"idMin"`
	IDMax          *ObjectSortType `json:"idMax"`
	Reference      *ObjectSortType `json:"reference"`
	ReferenceMin   *ObjectSortType `json:"referenceMin"`
	ReferenceMax   *ObjectSortType `json:"referenceMax"`
	ReferenceID    *ObjectSortType `json:"referenceID"`
	ReferenceIDMin *ObjectSortType `json:"referenceIDMin"`
	ReferenceIDMax *ObjectSortType `json:"referenceIDMax"`
	Text           *ObjectSortType `json:"text"`
	TextMin        *ObjectSortType `json:"textMin"`
	TextMax        *ObjectSortType `json:"textMax"`
	UpdatedAt      *ObjectSortType `json:"updatedAt"`
	UpdatedAtMin   *ObjectSortType `json:"updatedAtMin"`
	UpdatedAtMax   *ObjectSortType `json:"updatedAtMax"`
	CreatedAt      *ObjectSortType `json:"createdAt"`
	CreatedAtMin   *ObjectSortType `json:"createdAtMin"`
	CreatedAtMax   *ObjectSortType `json:"createdAtMax"`
	UpdatedBy      *ObjectSortType `json:"updatedBy"`
	UpdatedByMin   *ObjectSortType `json:"updatedByMin"`
	UpdatedByMax   *ObjectSortType `json:"updatedByMax"`
	CreatedBy      *ObjectSortType `json:"createdBy"`
	CreatedByMin   *ObjectSortType `json:"createdByMin"`
	CreatedByMax   *ObjectSortType `json:"createdByMax"`
}

func (CommentSortType) Apply

func (s CommentSortType) Apply(ctx context.Context, dialect gorm.Dialect, sorts *[]SortInfo, joins *[]string) error

func (CommentSortType) ApplyWithAlias

func (s CommentSortType) ApplyWithAlias(ctx context.Context, dialect gorm.Dialect, alias string, sorts *[]SortInfo, joins *[]string) error

type ComplexityRoot

type ComplexityRoot struct {
	Comment struct {
		CreatedAt     func(childComplexity int) int
		CreatedBy     func(childComplexity int) int
		CreatedByUser 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
	}

	User struct {
		ID func(childComplexity int) int
	}
	// 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 creates database instance with database URL string

func (*DB) AutoMigrate

func (db *DB) AutoMigrate() error

AutoMigrate run basic gorm automigration

func (*DB) Close

func (db *DB) Close() error

Close ...

func (*DB) Migrate added in v0.2.0

func (db *DB) Migrate(migrations []*gormigrate.Migration) error

Migrate run migrations using automigrate

func (*DB) Ping

func (db *DB) Ping() error

func (*DB) Query

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

Query ...

type DirectiveRoot

type DirectiveRoot struct {
}

type EntityFilter

type EntityFilter interface {
	Apply(ctx context.Context, dialect gorm.Dialect, wheres *[]string, whereValues *[]interface{}, havings *[]string, havingValues *[]interface{}, joins *[]string) error
}

type EntityFilterQuery

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

type EntityResultType

type EntityResultType struct {
	Offset       *int
	Limit        *int
	Query        EntityFilterQuery
	Sort         []EntitySort
	Filter       EntityFilter
	Fields       []*ast.Field
	SelectionSet *ast.SelectionSet
}

func (*EntityResultType) GetCount

func (r *EntityResultType) GetCount(ctx context.Context, db *gorm.DB, opts GetItemsOptions, out interface{}) (count int, err error)

GetCount ...

func (*EntityResultType) GetItems

func (r *EntityResultType) GetItems(ctx context.Context, db *gorm.DB, opts GetItemsOptions, out interface{}) error

GetResultTypeItems ...

func (*EntityResultType) GetSortStrings

func (r *EntityResultType) GetSortStrings() []string

type EntitySort

type EntitySort interface {
	Apply(ctx context.Context, dialect gorm.Dialect, sorts *[]SortInfo, joins *[]string) error
}

type GeneratedCommentResolver

type GeneratedCommentResolver struct{ *GeneratedResolver }

func (*GeneratedCommentResolver) CreatedByUser

func (r *GeneratedCommentResolver) CreatedByUser(ctx context.Context, obj *Comment) (res *User, err error)

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
}

func (*GeneratedResolver) GetDB added in v0.2.0

func (r *GeneratedResolver) GetDB(ctx context.Context) *gorm.DB

GetDB returns database connection or transaction for given context (if exists)

type GeneratedUserResolver

type GeneratedUserResolver struct{ *GeneratedResolver }

type GetItemsOptions

type GetItemsOptions struct {
	Alias      string
	Preloaders []string
}

type JWTClaims

type JWTClaims struct {
	jwtgo.StandardClaims
	Scope *string
}

func GetJWTClaimsFromContext

func GetJWTClaimsFromContext(ctx context.Context) *JWTClaims

func (*JWTClaims) HasScope

func (c *JWTClaims) HasScope(scope string) bool

func (*JWTClaims) Scopes

func (c *JWTClaims) Scopes() []string

type MutationEvents added in v0.2.0

type MutationEvents struct {
	Events []events.Event
}

func GetMutationEventStore added in v0.2.0

func GetMutationEventStore(ctx context.Context) *MutationEvents

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 ObjectSortType

type ObjectSortType string
const (
	ObjectSortTypeAsc  ObjectSortType = "ASC"
	ObjectSortTypeDesc ObjectSortType = "DESC"
)

func (ObjectSortType) IsValid

func (e ObjectSortType) IsValid() bool

func (ObjectSortType) MarshalGQL

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

func (ObjectSortType) String

func (e ObjectSortType) String() string

func (*ObjectSortType) UnmarshalGQL

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

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 {
	OnEvent func(ctx context.Context, r *GeneratedResolver, e *events.Event) error

	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)

	CommentCreatedByUser func(ctx context.Context, r *GeneratedResolver, obj *Comment) (res *User, err error)
}

func DefaultResolutionHandlers

func DefaultResolutionHandlers() ResolutionHandlers

type ResolverRoot

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

type SortInfo added in v0.2.0

type SortInfo struct {
	Field         string
	Direction     string
	IsAggregation bool
}

func (*SortInfo) String added in v0.2.0

func (si *SortInfo) String() string

type User

type User struct {
	ID string `json:"id"`
}

func CommentCreatedByUserHandler

func CommentCreatedByUserHandler(ctx context.Context, r *GeneratedResolver, obj *Comment) (res *User, err error)

Jump to

Keyboard shortcuts

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