Documentation
¶
Index ¶
- Variables
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
- func NewGormDB(sts *settings.EnvironmentSettings) (*gorm.DB, error)
- func Paginate(paginationInput *XgenPaginationInput) func(db *gorm.DB) *gorm.DB
- func Sort(sort sort.Sortables) func(db *gorm.DB) *gorm.DB
- type Action
- type ActionAnnotationSingle
- type ActionField
- type ComplexityRoot
- type Config
- type DirectiveRoot
- type Field
- type ListAction
- type ListActionAnnotationSingle
- type QueryResolver
- type ResolverRoot
- type Resource
- type ResourceAnnotationSingle
- type XgenAnnotationMap
- type XgenCursorPaginationInput
- type XgenCursorPaginationInputXgenDef
- type XgenFieldDef
- type XgenIntrospection
- type XgenObjectDefinition
- type XgenObjectField
- type XgenObjectMap
- type XgenPaginationInput
- type XgenPaginationInputXgenDef
- type XgenResourceActionType
- type XgenResourceActionTypeXgenDef
- type XgenResourceDbConfigInput
- type XgenResourceDbConfigInputXgenDef
- type XgenResourceFieldDbConfigInput
- type XgenResourceFieldDbConfigInputXgenDef
- type XgenResourceListActionType
- type XgenResourceListActionTypeXgenDef
- type XgenSort
- type XgenSortDirection
- type XgenSortDirectionXgenDef
- type XgenSortInput
- type XgenSortInputXgenDef
- type XgenSortResourceConfig
- type XgenSortResourceConfigInput
- type XgenSortResourceConfigInputXgenDef
- type XgenSortResourceConfigXgenDef
- type XgenSortXgenDef
Constants ¶
This section is empty.
Variables ¶
View Source
var AllXgenResourceActionType = []XgenResourceActionType{ XgenResourceActionTypeCreateMutation, XgenResourceActionTypeReadQuery, XgenResourceActionTypeUpdateMutation, XgenResourceActionTypeDeleteMutation, }
View Source
var AllXgenResourceListActionType = []XgenResourceListActionType{ XgenResourceListActionTypeBrowseQuery, XgenResourceListActionTypeBatchDeleteMutation, }
View Source
var AllXgenSortDirection = []XgenSortDirection{ XgenSortDirectionAsc, XgenSortDirectionDesc, }
Functions ¶
func NewExecutableSchema ¶
func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
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 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 XgenAnnotationMap ¶
type XgenAnnotationMap struct {
Action []*ActionAnnotationSingle `json:"Action"`
Resource []*ResourceAnnotationSingle `json:"Resource"`
ListAction []*ListActionAnnotationSingle `json:"ListAction"`
}
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 ¶
func XgenIntrospectionValues() (*XgenIntrospection, error)
XgenIntrospection is the resolver for the XgenIntrospection field.
type XgenObjectDefinition ¶
type XgenObjectDefinition struct {
ListAction *ListAction `json:"ListAction,omitempty"`
Resource *Resource `json:"Resource,omitempty"`
Action *Action `json:"Action,omitempty"`
}
type XgenObjectField ¶
type XgenObjectField struct {
Name *string `json:"name,omitempty"`
Definition *XgenFieldDef `json:"definition,omitempty"`
}
type XgenObjectMap ¶
type XgenObjectMap struct {
XgenSortInput *XgenSortInputXgenDef `json:"XgenSortInput,omitempty"`
XgenCursorPaginationInput *XgenCursorPaginationInputXgenDef `json:"XgenCursorPaginationInput,omitempty"`
XgenSortResourceConfigInput *XgenSortResourceConfigInputXgenDef `json:"XgenSortResourceConfigInput,omitempty"`
XgenSortDirection *XgenSortDirectionXgenDef `json:"XgenSortDirection,omitempty"`
XgenPaginationInput *XgenPaginationInputXgenDef `json:"XgenPaginationInput,omitempty"`
XgenSortResourceConfig *XgenSortResourceConfigXgenDef `json:"XgenSortResourceConfig,omitempty"`
XgenResourceActionType *XgenResourceActionTypeXgenDef `json:"XgenResourceActionType,omitempty"`
XgenResourceListActionType *XgenResourceListActionTypeXgenDef `json:"XgenResourceListActionType,omitempty"`
XgenSort *XgenSortXgenDef `json:"XgenSort,omitempty"`
XgenResourceFieldDbConfigInput *XgenResourceFieldDbConfigInputXgenDef `json:"XgenResourceFieldDbConfigInput,omitempty"`
XgenResourceDbConfigInput *XgenResourceDbConfigInputXgenDef `json:"XgenResourceDbConfigInput,omitempty"`
}
type XgenPaginationInput ¶
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 (e XgenResourceListActionType) String() 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 ¶
type XgenSort struct {
By string `json:"by"`
Direction *XgenSortDirection `json:"direction,omitempty"`
}
type XgenSortDirection ¶
type XgenSortDirection string
const ( XgenSortDirectionAsc XgenSortDirection = "ASC" XgenSortDirectionDesc XgenSortDirection = "DESC" )
func (XgenSortDirection) IsValid ¶
func (e XgenSortDirection) IsValid() bool
func (XgenSortDirection) MarshalGQL ¶
func (e XgenSortDirection) MarshalGQL(w io.Writer)
func (XgenSortDirection) String ¶
func (e XgenSortDirection) String() string
func (*XgenSortDirection) UnmarshalGQL ¶
func (e *XgenSortDirection) UnmarshalGQL(v interface{}) error
type XgenSortDirectionXgenDef ¶
type XgenSortDirectionXgenDef struct {
Object *XgenObjectDefinition `json:"object,omitempty"`
Field []*XgenObjectField `json:"field"`
}
type XgenSortInput ¶
type XgenSortInput struct {
By string `json:"by"`
Direction *XgenSortDirection `json:"direction,omitempty"`
}
type XgenSortInputXgenDef ¶
type XgenSortInputXgenDef struct {
Object *XgenObjectDefinition `json:"object,omitempty"`
Field []*XgenObjectField `json:"field"`
}
type XgenSortResourceConfig ¶
type XgenSortResourceConfigInput ¶
type XgenSortResourceConfigInput struct {
// If set to true, the sort will be disabled.
Disabled *bool `json:"Disabled,omitempty"`
Default []*XgenSortInput `json:"Default,omitempty"`
}
type XgenSortResourceConfigInputXgenDef ¶
type XgenSortResourceConfigInputXgenDef struct {
Object *XgenObjectDefinition `json:"object,omitempty"`
Field []*XgenObjectField `json:"field"`
}
type XgenSortResourceConfigXgenDef ¶
type XgenSortResourceConfigXgenDef struct {
Object *XgenObjectDefinition `json:"object,omitempty"`
Field []*XgenObjectField `json:"field"`
}
type XgenSortXgenDef ¶
type XgenSortXgenDef struct {
Object *XgenObjectDefinition `json:"object,omitempty"`
Field []*XgenObjectField `json:"field"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.