js

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	GQLClientGeneratorName   = "GraphQL-TS"
	GQLClientOptions         = "gql-ts"
	GQLClientPathOption      = "path"
	GQLClientNamespaceOption = "useNamespace"

	Annotation          = "js"
	AnnotationName      = "name"
	AnnotationInputName = "inputName"
	// AnnotationType = "type"
	// jsAnnotationIDType   = "id_type"
	AnnotationSkip = "skip"
	// jsAnnotationFilePath = "filepath"
	AnnotationTitle        = "title"
	AnnotationIcon         = "icon"
	AnnotationColor        = "color"
	AnnotationForce        = "force"
	AnnotationForceForFind = "findForce"
)
View Source
const (
	Features           = "js"
	FName              = "name"
	FType              = "type"
	FInputType         = "input-type"
	FFillInputFuncName = "fill-inp-func"
	FFile              = "file"
	FIDType            = "id_type"
	FFilePath          = "filepath"
	FInstanceGenerator = "instance_generator"
	// FForceLoadForField - force load field when its parent is included in other object (usually only id and title are loaded)
	FForceLoadForField = "field_force_load"
	// FFunctionName returns function that returns name of GQL operation function for Entity (arg - GQLOperationKind)
	FFunctionName = "gql_function_name"
)
View Source
const (
	ValidatorGeneratorName = "TSValidator"
	FeaturesValidator      = "ts-validator"
	FVGenerate             = "generate"
	FVValidatorClass       = "validator"
)
View Source
const CodeFragmentActionFile = "file"
View Source
const CodeFragmentActionImport = "import"
View Source
const CodeFragmentModule = "ts"

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgDef

type ArgDef struct {
	Name         string
	Type         string
	JSType       string
	ExcessFields []string
	NotNull      bool
	Optional     bool
}

type CodeFragmentContext

type CodeFragmentContext struct {
	FileName string
	File     *gen.File
	Output   *os.File
	Error    error
	Imports
}

func (CodeFragmentContext) Add

func (cfc CodeFragmentContext) Add(str string) error

Add adds str to file and append \n

func (CodeFragmentContext) AddImport

func (cfc CodeFragmentContext) AddImport(file string, tip string)

type GQLCLientGenerator

type GQLCLientGenerator struct {
	// contains filtered or unexported fields
}

func (*GQLCLientGenerator) CheckAnnotation

func (cg *GQLCLientGenerator) CheckAnnotation(desc *gen.Package, ann *gen.Annotation, item interface{}) (bool, error)

func (*GQLCLientGenerator) Generate

func (cg *GQLCLientGenerator) Generate(b *gen.Builder) (err error)

func (*GQLCLientGenerator) GenerateVivard

func (cg *GQLCLientGenerator) GenerateVivard() (err error)

func (*GQLCLientGenerator) GetEnumFieldJSValue added in v0.1.7

func (cg *GQLCLientGenerator) GetEnumFieldJSValue(ef *gen.EnumField) string

func (*GQLCLientGenerator) GetJSEmptyVal

func (cg *GQLCLientGenerator) GetJSEmptyVal(ref *gen.TypeRef) (ret string)

func (*GQLCLientGenerator) GetJSEntityInputTypeName

func (cg *GQLCLientGenerator) GetJSEntityInputTypeName(name string) string

func (*GQLCLientGenerator) GetJSEntityTypeName

func (cg *GQLCLientGenerator) GetJSEntityTypeName(name string) string

func (*GQLCLientGenerator) GetJSInputTypeName

func (cg *GQLCLientGenerator) GetJSInputTypeName(ref *gen.TypeRef, asRef bool) (ret string)

func (*GQLCLientGenerator) GetJSTypeName

func (cg *GQLCLientGenerator) GetJSTypeName(ref *gen.TypeRef, asRef bool) (ret string)

func (*GQLCLientGenerator) GetJSTypeNameByVivardName added in v0.1.13

func (cg *GQLCLientGenerator) GetJSTypeNameByVivardName(tip string) string

func (*GQLCLientGenerator) Name

func (cg *GQLCLientGenerator) Name() string

func (*GQLCLientGenerator) Prepare

func (cg *GQLCLientGenerator) Prepare(desc *gen.Package) error

func (*GQLCLientGenerator) ProvideFeature

func (cg *GQLCLientGenerator) ProvideFeature(
	kind gen.FeatureKind,
	name string,
	obj interface{},
) (feature interface{}, ok gen.ProvideFeatureResult)

func (*GQLCLientGenerator) SetOptions

func (cg *GQLCLientGenerator) SetOptions(options any) error

type Imports

type Imports map[string][]string

type QueryDef

type QueryDef struct {
	Request       string
	QueryName     string
	FuncName      string
	VarName       string
	JSArgType     string
	JSRetType     string
	Args          []ArgDef
	Fields        []string
	FillInputName string
}

type TSValidatorGenerator

type TSValidatorGenerator struct {
	// contains filtered or unexported fields
}

func (*TSValidatorGenerator) CheckAnnotation

func (cg *TSValidatorGenerator) CheckAnnotation(desc *gen.Package, ann *gen.Annotation, item interface{}) (bool, error)

func (*TSValidatorGenerator) Generate

func (cg *TSValidatorGenerator) Generate(b *gen.Builder) (err error)

func (*TSValidatorGenerator) Name

func (cg *TSValidatorGenerator) Name() string

func (*TSValidatorGenerator) Prepare

func (cg *TSValidatorGenerator) Prepare(desc *gen.Package) error

func (*TSValidatorGenerator) ProvideCodeFragment

func (cg *TSValidatorGenerator) ProvideCodeFragment(module interface{}, action interface{}, point interface{}, ctx interface{}) interface{}

Jump to

Keyboard shortcuts

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