metainternal

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Code generated by tl2gen; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var ItemsByName = map[string]*TLItemImpl{}
View Source
var ItemsByTag = map[uint32]*TLItemImpl{}
View Source
var ItemsOrdered []TLItem

Functions

func FillFunction

func FillFunction(item *TLItemImpl)

func FillObject

func FillObject(item *TLItemImpl)

func SetGlobalFactoryCreateForEnumElement

func SetGlobalFactoryCreateForEnumElement(name string)

called by factory init code

func SetGlobalFactoryCreateForFunction

func SetGlobalFactoryCreateForFunction(name string, createFunction func() Function, createFunctionLong func() Function)

called by factory init code

func SetGlobalFactoryCreateForFunctionBytes

func SetGlobalFactoryCreateForFunctionBytes(name string, createFunctionBytes func() Function, createFunctionLongBytes func() Function)

called by factory init code

func SetGlobalFactoryCreateForObject

func SetGlobalFactoryCreateForObject(name string, createObject func() Object)

called by factory init code

func SetGlobalFactoryCreateForObjectBytes

func SetGlobalFactoryCreateForObjectBytes(name string, createObjectBytes func() Object)

Do not call directly, called by factory init code

Types

type Function

type Function interface {
	Object

	// jctx is for options controlling transcoding short-long version during Long ID and legacyTypeNames->newTypeNames transition
	// pass nil if you do not know which options you need
	ReadResultTL1WriteResultJSON(jctx *basictl.JSONWriteContext, r []byte, w []byte) ([]byte, []byte, error) // combination of ReadResult(r) + WriteResultJSON(w). Returns new r, new w, plus error
	ReadResultJSONWriteResultTL1(jctx *basictl.JSONReadContext, r []byte, w []byte) ([]byte, []byte, error)  // combination of ReadResultJSON(r) + WriteResult(w). Returns new r, new w, plus error

}

type Object

type Object interface {
	TLName() string // returns type's TL name. For union, returns constructor name depending on actual union value
	TLTag() uint32  // returns type's TL tag. For union, returns constructor tag depending on actual union value
	String() string // returns type's representation for debugging (JSON for now)

	ReadTL1(w []byte) ([]byte, error)              // reads type's bare TL representation by consuming bytes from the start of w and returns remaining bytes, plus error
	ReadTL1Boxed(w []byte) ([]byte, error)         // same as Read, but reads/checks TLTag first (this method is general version of Write, use it only when you are working with interface)
	WriteTL1General(w []byte) ([]byte, error)      // same as Write, but has common signature (with error) for all objects, so can be called through interface
	WriteTL1BoxedGeneral(w []byte) ([]byte, error) // same as WriteBoxed, but has common signature (with error) for all objects, so can be called through interface

	MarshalJSON() ([]byte, error) // returns type's JSON representation, plus error
	UnmarshalJSON([]byte) error   // reads type's JSON representation

	ReadJSONGeneral(jctx *basictl.JSONReadContext, in *basictl.JsonLexer) error
	// like MarshalJSON, but appends to w and returns it
	// pass empty basictl.JSONWriteContext{} if you do not know which options you need
	WriteJSONGeneral(jctx *basictl.JSONWriteContext, w []byte) ([]byte, error)
}

We can create only types which have zero type arguments and zero nat arguments

type TLItem

type TLItem interface {
	TLTag() uint32
	TLName() string
	// true if has TL1 code generated
	HasTL1() bool
	// true if has TL2 code generated
	HasTL2() bool
	CreateObject() Object
	// used in TL generator tests only, do not use in product code
	CreateObjectBytes() Object

	IsFunction() bool
	CreateFunction() Function
	// used in TL generator tests only, do not use in product code
	CreateFunctionBytes() Function
	HasUnionTypesInResult() bool
	HasUnionTypesInArguments() bool
	// For transcoding short-long version during Long ID transition
	HasFunctionLong() bool
	CreateFunctionLong() Function

	// Annotations
	AnnotationAny() bool
	AnnotationInternal() bool
	AnnotationKphp() bool
	AnnotationRead() bool
	AnnotationReadwrite() bool
	AnnotationWrite() bool
}

type TLItemImpl

