internal

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDir

func EnsureDir(filePath string) error

func LoadSchema

func LoadSchema(inputs ...string) (*ast.Schema, error)

Types

type Config

type Config struct {
	Schemas   []string             `yaml:"schema"`
	Documents []string             `yaml:"documents"`
	Overwrite bool                 `yaml:"overwrite"`
	Generates map[string]Generates `yaml:"generates"`
}

func ParseJSConfig

func ParseJSConfig(configString string, filePath string) Config

ParseJSConfig parses a given JS string

func ParseTSConfig

func ParseTSConfig(configString string, filePath string) Config

ParseTSConfig parses a given TS string

func ParseYAMLConfig

func ParseYAMLConfig(configData []byte) Config

type ExecutionContext

type ExecutionContext struct {
	Projects      []Project
	LoadedSchemas map[string]*ast.Schema
}

func (*ExecutionContext) AddLoadedSchema

func (e *ExecutionContext) AddLoadedSchema(key string, schema *ast.Schema)

func (*ExecutionContext) Execute

func (e *ExecutionContext) Execute()

func (*ExecutionContext) ExecuteDestinationTasks

func (e *ExecutionContext) ExecuteDestinationTasks(
	destinationConfig Generates,
	output *strings.Builder,
	schema *ast.Schema,
	project Project,
)

func (*ExecutionContext) GetSchema

func (e *ExecutionContext) GetSchema(key string) *ast.Schema

func (*ExecutionContext) LoadSchemas

func (e *ExecutionContext) LoadSchemas() int

LoadSchemas will find every project with a unique list of schemas and load those to cache.

func (*ExecutionContext) SetProjects

func (e *ExecutionContext) SetProjects(projects []Project)

type Generates

type Generates struct {
	Plugins []string `yaml:"plugins"`
	Preset  string   `yaml:"preset"`
}

type Project

type Project struct {
	RootDir    string
	ConfigFile string
	Schemas    []string
	// contains filtered or unexported fields
}

func FindProjects

func FindProjects(rootDir string, walkDir func(string, fs.WalkDirFunc) error) ([]Project, error)

func (*Project) GetConfig

func (p *Project) GetConfig() Config

func (*Project) SchemaKey

func (p *Project) SchemaKey() string

SchemaKey generates a string get is unique to a combination of schema documents

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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