codegen

package
v1.66.4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package codegen generates code to make using this library easier You can currently use the code generator to generate go structs and Unmarshal methods for Directives and Input Objects type definitions This helps you interact very easily with configuration supplied by Directives which you can easily unmarshal into go structs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeGen

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

func New

func New(doc *ast.Document, config Config) *CodeGen

func (*CodeGen) Generate

func (c *CodeGen) Generate(w io.Writer) (int, error)

type Config

type Config struct {
	PackageName           string
	DirectiveStructSuffix string
}

type DataSourceConfig

type DataSourceConfig struct {
	NonNullString                 string
	NullableString                *string
	NonNullInt                    int64
	NullableInt                   *int64
	NonNullBoolean                bool
	NullableBoolean               *bool
	NonNullFloat                  float32
	NullableFloat                 *float32
	NullableListOfNullableString  *[]*string
	NonNullListOfNullableString   []*string
	NonNullListOfNonNullString    []string
	NullableListOfNullableHeader  *[]*Header
	NonNullListOfNullableHeader   []*Header
	NonNullListOfNonNullParameter []Parameter
	Methods                       Methods
	NullableStringWithDefault     string
	NonNullStringWithDefault      string
	IntWithDefault                int64
	FloatWithDefault              float32
	BooleanWithDefault            bool
	StringWithDefaultOverride     string
	InputWithDefaultChildField    InputWithDefault
}

func (*DataSourceConfig) Unmarshal

func (d *DataSourceConfig) Unmarshal(doc *ast.Document, ref int)

type HTTP_METHOD

type HTTP_METHOD int
const (
	UNDEFINED_HTTP_METHOD HTTP_METHOD = iota
	HTTP_METHOD_GET
	HTTP_METHOD_POST
	HTTP_METHOD_UPDATE
	HTTP_METHOD_DELETE
)

func (*HTTP_METHOD) Unmarshal

func (h *HTTP_METHOD) Unmarshal(doc *ast.Document, ref int)
type Header struct {
	Key   string
	Value string
}

func (*Header) Unmarshal

func (h *Header) Unmarshal(doc *ast.Document, ref int)

type InputWithDefault

type InputWithDefault struct {
	NullableString     *string
	StringWithDefault  string
	IntWithDefault     int64
	BooleanWithDefault bool
	FloatWithDefault   float32
}

func (*InputWithDefault) Unmarshal

func (i *InputWithDefault) Unmarshal(doc *ast.Document, ref int)

type Methods

type Methods struct {
	List []HTTP_METHOD
}

func (*Methods) Unmarshal

func (m *Methods) Unmarshal(doc *ast.Document, ref int)

type PARAMETER_SOURCE

type PARAMETER_SOURCE int
const (
	UNDEFINED_PARAMETER_SOURCE PARAMETER_SOURCE = iota
	PARAMETER_SOURCE_CONTEXT_VARIABLE
	PARAMETER_SOURCE_OBJECT_VARIABLE_ARGUMENT
	PARAMETER_SOURCE_FIELD_ARGUMENTS
)

func (*PARAMETER_SOURCE) Unmarshal

func (p *PARAMETER_SOURCE) Unmarshal(doc *ast.Document, ref int)

type Parameter

type Parameter struct {
	Name         string
	SourceKind   PARAMETER_SOURCE
	SourceName   string
	VariableName string
}

func (*Parameter) Unmarshal

func (p *Parameter) Unmarshal(doc *ast.Document, ref int)

Jump to

Keyboard shortcuts

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