ast

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ByteSizeB  ByteSize = 1
	ByteSizeKB          = ByteSizeB * 1024
	ByteSizeMB          = ByteSizeKB * 1024
	ByteSizeGB          = ByteSizeMB * 1024
	ByteSizeTB          = ByteSizeGB * 1024
	ByteSizePB          = ByteSizeTB * 1024
	ByteSizeEB          = ByteSizePB * 1024
)
View Source
const (
	DurationScaleNanosecond  DurationScale = 1
	DurationScaleMicrosecond               = DurationScaleNanosecond * 1000
	DurationScaleMillisecond               = DurationScaleMicrosecond * 1000
	DurationScaleSecond                    = DurationScaleMillisecond * 1000
	DurationScaleMinute                    = DurationScaleSecond * 60
	DurationScaleHour                      = DurationScaleMinute * 60
)

Variables

View Source
var HttpStatusCode2String = map[int]string{
	100: "Continue",
	101: "SwitchingProtocols",
	102: "Processing",
	103: "EarlyHints",
	200: "OK",
	201: "Created",
	202: "Accepted",
	203: "NonAuthoritativeInfo",
	204: "NoContent",
	205: "ResetContent",
	206: "PartialContent",
	207: "MultiStatus",
	208: "AlreadyReported",
	226: "IMUsed",
	300: "MultipleChoices",
	301: "MovedPermanently",
	302: "Found",
	303: "SeeOther",
	304: "NotModified",
	305: "UseProxy",
	307: "TemporaryRedirect",
	308: "PermanentRedirect",
	400: "BadRequest",
	401: "Unauthorized",
	402: "PaymentRequired",
	403: "Forbidden",
	404: "NotFound",
	405: "MethodNotAllowed",
	406: "NotAcceptable",
	407: "ProxyAuthRequired",
	408: "RequestTimeout",
	409: "Conflict",
	410: "Gone",
	411: "LengthRequired",
	412: "PreconditionFailed",
	413: "RequestEntityTooLarge",
	414: "RequestURITooLong",
	415: "UnsupportedMediaType",
	416: "RequestedRangeNotSatisfiable",
	417: "ExpectationFailed",
	418: "Teapot",
	421: "MisdirectedRequest",
	422: "UnprocessableEntity",
	423: "Locked",
	424: "FailedDependency",
	425: "TooEarly",
	426: "UpgradeRequired",
	428: "PreconditionRequired",
	429: "TooManyRequests",
	431: "RequestHeaderFieldsTooLarge",
	451: "UnavailableForLegalReasons",
	500: "InternalServerError",
	501: "NotImplemented",
	502: "BadGateway",
	503: "ServiceUnavailable",
	504: "GatewayTimeout",
	505: "HTTPVersionNotSupported",
	506: "VariantAlsoNegotiates",
	507: "InsufficientStorage",
	508: "LoopDetected",
	510: "NotExtended",
	511: "NetworkAuthenticationRequired",
}
View Source
var HttpStatusString2Code = map[string]int{
	"Continue":                      100,
	"SwitchingProtocols":            101,
	"Processing":                    102,
	"EarlyHints":                    103,
	"OK":                            200,
	"Created":                       201,
	"Accepted":                      202,
	"NonAuthoritativeInfo":          203,
	"NoContent":                     204,
	"ResetContent":                  205,
	"PartialContent":                206,
	"MultiStatus":                   207,
	"AlreadyReported":               208,
	"IMUsed":                        226,
	"MultipleChoices":               300,
	"MovedPermanently":              301,
	"Found":                         302,
	"SeeOther":                      303,
	"NotModified":                   304,
	"UseProxy":                      305,
	"TemporaryRedirect":             307,
	"PermanentRedirect":             308,
	"BadRequest":                    400,
	"Unauthorized":                  401,
	"PaymentRequired":               402,
	"Forbidden":                     403,
	"NotFound":                      404,
	"MethodNotAllowed":              405,
	"NotAcceptable":                 406,
	"ProxyAuthRequired":             407,
	"RequestTimeout":                408,
	"Conflict":                      409,
	"Gone":                          410,
	"LengthRequired":                411,
	"PreconditionFailed":            412,
	"RequestEntityTooLarge":         413,
	"RequestURITooLong":             414,
	"UnsupportedMediaType":          415,
	"RequestedRangeNotSatisfiable":  416,
	"ExpectationFailed":             417,
	"Teapot":                        418,
	"MisdirectedRequest":            421,
	"UnprocessableEntity":           422,
	"Locked":                        423,
	"FailedDependency":              424,
	"TooEarly":                      425,
	"UpgradeRequired":               426,
	"PreconditionRequired":          428,
	"TooManyRequests":               429,
	"RequestHeaderFieldsTooLarge":   431,
	"UnavailableForLegalReasons":    451,
	"InternalServerError":           500,
	"NotImplemented":                501,
	"BadGateway":                    502,
	"ServiceUnavailable":            503,
	"GatewayTimeout":                504,
	"HTTPVersionNotSupported":       505,
	"VariantAlsoNegotiates":         506,
	"InsufficientStorage":           507,
	"LoopDetected":                  508,
	"NotExtended":                   510,
	"NetworkAuthenticationRequired": 511,
}

