codegen

package
v0.0.0-...-53734fa Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PostgresSchema = "%%SCHEMA%%"

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Fields   Fields
	Name     string
	IsEntity bool

	CacheSkipDBLookup bool

	ParallelSetterSteps     map[int][]*ParallelStep
	ParallelAggregatorSteps map[int][]*ParallelStep
}

type Enum

type Enum struct {
	Name   string
	Fields []string
}

func ParseEnum

func ParseEnum(def *ast.Definition) *Enum

type Enums

type Enums []*Enum

type EventDef

type EventDef struct {
	Anonymous bool
	Inputs    EventFields
	Name      string
	Type      string
}

type EventField

type EventField struct {
	Indexed      bool
	InternalType string
	Name         string
	Type         string
}

type EventFields

type EventFields []*EventField

func (EventFields) NamedOnly

func (a EventFields) NamedOnly() (out []*EventField)

type Field

type Field struct {
	Name          string
	Type          string
	GoType        string
	GoInit        string
	Init          string
	Nullable      bool
	Array         bool
	Derived       bool
	Hidden        bool
	PostgresType  string
	PostgresIndex string
	ParallelStep  *ParallelStep
}

func ParseFieldDefinition

func ParseFieldDefinition(field *ast.FieldDefinition) (*Field, error)

type Fields

type Fields []*Field

func (Fields) InitOnly

func (fs Fields) InitOnly() (out []*Field)

func (Fields) VisibleOnly

func (fs Fields) VisibleOnly() (out []*Field)

type ParallelStep

type ParallelStep struct {
	Step int
	Type string

	Field *Field
}

type TemplateEngine

type TemplateEngine struct {
	PackageName  string
	GoModulePath string
	Schema       string

	StartBlock     int
	FactorySource  string
	FactoryAddress string

	Manifest      string
	GraphQLSchema string
	Abis          map[string]string

	Entities []*Definition
	Enums    Enums

	HighestParallelStep int

	HasDynamicTemplate bool

	EventDefs map[string][]*EventDef
	Handlers  map[string][]*handler
	Templates []string

	CurrentSource      string
	CurrentEvent       string //super sorry!
	CurrentHandlerName string //again, really sorry.
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(yamlFilePath string, GoModulePath string, userLog *zapbox.CLILogger) (*TemplateEngine, error)

func (*TemplateEngine) BackTick

func (t *TemplateEngine) BackTick() string

func (*TemplateEngine) FirstLetter

func (t *TemplateEngine) FirstLetter(input string) string

func (*TemplateEngine) GenerateCode

func (t *TemplateEngine) GenerateCode(noGoMod bool) error

func (*TemplateEngine) IterateSteps

func (t *TemplateEngine) IterateSteps() (out []int)

func (*TemplateEngine) MapEventDecoder

func (t *TemplateEngine) MapEventDecoder(input string) string

func (*TemplateEngine) MapEventType

func (t *TemplateEngine) MapEventType(input string) string

func (*TemplateEngine) PlusOne

func (t *TemplateEngine) PlusOne(input int) int

func (*TemplateEngine) StringJoin

func (t *TemplateEngine) StringJoin(in []string) string

func (*TemplateEngine) ToCamelCase

func (t *TemplateEngine) ToCamelCase(input string) string

func (*TemplateEngine) ToLowerCamelCase

func (t *TemplateEngine) ToLowerCamelCase(input string) string

func (*TemplateEngine) ToLowerSnakeCase

func (t *TemplateEngine) ToLowerSnakeCase(input string) string

Jump to

Keyboard shortcuts

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