coregolang

package
v0.0.0-...-2561dba Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TemplateFuncName is the name this function is registered as.
	TemplateFuncName = "template"

	// TemplateName is the name of our template as required by the template
	// library.
	TemplateName = "template"
)
View Source
const (
	// ModuleName is the prefix given to all the functions in this module.
	ModuleName = "golang"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TemplateFunc

type TemplateFunc struct {
	// Type is the type of the input vars (2nd) arg if one is specified. Nil
	// is the special undetermined value that is used before type is known.
	Type *types.Type // type of vars
	// contains filtered or unexported fields
}

TemplateFunc is a static polymorphic function that compiles a template and returns the output as a string. It bases its output on the values passed in to it. It examines the type of the second argument (the input data vars) at compile time and then determines the static functions signature by including that in the overall signature. TODO: We *might* need to add events for internal function changes over time, but only if they are not pure. We currently only use simple, pure functions.

func (*TemplateFunc) ArgGen

func (obj *TemplateFunc) ArgGen(index int) (string, error)

ArgGen returns the Nth arg name for this function.

func (*TemplateFunc) Build

func (obj *TemplateFunc) Build(typ *types.Type) (*types.Type, error)

Build takes the now known function signature and stores it so that this function can appear to be static. It extracts the type of the vars argument, which is the dynamic part which can change. That type is used to build our function statically.

func (*TemplateFunc) FuncInfer

func (obj *TemplateFunc) FuncInfer(partialType *types.Type, partialValues []types.Value) (*types.Type, []*interfaces.UnificationInvariant, error)

FuncInfer takes partial type and value information from the call site of this function so that it can build an appropriate type signature for it. The type signature may include unification variables.

func (*TemplateFunc) Info

func (obj *TemplateFunc) Info() *interfaces.Info

Info returns some static info about itself.

func (*TemplateFunc) Init

func (obj *TemplateFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*TemplateFunc) Stream

func (obj *TemplateFunc) Stream(ctx context.Context) error

Stream returns the changing values that this func has over time.

func (*TemplateFunc) String

func (obj *TemplateFunc) String() string

String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.

func (*TemplateFunc) Validate

func (obj *TemplateFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

Jump to

Keyboard shortcuts

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