type TLItemImpl struct {
	Tag         uint32
	Annotations uint32
	Name        string

	HaTL1 bool
	HaTL2 bool

	ResultTypeContainsUnionTypes    bool
	ArgumentsTypesContainUnionTypes bool

	// either CrObject != nil or CrFunction != nil for object/function respectively
	// also, CrFunctionLong can be != nil if there is long adapter (legacy to be removed soon)
	// also, CrObjectBytes, CrFunctionBytes, CrFunctionLongBytes
	// can be != nil independently, if factory_bytes is imported
	CrFunction          func() Function
	CrFunctionLong      func() Function
	CrObject            func() Object
	CrFunctionBytes     func() Function
	CrFunctionLongBytes func() Function
	CrObjectBytes       func() Object
}

func (TLItemImpl) AnnotationAny

func (item TLItemImpl) AnnotationAny() bool

Annotations

func (TLItemImpl) AnnotationInternal

func (item TLItemImpl) AnnotationInternal() bool

func (TLItemImpl) AnnotationKphp

func (item TLItemImpl) AnnotationKphp() bool

func (TLItemImpl) AnnotationRead

func (item TLItemImpl) AnnotationRead() bool

func (TLItemImpl) AnnotationReadwrite

func (item TLItemImpl) AnnotationReadwrite() bool

func (TLItemImpl) AnnotationWrite

func (item TLItemImpl) AnnotationWrite() bool

func (TLItemImpl) CreateFunction

func (item TLItemImpl) CreateFunction() Function

func (TLItemImpl) CreateFunctionBytes

func (item TLItemImpl) CreateFunctionBytes() Function

used in TL generator tests only, do not use in product code

func (TLItemImpl) CreateFunctionLong

func (item TLItemImpl) CreateFunctionLong() Function

func (TLItemImpl) CreateObject

func (item TLItemImpl) CreateObject() Object

func (TLItemImpl) CreateObjectBytes

func (item TLItemImpl) CreateObjectBytes() Object

used in TL generator tests only, do not use in product code

func (TLItemImpl) HasFunctionLong

func (item TLItemImpl) HasFunctionLong() bool

For transcoding short-long version during Long ID transition

func (TLItemImpl) HasTL1

func (item TLItemImpl) HasTL1() bool

true for TL1-originated types

func (TLItemImpl) HasTL2

func (item TLItemImpl) HasTL2() bool

true for TL2-originated types and for TL1-originated types if in TL2 generation whitelist

func (TLItemImpl) HasUnionTypesInArguments

func (item TLItemImpl) HasUnionTypesInArguments() bool

func (TLItemImpl) HasUnionTypesInResult

func (item TLItemImpl) HasUnionTypesInResult() bool

func (TLItemImpl) IsFunction

func (item TLItemImpl) IsFunction() bool

func (*TLItemImpl) MarshalJSON

func (item *TLItemImpl) MarshalJSON() ([]byte, error)

func (*TLItemImpl) ReadJSONGeneral

func (item *TLItemImpl) ReadJSONGeneral(jctx *basictl.JSONReadContext, in *basictl.JsonLexer) error

func (*TLItemImpl) ReadTL1

func (item *TLItemImpl) ReadTL1(w []byte) ([]byte, error)

func (*TLItemImpl) ReadTL1Boxed

func (item *TLItemImpl) ReadTL1Boxed(w []byte) ([]byte, error)

func (*TLItemImpl) ReadTL2

func (item *TLItemImpl) ReadTL2(r []byte, tctx *basictl.TL2ReadContext) ([]byte, error)

func (*TLItemImpl) Reset

func (item *TLItemImpl) Reset()

TLItemImpl serves as a single type for all TL1 enum values

func (TLItemImpl) String

func (item TLItemImpl) String() string

func (TLItemImpl) TLName

func (item TLItemImpl) TLName() string

func (TLItemImpl) TLTag

func (item TLItemImpl) TLTag() uint32

func (*TLItemImpl) UnmarshalJSON

func (item *TLItemImpl) UnmarshalJSON(b []byte) error

func (*TLItemImpl) WriteJSON

func (item *TLItemImpl) WriteJSON(w []byte) []byte

func (*TLItemImpl) WriteJSONGeneral

func (item *TLItemImpl) WriteJSONGeneral(jctx *basictl.JSONWriteContext, w []byte) (_ []byte, err error)

func (*TLItemImpl) WriteTL1BoxedGeneral

func (item *TLItemImpl) WriteTL1BoxedGeneral(w []byte) ([]byte, error)

func (*TLItemImpl) WriteTL1General

func (item *TLItemImpl) WriteTL1General(w []byte) ([]byte, error)

func (*TLItemImpl) WriteTL2

func (item *TLItemImpl) WriteTL2(w []byte, tctx *basictl.TL2WriteContext) []byte

Jump to

Keyboard shortcuts

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