generator

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCollectionTypes

func GetCollectionTypes(field *Field) (map[string]*ViewScope, error)

func GetFieldArgVar

func GetFieldArgVar(field *Field) string

GetFieldArgVar is currently only used with field collections. It returns one of two values nil or args. If the root parent is a FieldCollection it returns args which is filled during template rendering

func GetPath

func GetPath(field *Field) string

func GetRootMethodReceiver

func GetRootMethodReceiver(field *Field) string

func New

func New(config generator.Config, contentTypes content.Types) (generator.Generator, error)

Types

type Field

type Field struct {
	Name              string
	Label             string
	Initial           string
	TypeName          string
	JSONName          string
	ViewType          string
	IsReference       bool
	IsNested          bool
	IsFieldCollection bool
	ReferenceName     string
	ReferenceJSONTags []string

	// Render Scope data
	Parent   *Field
	Scope    *ViewScope
	Children []Field
}

func (*Field) Validate

func (field *Field) Validate() error

func (*Field) View

func (field *Field) View() (string, error)

type ViewScope

type ViewScope struct {
	Definition   *generator.TypeDefinition
	Target       generator.Target
	TemplatesDir string
	ContentTypes content.Types
}

func (*ViewScope) Fields

func (scope *ViewScope) Fields(parent *Field) ([]Field, error)

Jump to

Keyboard shortcuts

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