codegen

package
v0.0.0-...-9663103 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PARQUET_KEY = "parquet"
)

Variables

This section is empty.

Functions

func Generate

func Generate(options *Options) error

Generate generates transformed code into output file

Types

type Node

type Node struct {
	OwnerType string
	OwnerPath string
	Def       int
	Rep       int
	Pos       int
	Field     *toolbox.FieldInfo
	FieldName string
	Parent    *Node
	// contains filtered or unexported fields
}

func NewNode

func NewNode(sess *session, ownerType string, field *toolbox.FieldInfo) *Node

func (*Node) CastNativeBegin

func (n *Node) CastNativeBegin() string

func (*Node) CastNativeEnd

func (n *Node) CastNativeEnd() string

func (*Node) CastParquetBegin

func (n *Node) CastParquetBegin() string

func (*Node) CastParquetEnd

func (n *Node) CastParquetEnd() string

func (*Node) CheckValue

func (n *Node) CheckValue() string

func (*Node) IsOptional

func (n *Node) IsOptional() bool

func (*Node) IsRepeated

func (n *Node) IsRepeated() bool

func (*Node) ParquetType

func (n *Node) ParquetType() string

func (*Node) Path

func (n *Node) Path() string

func (*Node) RelativePath

func (n *Node) RelativePath() string

func (*Node) SimpleType

func (n *Node) SimpleType() string

func (*Node) StructType

func (n *Node) StructType(maxDef int) string

type NodeParams

type NodeParams struct {
	MethodSuffix     string
	OwnerType        string
	ParquetType      string
	ParquetTypeTitle string
	FieldName        string
	OwnerPath        string
	FieldPath        string
	FieldType        string
	Code             string
	CastNativeBegin  string
	CastNativeEnd    string
	NativeType       string
	CastParquetBegin string
	CastParquetEnd   string
	StructType       string
	OwnerAlias       string
	MaxRep           int
}

type Nodes

type Nodes []*Node

func (Nodes) AccessorOwnerPath

func (n Nodes) AccessorOwnerPath(endNodePos int) string

func (Nodes) DefCasePath

func (n Nodes) DefCasePath(def int) string

DefCaseAppendPath produces optional/repeated case mutator path

func (Nodes) DefCasePathPos

func (n Nodes) DefCasePathPos(def int) int

DefCasePathPos returns the node position where supplied is equal or less to node rep, or -1 otherwise

func (Nodes) DefCaseValue

func (n Nodes) DefCaseValue(def int) string

DefCaseAppendPath produces case init value

func (Nodes) DefNilNode

func (n Nodes) DefNilNode(def int) *Node

func (Nodes) DefPos

func (n Nodes) DefPos(def int) int

func (*Nodes) Init

func (n *Nodes) Init(omitEmpty bool)

func (Nodes) Leaf

func (n Nodes) Leaf() *Node

func (Nodes) MaxDef

func (n Nodes) MaxDef() int

func (Nodes) MaxRep

func (n Nodes) MaxRep() int

func (Nodes) MethodSuffix

func (n Nodes) MethodSuffix() string

func (Nodes) Names

func (n Nodes) Names() []string

func (Nodes) NewParams

func (n Nodes) NewParams(code string) *NodeParams

func (Nodes) OwnerType

func (n Nodes) OwnerType() string

func (Nodes) Path

func (n Nodes) Path() []string

func (Nodes) PathList

func (n Nodes) PathList() string

func (Nodes) RepCasePath

func (n Nodes) RepCasePath(rep int) string

DefCaseAppendPath produces accessorOpt to append at depth

func (Nodes) RepCaseValue

func (n Nodes) RepCaseValue(rep int) string

RepCaseValue produces accessorOpt to append at depth

func (Nodes) RepPos

func (n Nodes) RepPos(rep int) int

func (Nodes) RepetitionTypes

func (n Nodes) RepetitionTypes() []int

func (Nodes) RepetitionTypesList

func (n Nodes) RepetitionTypesList() string

func (Nodes) SchemaOptions

func (n Nodes) SchemaOptions() string

type Options

type Options struct {
	Source    string `short:"s" long:"sourceURL" description:"source URL"`
	Dest      string `short:"d" long:"destinationURL" description:"destination URL"`
	Type      string `short:"t" long:"struct type" description:"struct type"`
	OmitEmpty bool   `short:"o" long:"omitEmpty" description:"Omit Empty type"`
}

Options represents Cli options

func (Options) Validate

func (o Options) Validate() error

type Template

type Template string

func (Template) Expand

func (t Template) Expand(id string, data interface{}) (string, error)

Jump to

Keyboard shortcuts

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