gotypes

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package gotypes resolves Go contracts referenced from .gwdk component files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EffectiveImportAlias

func EffectiveImportAlias(item manifest.Import) (string, error)

EffectiveImportAlias returns the explicit import alias or the package name used by Go for an unaliased import.

func ImportPathForAlias

func ImportPathForAlias(imports []manifest.Import, alias string) (string, error)

ImportPathForAlias returns the concrete Go import path for a .gwdk import alias and rejects relative import paths.

func RunStateInitJSON

func RunStateInitJSON(imports []manifest.Import, state manifest.StateContract) ([]byte, error)

RunStateInitJSON runs a declared state init function and returns its JSON encoding.

func ValidateImportPath

func ValidateImportPath(importPath string) error

ValidateImportPath rejects relative or malformed import paths in component contracts.

func ValidateStateInit

func ValidateStateInit(imports []manifest.Import, state manifest.StateContract) error

ValidateStateInit verifies that the state init function can initialize the declared state type.

Types

type Field

type Field struct {
	Name string
	Type string
}

Field describes one resolved Go struct field.

type Struct

type Struct struct {
	ImportPath string
	Name       string
	Fields     []Field
	FieldTypes map[string]string
}

Struct describes a resolved Go struct type.

func ResolveStruct

func ResolveStruct(imports []manifest.Import, ref manifest.GoTypeRef) (Struct, error)

ResolveStruct resolves a Go struct type referenced by a component contract.

func (Struct) FieldNames

func (item Struct) FieldNames() []string

FieldNames returns the resolved struct fields in source/type-checker order.

func (Struct) HasField

func (item Struct) HasField(field string) bool

HasField reports whether the resolved struct declares field.

Jump to

Keyboard shortcuts

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