Functions

This section is empty.

Types

type Any

type Any struct {
	Token *token.Token `json:"token"`
}

func (*Any) String

func (t *Any) String() string

func (*Any) TokenLiteral

func (t *Any) TokenLiteral() string

type Arg

type Arg struct {
	Name     *Identifier `json:"name"`
	Type     Type        `json:"type"`
	Optional bool        `json:"optional"`
}

func (*Arg) MarshalText

func (a *Arg) MarshalText() ([]byte, error)

func (*Arg) String

func (a *Arg) String() string

func (*Arg) TokenLiteral

func (a *Arg) TokenLiteral() string

func (*Arg) UnmarshalText

func (a *Arg) UnmarshalText(text []byte) error

type Args

type Args []*Arg

func (Args) String

func (a Args) String() string

type Array

type Array struct {
	Token *token.Token `json:"token"` // this is the '[' token
	Type  Type         `json:"type"`
}

func (*Array) String

func (t *Array) String() string

func (*Array) TokenLiteral

func (t *Array) TokenLiteral() string

type Bool

type Bool struct {
	Token *token.Token `json:"token"`
}

func (*Bool) String

func (t *Bool) String() string

func (*Bool) TokenLiteral

func (t *Bool) TokenLiteral() string

type Byte

type Byte struct {
	Token *token.Token `json:"token"`
}

func (*Byte) String

func (t *Byte) String() string

func (*Byte) TokenLiteral

func (t *Byte) TokenLiteral() string

type ByteSize

type ByteSize int64

func (ByteSize) String

func (b ByteSize) String() string

type Const

type Const struct {
	Token *token.Token `json:"token"`
	Name  *Identifier  `json:"name"`
	Value Value        `json:"value"`
}

func (*Const) String

func (c *Const) String() string

func (*Const) TokenLiteral

func (c *Const) TokenLiteral() string

type CustomError

type CustomError struct {
	Token      *token.Token
	Name       *Identifier
	Code       int64
	HttpStatus int
	Msg        *ValueString
}

func (*CustomError) String

func (c *CustomError) String() string

func (*CustomError) TokenLiteral

func (c *CustomError) TokenLiteral() string

type CustomType

type CustomType struct {
	Token *token.Token `json:"token"`
}

func (*CustomType) String

func (t *CustomType) String() string

func (*CustomType) TokenLiteral

func (t *CustomType) TokenLiteral() string

type DurationScale

type DurationScale int64

func (DurationScale) String

func (d DurationScale) String() string

type Enum

type Enum struct {
	Token *token.Token
	Name  *Identifier
	Size  int // 8, 16, 32, 64 selected by compiler based on the largest and smallest values
	Sets  []*EnumSet
}

func (*Enum) String

func (e *Enum) String() string

func (*Enum) TokenLiteral

func (e *Enum) TokenLiteral() string

type EnumSet

type EnumSet struct {
	Name    *Identifier `json:"name"`
	Value   *ValueInt   `json:"value"`
	Defined bool        `json:"defined"`
}

func (*EnumSet) String

func (e *EnumSet) String() string

func (*EnumSet) TokenLiteral

func (e *EnumSet) TokenLiteral() string

type Field

