generated

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func NewGormDB added in v0.0.2

func NewGormDB(sts *settings.EnvironmentSettings) (*gorm.DB, error)

func Paginate added in v0.0.2

func Paginate(paginationInput *XgenPaginationInput) func(db *gorm.DB) *gorm.DB

func Sort added in v0.0.2

func Sort(sort sort.Sortables) func(db *gorm.DB) *gorm.DB

Types

type Action

type Action struct {
	Resource        string                 `json:"Resource"`
	Action          XgenResourceActionType `json:"Action"`
	Route           *string                `json:"Route,omitempty"`
	SchemaFieldName *string                `json:"SchemaFieldName,omitempty"`
}

This directive is used to mark the object as a resource action

type ActionAnnotationSingle

type ActionAnnotationSingle struct {
	Name  *string `json:"name,omitempty"`
	Value *Action `json:"value,omitempty"`
}

type ActionField

type ActionField struct {
	Label       *string `json:"Label,omitempty"`
	Description *string `json:"Description,omitempty"`
	// Map field to resource field, {resource}.{field}, eg. user.id
	MapTo []string `json:"MapTo,omitempty"`
}

This directive is used to mark the object as a resource field

type ComplexityRoot

type ComplexityRoot struct {
	Action struct {
		Action          func(childComplexity int) int
		Resource        func(childComplexity int) int
		Route           func(childComplexity int) int
		SchemaFieldName func(childComplexity int) int
	}

	ActionAnnotationSingle struct {
		Name  func(childComplexity int) int
		Value func(childComplexity int) int
	}

	ActionField struct {
		Description func(childComplexity int) int
		Label       func(childComplexity int) int
		MapTo       func(childComplexity int) int
	}

	Field struct {
		Description func(childComplexity int) int
		Label       func(childComplexity int) int
	}

	ListAction struct {
		Action          func(childComplexity int) int
		Pagination      func(childComplexity int) int
		Resource        func(childComplexity int) int
		Route           func(childComplexity int) int
		SchemaFieldName func(childComplexity int) int
		Sort            func(childComplexity int) int
	}

	ListActionAnnotationSingle struct {
		Name  func(childComplexity int) int
		Value func(childComplexity int) int
	}

	Query struct {
		XgenIntrospection func(childComplexity int) int
	}

	Resource struct {
		Name    func(childComplexity int) int
		Primary func(childComplexity int) int
		Route   func(childComplexity int) int
	}

	ResourceAnnotationSingle struct {
		Name  func(childComplexity int) int
		Value func(childComplexity int) int
	}

	XgenAnnotationMap struct {
		Action     func(childComplexity int) int
		ListAction func(childComplexity int) int
		Resource   func(childComplexity int) int
	}

	XgenCursorPaginationInputXgenDef struct {
		Field  func(childComplexity int) int
		Object func(childComplexity int) int
	}

	XgenFieldDef struct {
		ActionField func(childComplexity int) int
		Field       func(childComplexity int) int
	}

	XgenIntrospection struct {
		Annotation func(childComplexity int) int
		Object     func(childComplexity int) int
	}

	XgenObjectDefinition struct {
		Action     func(childComplexity int) int
		ListAction func(childComplexity int) int
		Resource   func(childComplexity int) int
	}

	XgenObjectField struct {
		Definition func(childComplexity int) int
		Name       func(childComplexity int) int
	}

	XgenObjectMap struct {
		XgenCursorPaginationInput      func(childComplexity int) int
		XgenPaginationInput            func(childComplexity int) int
		XgenResourceActionType         func(childComplexity int) int
		XgenResourceDbConfigInput      func(childComplexity int) int
		XgenResourceFieldDbConfigInput func(childComplexity int) int
		XgenResourceListActionType     func(childComplexity int) int
		XgenSort                       func(childComplexity int) int
		XgenSortDirection              func(childComplexity int) int
		XgenSortInput                  func(childComplexity int) int
		XgenSortResourceConfig         func(childComplexity int) int
		XgenSortResourceConfigInput    func(childComplexity int) int
	}

	XgenPaginationInputXgenDef struct {
		Field  func(childComplexity int) int
		Object func(childComplexity int) int
	}

	XgenResourceActionTypeXgenDef struct {
		Field  func(childComplexity int) int
		Object func(childComplexity int) int
	}

	XgenResourceDbConfigInputXgenDef struct {
		Field  func(childComplexity int) int
		Object func(childComplexity int) int
	}

	XgenResourceFieldDbConfigInputXgenDef struct {
		Field  func(childComplexity int) int
		Object func(childComplexity int) int
	}

	XgenResourceListActionTypeXgenDef struct {
		Field  func(childComplexity int) int
		Object func(childComplexity int) int
	}

	XgenSort struct {
		By        func(childComplexity int) int
		Direction func(childComplexity int) int
	}

	XgenSortDirectionXgenDef struct {
		Field  func(childComplexity int) int
		Object func(childComplexity int) int
	}

	XgenSortInputXgenDef struct {
		Field  func(childComplexity int) int
		Object func(childComplexity int) int
	}

	XgenSortResourceConfig struct {
		Default  func(childComplexity int) int
		Disabled func(childComplexity int) int
	}

	XgenSortResourceConfigInputXgenDef struct {
		Field  func(childComplexity int) int
		Object func(childComplexity int) int
	}

	XgenSortResourceConfigXgenDef struct {
		Field  func(childComplexity int) int
		Object func(childComplexity int) int
	}

	XgenSortXgenDef struct {
		Field  func(childComplexity int) int
		Object func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
	Action                  func(ctx context.Context, obj interface{}, next graphql.Resolver, resource string, action XgenResourceActionType, route *string, schemaFieldName *string) (res interface{}, err error)
	ActionField             func(ctx context.Context, obj interface{}, next graphql.Resolver, label *string, description *string, mapTo []string) (res interface{}, err error)
	ExcludeArgumentFromType func(ctx context.Context, obj interface{}, next graphql.Resolver, exclude *bool) (res interface{}, err error)
	Field                   func(ctx context.Context, obj interface{}, next graphql.Resolver, label *string, description *string, db *XgenResourceFieldDbConfigInput) (res interface{}, err error)
	ListAction              func(ctx context.Context, obj interface{}, next graphql.Resolver, resource string, action XgenResourceListActionType, route *string, pagination *bool, sort *XgenSortResourceConfigInput, schemaFieldName *string) (res interface{}, err error)
	Resource                func(ctx context.Context, obj interface{}, next graphql.Resolver, name string, route *string, primary *bool, db *XgenResourceDbConfigInput) (res interface{}, err error)
	ToObjectType            func(ctx context.Context, obj interface{}, next graphql.Resolver, typeArg string) (res interface{}, err error)
}

type Field

type Field struct {
	Label       *string `json:"Label,omitempty"`
	Description *string `json:"Description,omitempty"`
}

This directive is used to mark the object as a resource field

type ListAction

type ListAction struct {
	Resource        string                     `json:"Resource"`
	Action          XgenResourceListActionType `json:"Action"`
	Route           *string                    `json:"Route,omitempty"`
	Pagination      *bool                      `json:"Pagination,omitempty"`
	Sort            *XgenSortResourceConfig    `json:"Sort,omitempty"`
	SchemaFieldName *string                    `json:"SchemaFieldName,omitempty"`
}

This directive is used to mark the object as a resource list action

type ListActionAnnotationSingle

type ListActionAnnotationSingle struct {
	Name  *string     `json:"name,omitempty"`
	Value *ListAction `json:"value,omitempty"`
}

type QueryResolver

type QueryResolver interface {
	XgenIntrospection(ctx context.Context) (*XgenIntrospection, error)
}

type ResolverRoot

type ResolverRoot interface {
	Query() QueryResolver
}

type Resource

type Resource struct {
	Name    string  `json:"Name"`
	Route   *string `json:"Route,omitempty"`
	Primary *bool   `json:"Primary,omitempty"`
}

This directive is used to mark the object as a resource

type ResourceAnnotationSingle

type ResourceAnnotationSingle struct {
	Name  *string   `json:"name,omitempty"`
	Value *Resource `json:"value,omitempty"`
}

type XgenAnnotationMap

type XgenAnnotationMap struct {
	Resource   []*ResourceAnnotationSingle   `json:"Resource"`
	Action     []*ActionAnnotationSingle     `json:"Action"`
	ListAction []*ListActionAnnotationSingle `json:"ListAction"`
}

type XgenCursorPaginationInput

type XgenCursorPaginationInput struct {
	First  int     `json:"first"`
	After  *string `json:"after,omitempty"`
	Last   int     `json:"last"`
	Before *string `json:"before,omitempty"`
}

type XgenCursorPaginationInputXgenDef

type XgenCursorPaginationInputXgenDef struct {
	Object *XgenObjectDefinition `json:"object,omitempty"`
	Field  []*XgenObjectField    `json:"field"`
}

type XgenFieldDef

type XgenFieldDef struct {
	Field       *Field       `json:"Field,omitempty"`
	ActionField *ActionField `json:"ActionField,omitempty"`
}

type XgenIntrospection

type XgenIntrospection struct {
	Annotation *XgenAnnotationMap `json:"annotation,omitempty"`
	Object     *XgenObjectMap     `json:"object,omitempty"`
}

func XgenIntrospectionValues added in v0.0.2

func XgenIntrospectionValues() (*XgenIntrospection, error)

XgenIntrospection is the resolver for the XgenIntrospection field.

type XgenObjectDefinition

type XgenObjectDefinition struct {
	Action     *Action     `json:"Action,omitempty"`
	ListAction *ListAction `json:"ListAction,omitempty"`
	Resource   *Resource   `json:"Resource,omitempty"`
}

type XgenObjectField

type XgenObjectField struct {
	Name       *string       `json:"name,omitempty"`
	Definition *XgenFieldDef `json:"definition,omitempty"`
}

type XgenObjectMap

type XgenObjectMap struct {
	XgenCursorPaginationInput      *XgenCursorPaginationInputXgenDef      `json:"XgenCursorPaginationInput,omitempty"`
	XgenPaginationInput            *XgenPaginationInputXgenDef            `json:"XgenPaginationInput,omitempty"`
	XgenSortResourceConfigInput    *XgenSortResourceConfigInputXgenDef    `json:"XgenSortResourceConfigInput,omitempty"`
	XgenResourceActionType         *XgenResourceActionTypeXgenDef         `json:"XgenResourceActionType,omitempty"`
	XgenSortDirection              *XgenSortDirectionXgenDef              `json:"XgenSortDirection,omitempty"`
	XgenSortInput                  *XgenSortInputXgenDef                  `json:"XgenSortInput,omitempty"`
	XgenResourceDbConfigInput      *XgenResourceDbConfigInputXgenDef      `json:"XgenResourceDbConfigInput,omitempty"`
	XgenResourceListActionType     *XgenResourceListActionTypeXgenDef     `json:"XgenResourceListActionType,omitempty"`
	XgenResourceFieldDbConfigInput *XgenResourceFieldDbConfigInputXgenDef `json:"XgenResourceFieldDbConfigInput,omitempty"`
	XgenSortResourceConfig         *XgenSortResourceConfigXgenDef         `json:"XgenSortResourceConfig,omitempty"`
	XgenSort                       *XgenSortXgenDef                       `json:"XgenSort,omitempty"`
}

type XgenPaginationInput

type XgenPaginationInput struct {
	Page int `json:"page"`
	Size int `json:"size"`
}

type XgenPaginationInputXgenDef

type XgenPaginationInputXgenDef struct {
	Object *XgenObjectDefinition `json:"object,omitempty"`
	Field  []*XgenObjectField    `json:"field"`
}

type XgenResourceActionType

type XgenResourceActionType string
const (
	XgenResourceActionTypeCreateMutation XgenResourceActionType = "CREATE_MUTATION"
	XgenResourceActionTypeReadQuery      XgenResourceActionType = "READ_QUERY"
	XgenResourceActionTypeUpdateMutation XgenResourceActionType = "UPDATE_MUTATION"
	XgenResourceActionTypeDeleteMutation XgenResourceActionType = "DELETE_MUTATION"
)

func (XgenResourceActionType) IsValid

func (e XgenResourceActionType) IsValid() bool

func (XgenResourceActionType) MarshalGQL

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

func (XgenResourceActionType) String

func (e XgenResourceActionType) String() string

func (*XgenResourceActionType) UnmarshalGQL

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

type XgenResourceActionTypeXgenDef

type XgenResourceActionTypeXgenDef struct {
	Object *XgenObjectDefinition `json:"object,omitempty"`
	Field  []*XgenObjectField    `json:"field"`
}

type XgenResourceDbConfigInput

type XgenResourceDbConfigInput struct {
	Table *string `json:"Table,omitempty"`
}

type XgenResourceDbConfigInputXgenDef

type XgenResourceDbConfigInputXgenDef struct {
	Object *XgenObjectDefinition `json:"object,omitempty"`
	Field  []*XgenObjectField    `json:"field"`
}

type XgenResourceFieldDbConfigInput

type XgenResourceFieldDbConfigInput struct {
	Column                 *string `json:"Column,omitempty"`
	PrimaryKey             *bool   `json:"PrimaryKey,omitempty"`
	AutoIncrement          *bool   `json:"AutoIncrement,omitempty"`
	Unique                 *bool   `json:"Unique,omitempty"`
	NotNull                *bool   `json:"NotNull,omitempty"`
	Index                  *bool   `json:"Index,omitempty"`
	UniqueIndex            *bool   `json:"UniqueIndex,omitempty"`
	Size                   *int    `json:"Size,omitempty"`
	Precision              *int    `json:"Precision,omitempty"`
	Type                   *string `json:"Type,omitempty"`
	Scale                  *int    `json:"Scale,omitempty"`
	AutoIncrementIncrement *int    `json:"AutoIncrementIncrement,omitempty"`
}

type XgenResourceFieldDbConfigInputXgenDef

type XgenResourceFieldDbConfigInputXgenDef struct {
	Object *XgenObjectDefinition `json:"object,omitempty"`
	Field  []*XgenObjectField    `json:"field"`
}

type XgenResourceListActionType

type XgenResourceListActionType string
const (
	XgenResourceListActionTypeBrowseQuery         XgenResourceListActionType = "BROWSE_QUERY"
	XgenResourceListActionTypeBatchDeleteMutation XgenResourceListActionType = "BATCH_DELETE_MUTATION"
)

func (XgenResourceListActionType) IsValid

func (e XgenResourceListActionType) IsValid() bool

func (XgenResourceListActionType) MarshalGQL

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

func (XgenResourceListActionType) String

func (*XgenResourceListActionType) UnmarshalGQL

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

type XgenResourceListActionTypeXgenDef

type XgenResourceListActionTypeXgenDef struct {
	Object *XgenObjectDefinition `json:"object,omitempty"`
	Field  []*XgenObjectField    `json:"field"`
}

type XgenSort added in v0.0.2

type XgenSort struct {
	By        string             `json:"by"`
	Direction *XgenSortDirection `json:"direction,omitempty"`
}

type XgenSortDirection added in v0.0.2

type XgenSortDirection string
const (
	XgenSortDirectionAsc  XgenSortDirection = "ASC"
	XgenSortDirectionDesc XgenSortDirection = "DESC"
)

func (XgenSortDirection) IsValid added in v0.0.2

func (e XgenSortDirection) IsValid() bool

func (XgenSortDirection) MarshalGQL added in v0.0.2

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

func (XgenSortDirection) String added in v0.0.2

func (e XgenSortDirection) String() string

func (*XgenSortDirection) UnmarshalGQL added in v0.0.2

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

type XgenSortDirectionXgenDef added in v0.0.2

type XgenSortDirectionXgenDef struct {
	Object *XgenObjectDefinition `json:"object,omitempty"`
	Field  []*XgenObjectField    `json:"field"`
}

type XgenSortInput added in v0.0.2

type XgenSortInput struct {
	By        string             `json:"by"`
	Direction *XgenSortDirection `json:"direction,omitempty"`
}

type XgenSortInputXgenDef added in v0.0.2

type XgenSortInputXgenDef struct {
	Object *XgenObjectDefinition `json:"object,omitempty"`
	Field  []*XgenObjectField    `json:"field"`
}

type XgenSortResourceConfig added in v0.0.2

type XgenSortResourceConfig struct {
	// If set to true, the sort will be disabled.
	Disabled *bool       `json:"Disabled,omitempty"`
	Default  []*XgenSort `json:"Default,omitempty"`
}

type XgenSortResourceConfigInput added in v0.0.2

type XgenSortResourceConfigInput struct {
	// If set to true, the sort will be disabled.
	Disabled *bool            `json:"Disabled,omitempty"`
	Default  []*XgenSortInput `json:"Default,omitempty"`
}

type XgenSortResourceConfigInputXgenDef added in v0.0.2

type XgenSortResourceConfigInputXgenDef struct {
	Object *XgenObjectDefinition `json:"object,omitempty"`
	Field  []*XgenObjectField    `json:"field"`
}

type XgenSortResourceConfigXgenDef added in v0.0.2

type XgenSortResourceConfigXgenDef struct {
	Object *XgenObjectDefinition `json:"object,omitempty"`
	Field  []*XgenObjectField    `json:"field"`
}

type XgenSortXgenDef added in v0.0.2

type XgenSortXgenDef struct {
	Object *XgenObjectDefinition `json:"object,omitempty"`
	Field  []*XgenObjectField    `json:"field"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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