generator

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Generators = make([]Generator, 0)
)

Functions

func Register

func Register(generator Generator)

func Run

func Run(itemType Type, arguments []string) error

Types

type Block

type Block struct {
	Type              BlockType
	Name              string
	Label             string
	JSONName          string
	TypeName          string
	ReferenceName     string
	ReferenceJSONTags []string
	Definition        BlockDefinition
}

Block is the building block(s) of types

type BlockDefinition

type BlockDefinition struct {
	Title       string
	Type        string
	IsArray     bool
	IsReference bool
}

type BlockType

type BlockType int
const (
	Field BlockType = iota + 1
	ContentBlock
)

type Config

type Config struct {
	Target Target
	Type   Type
}

type Generator

type Generator interface {
	Generate(definition *TypeDefinition, writer Writer) error
	Initialize(definition *TypeDefinition, writer Writer) error
}

type Metadata

type Metadata struct {
	MethodReceiverName string
}

type Path

type Path struct {
	Root string
	Base string
}

type Target

type Target struct {
	Path    Path
	Package string
}

type Type

type Type int
const (
	Plain Type = iota + 1
	Content
	FieldCollection
)

type TypeDefinition

type TypeDefinition struct {
	Name   string
	Label  string
	Blocks []Block
	Type
	Metadata
}

func NewTypeDefinition

func NewTypeDefinition(itemType Type, args []string) (*TypeDefinition, error)

type Writer

type Writer interface {
	Write(filePath string, buf []byte) error
}
var FormattedSourceWriter Writer = new(fileWriter)

Jump to

Keyboard shortcuts

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