type Field struct {
	Name    *Identifier `json:"name"`
	Type    Type        `json:"type"`
	Options Options     `json:"options"`
}

func (*Field) MarshalText

func (f *Field) MarshalText() ([]byte, error)

func (*Field) String

func (f *Field) String() string

func (*Field) TokenLiteral

func (f *Field) TokenLiteral() string

func (*Field) UnmarshalText

func (f *Field) UnmarshalText(text []byte) error

type Fields

type Fields []*Field

func (Fields) String

func (f Fields) String() string

type File

type File struct {
	Token *token.Token `json:"token"`
}

func (*File) String

func (t *File) String() string

func (*File) TokenLiteral

func (t *File) TokenLiteral() string

type Float

type Float struct {
	Token *token.Token `json:"token"`
	Size  int          `json:"size"` // 32, 64
}

func (*Float) String

func (t *Float) String() string

func (*Float) TokenLiteral

func (t *Float) TokenLiteral() string

type Identifier

type Identifier struct {
	Token *token.Token `json:"token"`
}

func (*Identifier) String

func (i *Identifier) String() string

func (*Identifier) TokenLiteral

func (i *Identifier) TokenLiteral() string

type Int

type Int struct {
	Token *token.Token `json:"token"`
	Size  int          `json:"size"` // 8, 16, 32, 64
}

func (*Int) String

func (t *Int) String() string

func (*Int) TokenLiteral

func (t *Int) TokenLiteral() string

type Map

type Map struct {
	Token *token.Token `json:"token"`
	Key   Type         `json:"key"`
	Value Type         `json:"value"`
}

func (*Map) String

func (t *Map) String() string

func (*Map) TokenLiteral

func (t *Map) TokenLiteral() string

type Method

type Method struct {
	Type    MethodType  `json:"type"` // rpc, http
	Name    *Identifier `json:"name"`
	Args    Args        `json:"args"`
	Returns Returns     `json:"returns"`
	Options Options     `json:"options"`
}

type MethodType

type MethodType int
const (
	MethodRPC  MethodType // rpc
	MethodHTTP            // http
)

func (MethodType) MarshalText

func (m MethodType) MarshalText() ([]byte, error)

func (MethodType) String

func (m MethodType) String() string

func (*MethodType) UnmarshalText

func (m *MethodType) UnmarshalText(text []byte) error

type Methods

type Methods []*Method

func (Methods) String

func (m Methods) String() string

type Model

type Model struct {
	Token   *token.Token  `json:"token"`
	Name    *Identifier   `json:"name"`
	Extends []*Identifier `json:"extends"`
	Fields  Fields        `json:"fields"`
}

func (*Model) String

func (m *Model) String() string

func (*Model) TokenLiteral

func (m *Model) TokenLiteral() string

type Node

type Node interface {
	TokenLiteral() string
	String() string
}

type Option

type Option struct {
	Name  *Identifier `json:"name"`
	Value Value       `json:"value"`
}

func (*Option) MarshalText

func (o *Option) MarshalText() ([]byte, error)

func (*Option) String

func (o *Option) String() string

func (*Option) TokenLiteral

func (o *Option) TokenLiteral() string

func (*Option) UnmarshalText

func (o *Option) UnmarshalText(text []byte) error

type Options

type Options []*Option

func (Options) String

func (o Options) String(tabs int) string

type Program

type Program struct {
	Statements []Statement `json:"statements"`
}

func (*Program) MarshalText

func (p *Program) MarshalText() ([]byte, error)

func (*Program) String

func (p *Program) String() string

func (*Program) TokenLiteral

func (p *Program) TokenLiteral() string

func (*Program) UnmarshalText

func (p *Program) UnmarshalText(text []byte) error

type Return

type Return struct {
	Name   *Identifier `json:"name"`
	Type   Type        `json:"type"`
	Stream bool        `json:"stream"`
}

func (*Return) MarshalText

func (r *Return) MarshalText() ([]byte, error)

func (*Return) String

func (r *Return) String() string

func (*Return) TokenLiteral

func (r *Return) TokenLiteral() string

func (*Return) UnmarshalText

func (r *Return) UnmarshalText(text []byte) error

type Returns

type Returns []*Return

