common

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExcludeArgumentFromTypeDirective = directives.InputObjectDirectiveDefinition{
		Definition: &ast.DirectiveDefinition{
			Name:        consts.ExcludeArgumentFromType,
			Description: `This directive is used to exclude the argument from the type`,
			Position:    pos,
			Locations: []ast.DirectiveLocation{
				ast.LocationArgumentDefinition,
			},
			Arguments: ast.ArgumentDefinitionList{
				{
					Name: "exclude",
					Type: ast.NamedType("Boolean", nil),
				},
			},
		},
	}
)
View Source
var (
	ToObjectType = directives.InputObjectDirectiveDefinition{
		Definition: &ast.DirectiveDefinition{
			Name:        consts.ToObjectType,
			Description: `This directive is used to define the object type`,
			Position:    pos,
			Locations: []ast.DirectiveLocation{
				ast.LocationArgumentDefinition,
				ast.LocationInputFieldDefinition,
				ast.LocationFieldDefinition,
			},
			Arguments: ast.ArgumentDefinitionList{
				{
					Name: "type",
					Type: ast.NonNullNamedType("String", nil),
				},
			},
		},
	}
)

Functions

func AnyFieldListToObjectFieldList added in v0.0.2

func AnyFieldListToObjectFieldList(fields ast.FieldList) (ast.FieldList, error)

func AnyFieldToObjectField added in v0.0.2

func AnyFieldToObjectField(field ast.FieldDefinition) (*ast.FieldDefinition, error)

func AppendFieldIfNotExists

func AppendFieldIfNotExists(fields []*ast.FieldDefinition, field *ast.FieldDefinition) []*ast.FieldDefinition

AppendFieldIfNotExists appends field to fields if it doesn't exist

func ArgsToFields

func ArgsToFields(args ast.ArgumentDefinitionList) ast.FieldList

ArgsToFields converts arguments to fields

func ArgsToObjectFields added in v0.0.2

func ArgsToObjectFields(args ast.ArgumentDefinitionList) ast.FieldList

func ArgsToStruct added in v0.0.2

func ArgsToStruct[T any](args ast.ArgumentList, st *T) error

func DirectiveToType

func DirectiveToType(directive *ast.DirectiveDefinition, pos *ast.Position) *ast.Definition

DirectiveToType converts directive to type

func FindObjectByResourceName

func FindObjectByResourceName(schema *ast.Schema, name string) *ast.Definition

FindObjectByResourceName finds object by resource name

func GetDefinedObjects

func GetDefinedObjects(schema *ast.Schema, hasDirectives ...string) map[string]*ast.Definition

GetDefinedObjects returns all defined objects in schema

func GetResourceDirectiveSingularType

func GetResourceDirectiveSingularType(schema *ast.Schema, directive *ast.Directive) (*ast.Type, error)

GetResourceDirectiveSingularType returns resource directive singular type

func IsMutationAction

func IsMutationAction(directive *ast.Directive) bool

IsMutationAction checks if directive is mutation action

func IsQueryAction

func IsQueryAction(directive *ast.Directive) bool

IsQueryAction checks if directive is query action

func IsXgenDirectiveDefinition

func IsXgenDirectiveDefinition(directive *ast.DirectiveDefinition) bool

IsXgenDirectiveDefinition checks if directive is xgen directive

func ToObjectDefinition added in v0.0.2

func ToObjectDefinition(def ast.Definition, newName string) *ast.Definition

ToObjectDefinition converts ast.Definition with any Kind to ast.Definition with a Kind is ast.Object

Types

This section is empty.

Jump to

Keyboard shortcuts

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