tsbridge

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecideEnumTypeName

func DecideEnumTypeName(t reflect.Type) string

func WriteStructTSBinding

func WriteStructTSBinding(b *Bridge, w io.Writer)

Types

type Bridge

type Bridge struct {
	Structs []StructInfo
	Enums   []EnumInfo
	Errors  []ErrorInfo

	// types we want to process (structs/enums)
	ProcessedTypes []reflect.Type
	QueuedTypes    []reflect.Type

	// packages we want to process consts for
	QueuedPackages    []string
	ProcessedPackages []string
}

func (*Bridge) AddStructFields

func (b *Bridge) AddStructFields(sinfo *StructInfo, t reflect.Type)

func (*Bridge) DecideTypescriptTypeName

func (b *Bridge) DecideTypescriptTypeName(t reflect.Type) string

func (*Bridge) Process

func (b *Bridge) Process()

func (*Bridge) ProcessPackage

func (b *Bridge) ProcessPackage(pkgPath string)

func (*Bridge) QueueObject

func (b *Bridge) QueueObject(x interface{})

func (*Bridge) QueuePackage

func (b *Bridge) QueuePackage(pkgPath string)

func (*Bridge) QueueType

func (b *Bridge) QueueType(t reflect.Type)

type ConstValue

type ConstValue struct {
	Name  string
	Value any // int or string
}

type EnumInfo

type EnumInfo struct {
	Name     string
	TypeName string
	Consts   []ConstValue
}

type ErrorInfo

type ErrorInfo struct {
	Name  string
	Value string // go-quoted string
}

type StructField

type StructField struct {
	Name       string
	TypeName   string
	TypeCustom bool
}

type StructInfo

type StructInfo struct {
	Name   string
	Fields []StructField
}

Jump to

Keyboard shortcuts

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