gen

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 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 = `` /* 3904-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 DeleteAllNotificationsHandler

func DeleteAllNotificationsHandler(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 GetPrincipalIDFromContext

func GetPrincipalIDFromContext(ctx context.Context) *string

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 TableName

func TableName(name string) string

func Unmarshal_Any

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

Types

type ComplexityRoot

type ComplexityRoot struct {
	Mutation struct {
		CreateNotification     func(childComplexity int, input map[string]interface{}) int
		DeleteAllNotifications func(childComplexity int) int
		DeleteNotification     func(childComplexity int, id string) int
		SeenNotification       func(childComplexity int, id string) int
		SeenNotifications      func(childComplexity int, principal string, channel *string, reference *string, referenceID *string) int
		UpdateNotification     func(childComplexity int, id string, input map[string]interface{}) int
	}

	Notification struct {
		Channel     func(childComplexity int) int
		CreatedAt   func(childComplexity int) int
		CreatedBy   func(childComplexity int) int
		Date        func(childComplexity int) int
		ID          func(childComplexity int) int
		Message     func(childComplexity int) int
		Principal   func(childComplexity int) int
		Reference   func(childComplexity int) int
		ReferenceID func(childComplexity int) int
		Seen        func(childComplexity int) int
		UpdatedAt   func(childComplexity int) int
		UpdatedBy   func(childComplexity int) int
	}

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

	Query struct {
		Notification  func(childComplexity int, id *string, q *string, filter *NotificationFilterType) int
		Notifications func(childComplexity int, offset *int, limit *int, q *string, sort []NotificationSortType, filter *NotificationFilterType) 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 GeneratedMutationResolver

type GeneratedMutationResolver struct{ *GeneratedResolver }

func (*GeneratedMutationResolver) CreateNotification

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

func (*GeneratedMutationResolver) DeleteAllNotifications

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

func (*GeneratedMutationResolver) DeleteNotification

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

func (*GeneratedMutationResolver) UpdateNotification

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

type GeneratedNotificationResultTypeResolver

type GeneratedNotificationResultTypeResolver struct{ *GeneratedResolver }

func (*GeneratedNotificationResultTypeResolver) Count

func (*GeneratedNotificationResultTypeResolver) Items

type GeneratedQueryResolver

type GeneratedQueryResolver struct{ *GeneratedResolver }

func (*GeneratedQueryResolver) Notification

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

func (*GeneratedQueryResolver) Notifications

func (r *GeneratedQueryResolver) Notifications(ctx context.Context, offset *int, limit *int, q *string, sort []NotificationSortType, filter *NotificationFilterType) (*NotificationResultType, 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 {
	CreateNotification(ctx context.Context, input map[string]interface{}) (*Notification, error)
	UpdateNotification(ctx context.Context, id string, input map[string]interface{}) (*Notification, error)
	DeleteNotification(ctx context.Context, id string) (*Notification, error)
	DeleteAllNotifications(ctx context.Context) (bool, error)
	SeenNotification(ctx context.Context, id string) (*Notification, error)
	SeenNotifications(ctx context.Context, principal string, channel *string, reference *string, referenceID *string) (bool, error)
}

type NotFoundError

type NotFoundError struct {
	Entity string
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type Notification

type Notification struct {
	ID          string     `json:"id" gorm:"column:id;primary_key"`
	Message     string     `json:"message" gorm:"column:message;type:text"`
	Seen        bool       `json:"seen" gorm:"column:seen"`
	Channel     *string    `json:"channel" gorm:"column:channel"`
	Principal   *string    `json:"principal" gorm:"column:principal"`
	Reference   *string    `json:"reference" gorm:"column:reference"`
	ReferenceID *string    `json:"referenceID" gorm:"column:referenceID"`
	Date        time.Time  `json:"date" gorm:"column:date"`
	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 CreateNotificationHandler

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

func DeleteNotificationHandler

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

func UpdateNotificationHandler

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

func (*Notification) Is_Entity

func (m *Notification) Is_Entity()

type NotificationChanges

type NotificationChanges struct {
	ID          string
	Message     string
	Seen        bool
	Channel     *string
	Principal   *string
	Reference   *string
	ReferenceID *string
	Date        time.Time
	UpdatedAt   *time.Time
	CreatedAt   time.Time
	UpdatedBy   *string
	CreatedBy   *string
}

type NotificationFilterType

type NotificationFilterType struct {
	And               []*NotificationFilterType `json:"AND"`
	Or                []*NotificationFilterType `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"`
	Message           *string                   `json:"message"`
	MessageNe         *string                   `json:"message_ne"`
	MessageGt         *string                   `json:"message_gt"`
	MessageLt         *string                   `json:"message_lt"`
	MessageGte        *string                   `json:"message_gte"`
	MessageLte        *string                   `json:"message_lte"`
	MessageIn         []string                  `json:"message_in"`
	MessageLike       *string                   `json:"message_like"`
	MessagePrefix     *string                   `json:"message_prefix"`
	MessageSuffix     *string                   `json:"message_suffix"`
	Seen              *bool                     `json:"seen"`
	SeenNe            *bool                     `json:"seen_ne"`
	SeenGt            *bool                     `json:"seen_gt"`
	SeenLt            *bool                     `json:"seen_lt"`
	SeenGte           *bool                     `json:"seen_gte"`
	SeenLte           *bool                     `json:"seen_lte"`
	SeenIn            []bool                    `json:"seen_in"`
	Channel           *string                   `json:"channel"`
	ChannelNe         *string                   `json:"channel_ne"`
	ChannelGt         *string                   `json:"channel_gt"`
	ChannelLt         *string                   `json:"channel_lt"`
	ChannelGte        *string                   `json:"channel_gte"`
	ChannelLte        *string                   `json:"channel_lte"`
	ChannelIn         []string                  `json:"channel_in"`
	ChannelLike       *string                   `json:"channel_like"`
	ChannelPrefix     *string                   `json:"channel_prefix"`
	ChannelSuffix     *string                   `json:"channel_suffix"`
	Principal         *string                   `json:"principal"`
	PrincipalNe       *string                   `json:"principal_ne"`
	PrincipalGt       *string                   `json:"principal_gt"`
	PrincipalLt       *string                   `json:"principal_lt"`
	PrincipalGte      *string                   `json:"principal_gte"`
	PrincipalLte      *string                   `json:"principal_lte"`
	PrincipalIn       []string                  `json:"principal_in"`
	PrincipalLike     *string                   `json:"principal_like"`
	PrincipalPrefix   *string                   `json:"principal_prefix"`
	PrincipalSuffix   *string                   `json:"principal_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"`
	ReferenceIDLike   *string                   `json:"referenceID_like"`
	ReferenceIDPrefix *string                   `json:"referenceID_prefix"`
	ReferenceIDSuffix *string                   `json:"referenceID_suffix"`
	Date              *time.Time                `json:"date"`
	DateNe            *time.Time                `json:"date_ne"`
	DateGt            *time.Time                `json:"date_gt"`
	DateLt            *time.Time                `json:"date_lt"`
	DateGte           *time.Time                `json:"date_gte"`
	DateLte           *time.Time                `json:"date_lte"`
	DateIn            []*time.Time              `json:"date_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 (*NotificationFilterType) AndWith

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

func (*NotificationFilterType) Apply

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

func (*NotificationFilterType) ApplyWithAlias

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

func (*NotificationFilterType) IsEmpty

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

func (*NotificationFilterType) OrWith

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

func (*NotificationFilterType) WhereContent

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

type NotificationQueryFilter

type NotificationQueryFilter struct {
	Query *string
}

func (*NotificationQueryFilter) Apply

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

type NotificationResultType

type NotificationResultType struct {
	resolvers.EntityResultType
}

type NotificationResultTypeResolver

type NotificationResultTypeResolver interface {
	Items(ctx context.Context, obj *NotificationResultType) ([]*Notification, error)
	Count(ctx context.Context, obj *NotificationResultType) (int, error)
}

type NotificationSortType

type NotificationSortType string
const (
	NotificationSortTypeIDAsc           NotificationSortType = "ID_ASC"
	NotificationSortTypeIDDesc          NotificationSortType = "ID_DESC"
	NotificationSortTypeMessageAsc      NotificationSortType = "MESSAGE_ASC"
	NotificationSortTypeMessageDesc     NotificationSortType = "MESSAGE_DESC"
	NotificationSortTypeSeenAsc         NotificationSortType = "SEEN_ASC"
	NotificationSortTypeSeenDesc        NotificationSortType = "SEEN_DESC"
	NotificationSortTypeChannelAsc      NotificationSortType = "CHANNEL_ASC"
	NotificationSortTypeChannelDesc     NotificationSortType = "CHANNEL_DESC"
	NotificationSortTypePrincipalAsc    NotificationSortType = "PRINCIPAL_ASC"
	NotificationSortTypePrincipalDesc   NotificationSortType = "PRINCIPAL_DESC"
	NotificationSortTypeReferenceAsc    NotificationSortType = "REFERENCE_ASC"
	NotificationSortTypeReferenceDesc   NotificationSortType = "REFERENCE_DESC"
	NotificationSortTypeReferenceIDAsc  NotificationSortType = "REFERENCE_ID_ASC"
	NotificationSortTypeReferenceIDDesc NotificationSortType = "REFERENCE_ID_DESC"
	NotificationSortTypeDateAsc         NotificationSortType = "DATE_ASC"
	NotificationSortTypeDateDesc        NotificationSortType = "DATE_DESC"
	NotificationSortTypeUpdatedAtAsc    NotificationSortType = "UPDATED_AT_ASC"
	NotificationSortTypeUpdatedAtDesc   NotificationSortType = "UPDATED_AT_DESC"
	NotificationSortTypeCreatedAtAsc    NotificationSortType = "CREATED_AT_ASC"
	NotificationSortTypeCreatedAtDesc   NotificationSortType = "CREATED_AT_DESC"
	NotificationSortTypeUpdatedByAsc    NotificationSortType = "UPDATED_BY_ASC"
	NotificationSortTypeUpdatedByDesc   NotificationSortType = "UPDATED_BY_DESC"
	NotificationSortTypeCreatedByAsc    NotificationSortType = "CREATED_BY_ASC"
	NotificationSortTypeCreatedByDesc   NotificationSortType = "CREATED_BY_DESC"
)

func (NotificationSortType) IsValid

func (e NotificationSortType) IsValid() bool

func (NotificationSortType) MarshalGQL

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

func (NotificationSortType) String

func (e NotificationSortType) String() string

func (*NotificationSortType) UnmarshalGQL

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

type QueryNotificationHandlerOptions

type QueryNotificationHandlerOptions struct {
	ID     *string
	Q      *string
	Filter *NotificationFilterType
}

type QueryNotificationsHandlerOptions

type QueryNotificationsHandlerOptions struct {
	Offset *int
	Limit  *int
	Q      *string
	Sort   []NotificationSortType
	Filter *NotificationFilterType
}

type QueryResolver

type QueryResolver interface {
	Notification(ctx context.Context, id *string, q *string, filter *NotificationFilterType) (*Notification, error)
	Notifications(ctx context.Context, offset *int, limit *int, q *string, sort []NotificationSortType, filter *NotificationFilterType) (*NotificationResultType, error)
	// contains filtered or unexported methods
}

type ResolutionHandlers

type ResolutionHandlers struct {
	CreateNotification     func(ctx context.Context, r *GeneratedResolver, input map[string]interface{}) (item *Notification, err error)
	UpdateNotification     func(ctx context.Context, r *GeneratedResolver, id string, input map[string]interface{}) (item *Notification, err error)
	DeleteNotification     func(ctx context.Context, r *GeneratedResolver, id string) (item *Notification, err error)
	DeleteAllNotifications func(ctx context.Context, r *GeneratedResolver) (bool, error)
	QueryNotification      func(ctx context.Context, r *GeneratedResolver, opts QueryNotificationHandlerOptions) (*Notification, error)
	QueryNotifications     func(ctx context.Context, r *GeneratedResolver, opts QueryNotificationsHandlerOptions) (*NotificationResultType, error)
}

func DefaultResolutionHandlers

func DefaultResolutionHandlers() ResolutionHandlers

type ResolverRoot

type ResolverRoot interface {
	Mutation() MutationResolver
	NotificationResultType() NotificationResultTypeResolver
	Query() QueryResolver
}

Jump to

Keyboard shortcuts

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