func (Returns) String

func (r Returns) String() string

type Service

type Service struct {
	Token   *token.Token `json:"token"`
	Name    *Identifier  `json:"name"`
	Methods Methods      `json:"methods"`
}

func (*Service) String

func (s *Service) String() string

func (*Service) TokenLiteral

func (s *Service) TokenLiteral() string

type Statement

type Statement interface {
	Node
	// contains filtered or unexported methods
}

type String

type String struct {
	Token *token.Token `json:"token"`
}

func (*String) String

func (t *String) String() string

func (*String) TokenLiteral

func (t *String) TokenLiteral() string

type Timestamp

type Timestamp struct {
	Token *token.Token `json:"token"`
}

func (*Timestamp) String

func (t *Timestamp) String() string

func (*Timestamp) TokenLiteral

func (t *Timestamp) TokenLiteral() string

type Type

type Type interface {
	Node
	// contains filtered or unexported methods
}

type Uint

type Uint struct {
	Token *token.Token `json:"token"`
	Size  int          `json:"size"` // 8, 16, 32, 64
}

func (*Uint) String

func (t *Uint) String() string

func (*Uint) TokenLiteral

func (t *Uint) TokenLiteral() string

type Value

type Value interface {
	Node
	// contains filtered or unexported methods
}

type ValueBool

type ValueBool struct {
	Token   *token.Token `json:"token"`
	Value   bool         `json:"value"`
	Defined bool         `json:"defined"` // means if user explicitly set it to the values

}

func (*ValueBool) String

func (v *ValueBool) String() string

func (*ValueBool) TokenLiteral

func (v *ValueBool) TokenLiteral() string

type ValueByteSize

type ValueByteSize struct {
	Token *token.Token `json:"token"`
	Value int64        `json:"value"`
	Scale ByteSize     `json:"scale"`
}

func (*ValueByteSize) String

func (v *ValueByteSize) String() string

func (*ValueByteSize) TokenLiteral

func (v *ValueByteSize) TokenLiteral() string

type ValueDuration

type ValueDuration struct {
	Token *token.Token  `json:"token"`
	Value int64         `json:"value"`
	Scale DurationScale `json:"scale"`
}

func (*ValueDuration) String

func (v *ValueDuration) String() string

func (*ValueDuration) TokenLiteral

func (v *ValueDuration) TokenLiteral() string

type ValueFloat

type ValueFloat struct {
	Token *token.Token `json:"token"`
	Value float64      `json:"value"`
	Size  int          `json:"size"` // 32, 64
}

func (*ValueFloat) String

func (v *ValueFloat) String() string

func (*ValueFloat) TokenLiteral

func (v *ValueFloat) TokenLiteral() string

type ValueInt

type ValueInt struct {
	Token   *token.Token `json:"token"`
	Value   int64        `json:"value"`
	Size    int          `json:"size"`    // 8, 16, 32, 64
	Defined bool         `json:"defined"` // means if user explicitly set it
}

func (*ValueInt) String

func (v *ValueInt) String() string

func (*ValueInt) TokenLiteral

func (v *ValueInt) TokenLiteral() string

type ValueNull

type ValueNull struct {
	Token *token.Token `json:"token"`
}

func (*ValueNull) String

func (v *ValueNull) String() string

func (*ValueNull) TokenLiteral

func (v *ValueNull) TokenLiteral() string

type ValueString

type ValueString struct {
	Token *token.Token `json:"token"`
	Value string       `json:"value"`
}

func (*ValueString) String

func (v *ValueString) String() string

func (*ValueString) TokenLiteral

func (v *ValueString) TokenLiteral() string

type ValueUint

type ValueUint struct {
	Token *token.Token `json:"token"`
	Value uint64       `json:"value"`
	Size  int          `json:"size"` // 8, 16, 32, 64
}

func (*ValueUint) String

func (v *ValueUint) String() string

func (*ValueUint) TokenLiteral

func (v *ValueUint) TokenLiteral() string

type ValueVariable

type ValueVariable struct {
	Token *token.Token `json:"token"`
}

func (*ValueVariable) String

func (v *ValueVariable) String() string

func (*ValueVariable) TokenLiteral

func (v *ValueVariable) TokenLiteral() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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