Documentation ¶
Index ¶
- Constants
- Variables
- func ExecuteSchema(list []Plugin, schema *parser.Schema, output *Output) error
- func ExecuteTemplate(templateName string, data any) (output string, err error)
- func ListPlugins() []string
- func MustRegisterTemplate(plugin Plugin, name string, raw string)
- func RegisterPlugin(name string, p Plugin)
- func WritePluginSkeleton(files fs.FS, output *Output) (err error)
- func WriteSkeleton(outputDir string) (err error)
- type Output
- func (o *Output) AppendOrCreate(typ string, filename string, content string) (of *OutputFile, err error)
- func (o *Output) Create(typ string, filename string, content string) (of *OutputFile, err error)
- func (o *Output) EnsureHasFile(typ string, filename string) (of *OutputFile, err error)
- func (o *Output) FileNames() []string
- func (o *Output) GetFiles() map[string]*OutputFile
- func (o *Output) HasFile(typ string, filename string) bool
- func (o *Output) Write(outputDir string) (err error)
- type OutputFile
- type Plugin
- type Type
Constants ¶
View Source
const ( RAW_SKEL = "raw_skel" GO_DATA_GEN = "go_data_gen" GO_DATA_SKEL = "go_data_skel" GO_LAMBDA_SKEL = "go_lambda_skel" GO_LAMBDA_MOD = "go_lambda_mod" TS_FRONTEND_GEN = "ts_frontend_gen" TF_API_GEN = "tf_api_gen" TF_API_SKEL = "tf_api_skel" )
Variables ¶
View Source
var Types = map[string]Type{ RAW_SKEL: { Header: ``, Extension: "", Format: nil, GenerateIfEmpty: false, Overwrite: false, DirectoryPrefix: "", ExtraDataRender: nil, }, GO_DATA_GEN: { Header: `package data // Code generated by gql-rapid-gen DO NOT EDIT. // This file is derivative of gql-rapid-gen templates. // Template Copyright (c) 2023 under the MIT license per gql-rapid-gen/LICENSE.MD. `, Extension: ".gen.go", Format: formatGo, GenerateIfEmpty: false, Overwrite: true, DirectoryPrefix: "lib/data/", ExtraDataRender: goImports, }, GO_DATA_SKEL: { Header: `package data // Skeleton generated by gql-rapid-gen. // This file is derivative of gql-rapid-gen templates. // Template Copyright (c) 2023 under the MIT license per gql-rapid-gen/LICENSE.MD. `, Extension: ".go", Format: formatGo, GenerateIfEmpty: true, Overwrite: false, DirectoryPrefix: "lib/data/", ExtraDataRender: goImports, }, GO_LAMBDA_SKEL: { Header: `package main // Skeleton generated by gql-rapid-gen. // This file is derivative of gql-rapid-gen templates. // Template Copyright (c) 2023 under the MIT license per gql-rapid-gen/LICENSE.MD. `, Extension: ".go", Format: formatGo, GenerateIfEmpty: true, Overwrite: false, DirectoryPrefix: "backend/api/lambda/", }, GO_LAMBDA_MOD: { Header: "", Extension: ".mod", Format: nil, GenerateIfEmpty: false, Overwrite: false, DirectoryPrefix: "backend/api/lambda/", }, TS_FRONTEND_GEN: { Header: ` // Code generated by gql-rapid-gen DO NOT EDIT. // This file is derivative of gql-rapid-gen templates. // Template Copyright (c) 2023 under the MIT license per gql-rapid-gen/LICENSE.MD. `, Extension: ".gen.tsx", GenerateIfEmpty: false, Overwrite: true, DirectoryPrefix: "frontend/gen/", ExtraDataRender: tsImports, }, TF_API_GEN: { Header: ` // Code generated by gql-rapid-gen DO NOT EDIT. // This file is derivative of gql-rapid-gen templates. // Template Copyright (c) 2023 under the MIT license per gql-rapid-gen/LICENSE.MD. `, Extension: ".gen.tf", GenerateIfEmpty: false, Overwrite: true, DirectoryPrefix: "backend/api/", }, TF_API_SKEL: { Header: ` // Skeleton generated by gql-rapid-gen. // This file is derivative of gql-rapid-gen templates. // Template Copyright (c) 2023 under the MIT license per gql-rapid-gen/LICENSE.MD. `, Extension: ".tf", GenerateIfEmpty: true, Overwrite: false, DirectoryPrefix: "backend/api/", }, }
Functions ¶
func ExecuteSchema ¶
ExecuteSchema runs a list of Plugin entities against a given Schema. It assumes they have already been qualified.
func ExecuteTemplate ¶
func ListPlugins ¶
func ListPlugins() []string
ListPlugins returns the names of all plugins registered
func MustRegisterTemplate ¶
MustRegisterTemplate manually registers a new template, if defined outside the normal file structure
func RegisterPlugin ¶
RegisterPlugin adds a new plugin to the registry, validating it does not already exist
func WritePluginSkeleton ¶ added in v0.9.3
func WriteSkeleton ¶
Types ¶
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
func (*Output) AppendOrCreate ¶
func (*Output) EnsureHasFile ¶
func (o *Output) EnsureHasFile(typ string, filename string) (of *OutputFile, err error)
func (*Output) GetFiles ¶
func (o *Output) GetFiles() map[string]*OutputFile
type OutputFile ¶
type OutputFile struct {
// contains filtered or unexported fields
}
func CreateOutputFile ¶
func CreateOutputFile(typ string) (ret *OutputFile, err error)
func (*OutputFile) Add ¶
func (of *OutputFile) Add(text ...string)
func (*OutputFile) AddExtraData ¶
func (of *OutputFile) AddExtraData(text ...string)
func (*OutputFile) Render ¶
func (of *OutputFile) Render() (out string, err error)
func (*OutputFile) String ¶
func (of *OutputFile) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.