types

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 7 Imported by: 11

Documentation

Overview

Package types contains structs/interfaces representing TypeScript types

Package types contains structs/interfaces representing TypeScript types

Package types contains structs/interfaces representing TypeScript types

Package types contains structs/interfaces representing TypeScript types

Package types contains structs/interfaces representing TypeScript types

Package types contains structs/interfaces representing TypeScript types

Package types contains structs/interfaces representing TypeScript types

Package types contains structs/interfaces representing TypeScript types

Package types contains structs/interfaces representing TypeScript types

Package types contains structs/interfaces representing TypeScript types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Any

type Any struct {
	Common
}

Any - any in TypeScript

func (*Any) String

func (e *Any) String() string

String returns this type in string representation

func (*Any) UsedAsMapKey

func (e *Any) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Array

type Array struct {
	Common
	Inner Type
}

Array - array in TypeScript

func (*Array) String

func (a *Array) String() string

String returns this type in string representation

func (*Array) UsedAsMapKey

func (a *Array) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Boolean

type Boolean struct {
	Common
}

Boolean - boolean in TypeScript

func (*Boolean) String

func (b *Boolean) String() string

String returns this type in string representation

func (*Boolean) UsedAsMapKey

func (b *Boolean) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Common

type Common struct {
	// PkgName is the package name declared at the beginning of .go files.
	// Currently, only exported types in the root package is available.
	PkgName  string
	Position *token.Position
}

Common defines common fields in the all types

func (*Common) GetPackageName

func (c *Common) GetPackageName() string

GetPackageName returns PkgName in Common

func (*Common) GetPosition

func (c *Common) GetPosition() *token.Position

GetPosition returns Position in Common

func (*Common) SetPackageName

func (c *Common) SetPackageName(pkgName string)

SetPackageName sets PkgName in Common

func (*Common) SetPosition

func (c *Common) SetPosition(pos *token.Position)

SetPosition sets Position in Common

type Date

type Date struct {
	Common
}

Date - RFC3399 string in TypeScript

func (*Date) String

func (*Date) String() string

String returns this type in string representation

func (*Date) UsedAsMapKey

func (*Date) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Enumerable

type Enumerable interface {
	Type

	// AddCandidates adds a candidate for enum
	AddCandidates(key string, v interface{})
}

Enumerable interface represents union types

type Map

type Map struct {
	Common
	Key   Type
	Value Type
}

Map - {[key: ...]: ...} in TypeScript

func (*Map) String

func (e *Map) String() string

String returns this type in string representation

func (*Map) UsedAsMapKey

func (e *Map) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type NamedType

type NamedType interface {
	Type

	// SetName sets an alternative name
	SetName(name string)
}

NamedType interface represents named types

type Nullable

type Nullable struct {
	Common
	Inner Type
}

Nullable - ... | null

func (*Nullable) String

func (e *Nullable) String() string

String returns this type in string representation

func (*Nullable) UsedAsMapKey

func (e *Nullable) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Number

type Number struct {
	Common
	Name    string
	RawType types.BasicKind

	Enum    []int64
	RawEnum []RawNumberEnumCandidate
}

Number - number in TypeScript

func (*Number) AddCandidates

func (e *Number) AddCandidates(key string, v interface{})

AddCandidates adds an candidate for enum

func (*Number) SetName

func (e *Number) SetName(name string)

SetName sets an alternative name

func (*Number) String

func (e *Number) String() string

String returns this type in string representation

func (*Number) UsedAsMapKey

func (e *Number) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Object

type Object struct {
	Common
	Name string

	Entries map[string]ObjectEntry
}

Object - {field1: ..., field2: ...} in TypeScript

func (*Object) SetName

func (n *Object) SetName(name string)

SetName sets an alternative name

func (*Object) String

func (n *Object) String() string

String returns this type in string representation

func (*Object) UsedAsMapKey

func (n *Object) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type ObjectEntry

type ObjectEntry struct {
	RawName    string
	RawTag     string
	FieldIndex int

	Type     Type
	Position *token.Position
	Optional bool
}

ObjectEntry is a field in objects

type RawNumberEnumCandidate

type RawNumberEnumCandidate struct {
	Key   string
	Value interface{}
}

RawNumberEnumCandidate represents a raw candidate for number enum

type RawStringEnumCandidate

type RawStringEnumCandidate struct {
	Key   string
	Value string
}

RawStringEnumCandidate represents a raw candidate for string enum

type String

type String struct {
	Common
	Name string

	Enum    []string
	RawEnum []RawStringEnumCandidate
}

String - string in TypeScript

func (*String) AddCandidates

func (n *String) AddCandidates(key string, v interface{})

AddCandidates adds an candidate for enum

func (*String) SetName

func (n *String) SetName(name string)

SetName sets an alternative name

func (*String) String

func (n *String) String() string

String returns this type in string representation

func (*String) UsedAsMapKey

func (n *String) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Type

type Type interface {
	SetPackageName(pkgName string)
	GetPackageName() string
	UsedAsMapKey() bool
	String() string
	SetPosition(pos *token.Position)
	GetPosition() *token.Position
}

Type interface represents all TypeScript types handled by go-easyparser

Jump to

Keyboard shortcuts

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