protocol

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 30 Imported by: 6

Documentation

Index

Constants

View Source
const (
	TS_CLASSOBJ_HEADER = iota
	TS_CLASSOBJ_DEFINER
	TS_CLASSOBJ_MEMBER_FIELD
	TS_CLASSOBJ_CONSTRUCTOR
	TS_CLASSOBJ_GETTER_SETTER
	TS_CLASSOBJ_FUNCTION_FIELD
	TS_CLASSOBJ_FUNCTION
	TS_CLASSOBJ_CLASS_END
)
View Source
const (
	// len 2 transId 4
	HEADER_SIZE        = 2 + 4
	MAX_PACKET_SIZE    = 20 * 1024
	DEFAULT_PACKET_LEN = 2048 * 4
	ROUTE_MSG_ADDITION = 2 + 8 + 8
)

Variables

View Source
var (
	//inner error
	ERR_TYPE_NOT_FOUND  = CreateError(-1, "type not found")
	ERR_RPC_TIMEOUT     = CreateError(-2, "rpc timeout")
	ERR_PACKAGE_FORMAT  = CreateError(-3, "wrong packet format")
	ERR_INTERNAL_ERROR  = CreateError(-4, "internal error")
	ERR_ACTOR_NOT_FOUND = CreateError(-101, "actor not found")

	//cs error
	ERR_INTERNAL_SERVER        = CreateError(901, "服务器繁忙")
	ERR_TOKEN_EXPIRED          = CreateError(1001, "Token已过期")
	ERR_TOKEN_VALIDATE         = CreateError(1002, "Token无效")
	ERR_ACC_NOT_FIND           = CreateError(1003, "找不到账户")
	ERR_GAME_ACC_NOT_FOUND     = CreateError(1004, "找不到游戏账户")
	ERR_GAME_ACC_EXIST         = CreateError(1011, "游戏账户已存在")
	ERR_GAME_ACC_CREATE_FAILED = CreateError(1012, "创建游戏账户失败")
	ERR_PARAM_NOT_EXIST        = CreateError(1101, "参数不存在")
	ERR_PARAM_TYPE             = CreateError(1102, "参数错误")
	ERR_ACC_AUTH               = CreateError(1103, "账户不存在或者密码错误")
	ERR_PASSWORD_EMPTY         = CreateError(1104, "需要输入密码")
	ERR_AUTH_FAILED            = CreateError(1201, "验证失败")
	ERR_MSG_FORMAT             = CreateError(1202, "数据格式错误")
	ERR_PROTOCOL_NOT_FOUND     = CreateError(1203, "协议未找到")
)
View Source
var COMMENT_REGEXP = regexp.MustCompile(`(.*)((//).*)`)
View Source
var ICOMPONENT_REGEXP = regexp.MustCompile(`Component`)
View Source
var ISERIALIZABLE_REGEXP = regexp.MustCompile(`Serializable`)

Functions

func CreateBinaryLongPacket

func CreateBinaryLongPacket(data []byte, idx int) ([]byte, error)

func CreateJsonLongPacket

func CreateJsonLongPacket(data []byte, idx int) ([]byte, error)

func CreateLongPacket

func CreateLongPacket(protocol TYPE) func(data []byte, idx int) ([]byte, error)

func GetLineRegExps

func GetLineRegExps() map[string]*regexp.Regexp

func IsProtobuf

func IsProtobuf() bool

func MarshalBinary

func MarshalBinary(s interface{}) ([]byte, error)

func MarshalBinaryMessage

func MarshalBinaryMessage(transId uint32, data interface{}) (ret []byte, err error)

func MarshalJsonMessage

func MarshalJsonMessage(transId uint32, data interface{}) (ret []byte, err error)

func MarshalMessage

func MarshalMessage(transId uint32, data interface{}, t TYPE) (ret []byte, err error)

func MatchGoProtoTag

func MatchGoProtoTag(s string) bool

func PickBinaryLongPacket

func PickBinaryLongPacket(data []byte) (bool, int, []byte)

func PickJsonLongPacket

func PickJsonLongPacket(data []byte) (bool, int, []byte)

func PickLongPacket

func PickLongPacket(protocol TYPE) func(data []byte) (bool, int, []byte)

func SetProtobuf

func SetProtobuf()

func SetTypeRegistry

func SetTypeRegistry(registry *TypeRegistry)

func Split

func Split(data []byte, atEOF bool) (advance int, token []byte, err error)

func Unmarshal

func Unmarshal(data []byte, v interface{}) (err error)

func UnmarshalFromBytes

func UnmarshalFromBytes(data []byte, v interface{}) error

Types

type BINARY_LENGTH

type BINARY_LENGTH uint32

type BINARY_NAME_SIZE

type BINARY_NAME_SIZE int16

type BINARY_TAG

type BINARY_TAG uint16
const (
	//基础类型 0-40
	TAG_End BINARY_TAG = iota
	TAG_Bool
	TAG_Byte
	TAG_Short
	TAG_UShort
	TAG_Int
	TAG_UInt
	TAG_Long
	TAG_ULong
	TAG_Float
	TAG_Double
	TAG_String
	TAG_BoolArray
	TAG_ByteArray
	TAG_ShortArray
	TAG_UShortArray
	TAG_IntArray
	TAG_UIntArray
	TAG_LongArray
	TAG_ULongArray
	TAG_FloatArray
	TAG_DoubleArray
	TAG_List
	TAG_Map
	TAG_Buffer
	TAG_Time
	TAG_Decimal
	TAG_Proto
	TAG_Null
	TAG_LongString
	//Ecs
	TAG_EntityRef BINARY_TAG = 32
	//系统预留类型 40-127
	TAG_BinaryMessage BINARY_TAG = 40 //保留基本传输类型
	TAG_Error         BINARY_TAG = 41
	TAG_Compose       BINARY_TAG = 42
	TAG_Ping          BINARY_TAG = 43
	TAG_Pong          BINARY_TAG = 44
	TAG_HandShake     BINARY_TAG = 45
	TAG_RouteMessage  BINARY_TAG = 46
)

func GetCmdId

func GetCmdId(data []byte) BINARY_TAG

func GetCmdId16

func GetCmdId16(data []byte) BINARY_TAG

func GetCmdIdFromType

func GetCmdIdFromType(data interface{}) (BINARY_TAG, error)

func GetModelProtoTag

func GetModelProtoTag(s string) BINARY_TAG

func MatchGoSystemTag

func MatchGoSystemTag(s string) (BINARY_TAG, string, string)

func MatchModelProtoTag

func MatchModelProtoTag(s string) BINARY_TAG

func MatchModelSystemTag

func MatchModelSystemTag(s string) (BINARY_TAG, string, string)

func (BINARY_TAG) CsTypeString

func (tag BINARY_TAG) CsTypeString() string

func (BINARY_TAG) GoTypeString

func (tag BINARY_TAG) GoTypeString() string

func (BINARY_TAG) IsArrayLike

func (tag BINARY_TAG) IsArrayLike() bool

func (BINARY_TAG) IsBaseValue

func (tag BINARY_TAG) IsBaseValue() bool

func (BINARY_TAG) IsProto

func (tag BINARY_TAG) IsProto() bool

func (BINARY_TAG) MatchRegExp

func (this BINARY_TAG) MatchRegExp(str string) bool

func (BINARY_TAG) String

func (tag BINARY_TAG) String() string

func (BINARY_TAG) TsTagString

func (tag BINARY_TAG) TsTagString() string

func (BINARY_TAG) TsTypeString

func (tag BINARY_TAG) TsTypeString() string

type BinaryMessage

type BinaryMessage struct {
	ISerializable
	TransId uint32
	Len     uint16
	CmdId   BINARY_TAG
	Body    ISerializable
}

BinaryMessage base protocol

func UnmarshalBinaryMessage

func UnmarshalBinaryMessage(data []byte) (*BinaryMessage, error)

func UnmarshalJsonMessage

func UnmarshalJsonMessage(data []byte) (*BinaryMessage, error)

func UnmarshalMessage

func UnmarshalMessage(data []byte, t TYPE) (*BinaryMessage, error)

func (*BinaryMessage) GetId

func (this *BinaryMessage) GetId() (BINARY_TAG, error)

func (*BinaryMessage) Marshal

func (this *BinaryMessage) Marshal() ([]byte, error)

func (*BinaryMessage) Unmarshal

func (this *BinaryMessage) Unmarshal(from []byte) error

type CommentObject

type CommentObject struct {
	DefaultGeneratorObj
	// contains filtered or unexported fields
}

func NewCommentObject

func NewCommentObject(file GeneratorFile) *CommentObject

func (*CommentObject) CheckLine

func (this *CommentObject) CheckLine(line *LineText) bool

type ComposeData

type ComposeData struct {
	Idx  uint32
	Data []byte
}

func (*ComposeData) GetId

func (this *ComposeData) GetId() (BINARY_TAG, error)

func (*ComposeData) Marshal

func (this *ComposeData) Marshal() ([]byte, error)

func (*ComposeData) Serializable

func (this *ComposeData) Serializable() ISerializable

func (*ComposeData) Unmarshal

func (this *ComposeData) Unmarshal(from []byte) error

type Compression

type Compression byte
const (
	Uncompressed Compression = 0
	GZip         Compression = 1
	ZLib         Compression = 2
)

type ConfFile

type ConfFile struct {
	*DefaultGeneratorFile
	TagName     string
	PackageName string
	Offset      int
	Recursive   bool
}

func NewConfFile

func NewConfFile(generator *Generator) *ConfFile

func (*ConfFile) Parse

func (this *ConfFile) Parse() *promise.Promise

type ConfObject

type ConfObject struct {
	DefaultGeneratorObj
}

func NewConfObject

func NewConfObject(file GeneratorFile) *ConfObject

func (*ConfObject) CheckLine

func (this *ConfObject) CheckLine(line *LineText) bool

type ContainerType

type ContainerType int
const (
	CTYPE_NONE ContainerType = iota
	CTYPE_PROTO
	CTYPE_ARRAY
	CTYPE_MAP
)

type DefaultGeneratorFile

type DefaultGeneratorFile struct {
	GeneratorFile

	FileType   FileType
	FilePath   string
	IsDir      bool
	Generator  *Generator
	DirPath    string
	FileName   string
	LineLength int
	Lines      []*LineText
	Objects    []GeneratorObject
	// contains filtered or unexported fields
}

func NewGeneratorFile

func NewGeneratorFile(generator *Generator) *DefaultGeneratorFile

func (*DefaultGeneratorFile) AddObject

func (this *DefaultGeneratorFile) AddObject(obj GeneratorObject)

func (*DefaultGeneratorFile) CheckFinish

func (this *DefaultGeneratorFile) CheckFinish(offset int) bool

func (*DefaultGeneratorFile) Generate

func (this *DefaultGeneratorFile) Generate(typ FileType) *promise.Promise

func (*DefaultGeneratorFile) GetFile

func (this *DefaultGeneratorFile) GetFile() GeneratorFile

func (*DefaultGeneratorFile) GetFilePath

func (this *DefaultGeneratorFile) GetFilePath() string

func (*DefaultGeneratorFile) GetGoRelativePath

func (this *DefaultGeneratorFile) GetGoRelativePath() string

func (*DefaultGeneratorFile) GetLines

func (this *DefaultGeneratorFile) GetLines() []*LineText

func (*DefaultGeneratorFile) GetObj

func (this *DefaultGeneratorFile) GetObj(objType ObjectType) []GeneratorObject

func (*DefaultGeneratorFile) GetTsRelativePath

func (this *DefaultGeneratorFile) GetTsRelativePath() string

func (*DefaultGeneratorFile) InsertAfter

func (this *DefaultGeneratorFile) InsertAfter(obj GeneratorObject, after GeneratorObject)

func (*DefaultGeneratorFile) InsertObject

func (this *DefaultGeneratorFile) InsertObject(pos int, obj GeneratorObject)

func (*DefaultGeneratorFile) Load

func (this *DefaultGeneratorFile) Load(path string) *promise.Promise

func (*DefaultGeneratorFile) MarshalToFile

func (this *DefaultGeneratorFile) MarshalToFile(path string) *promise.Promise

func (*DefaultGeneratorFile) Parse

func (this *DefaultGeneratorFile) Parse() *promise.Promise

func (*DefaultGeneratorFile) RemoveAutoGenHeader

func (this *DefaultGeneratorFile) RemoveAutoGenHeader()

func (*DefaultGeneratorFile) RemoveObjByCondition

func (this *DefaultGeneratorFile) RemoveObjByCondition(condition GenerateObjRemoveCondition)

func (*DefaultGeneratorFile) RemoveObjType

func (this *DefaultGeneratorFile) RemoveObjType(objType ObjectType)

func (*DefaultGeneratorFile) SetGenerator

func (this *DefaultGeneratorFile) SetGenerator(generator *Generator)

type DefaultGeneratorObj

type DefaultGeneratorObj struct {
	// contains filtered or unexported fields
}

func (*DefaultGeneratorObj) AddLine

func (this *DefaultGeneratorObj) AddLine(line *LineText, lineType LineType) *LineText

func (*DefaultGeneratorObj) CheckLine

func (this *DefaultGeneratorObj) CheckLine(line *LineText) bool

func (*DefaultGeneratorObj) File

func (this *DefaultGeneratorObj) File() GeneratorFile

func (*DefaultGeneratorObj) GenerateToObject

func (this *DefaultGeneratorObj) GenerateToObject(typ ObjectType) GeneratorObject

func (*DefaultGeneratorObj) GetFile

func (this *DefaultGeneratorObj) GetFile() GeneratorFile

func (*DefaultGeneratorObj) GetLines

func (this *DefaultGeneratorObj) GetLines(lineType LineType) []*LineText

func (*DefaultGeneratorObj) InsertAfter

func (this *DefaultGeneratorObj) InsertAfter(line *LineText, after *LineText) *LineText

func (*DefaultGeneratorObj) InsertLine

func (this *DefaultGeneratorObj) InsertLine(pos int, line *LineText) *LineText

func (*DefaultGeneratorObj) Lines

func (this *DefaultGeneratorObj) Lines() []*LineText

func (*DefaultGeneratorObj) Name

func (this *DefaultGeneratorObj) Name() string

func (*DefaultGeneratorObj) ObjectType

func (this *DefaultGeneratorObj) ObjectType() ObjectType

func (*DefaultGeneratorObj) RemoveLineType

func (this *DefaultGeneratorObj) RemoveLineType(lineType LineType) []*LineText

func (*DefaultGeneratorObj) String

func (this *DefaultGeneratorObj) String() string

func (*DefaultGeneratorObj) TryAddLine

func (this *DefaultGeneratorObj) TryAddLine(line *LineText, lineType LineType) bool

func (*DefaultGeneratorObj) TryAddLineStrict

func (this *DefaultGeneratorObj) TryAddLineStrict(line *LineText, lineType LineType) bool

type EmptyObject

type EmptyObject struct {
	DefaultGeneratorObj
}

func NewEmptyObject

func NewEmptyObject(file GeneratorFile) *EmptyObject

func (*EmptyObject) CheckLine

func (this *EmptyObject) CheckLine(line *LineText) bool

type Enum

type Enum int32

func (Enum) Enum added in v0.1.13

func (this Enum) Enum() Enum

type ErrCode

type ErrCode int

func CreateError

func CreateError(code ErrCode, msg string) ErrCode

func (ErrCode) ErrCode

func (this ErrCode) ErrCode() int

func (ErrCode) Error

func (this ErrCode) Error() string

func (ErrCode) Is

func (this ErrCode) Is(err error) bool

func (ErrCode) NewErrMsg

func (this ErrCode) NewErrMsg() *ErrMsg

type ErrMsg

type ErrMsg struct {
	Code    int32
	Message string
}

func NewError

func NewError(code ErrCode) *ErrMsg

func NewErrorMsg

func NewErrorMsg(code int32, message string) *ErrMsg

func (*ErrMsg) ErrCode

func (this *ErrMsg) ErrCode() int

func (*ErrMsg) Error

func (this *ErrMsg) Error() string

func (*ErrMsg) GetId

func (this *ErrMsg) GetId() (BINARY_TAG, error)

func (*ErrMsg) Is added in v0.0.6

func (this *ErrMsg) Is(err error) bool

func (*ErrMsg) Marshal

func (this *ErrMsg) Marshal() ([]byte, error)

func (*ErrMsg) Serializable

func (this *ErrMsg) Serializable() ISerializable

func (*ErrMsg) Unmarshal

func (this *ErrMsg) Unmarshal(from []byte) error

type Fields

type Fields map[string]string

type FileType

type FileType int
const (
	FILE_UNDEFINED FileType = iota
	FILE_CONFIG
	FILE_GO_MODEL
	FILE_GO_IDS
	FILE_TS_MODEL
	FILE_TS_ENUM
	FILE_TS_IDS
	FILE_PROTO
	FILE_PROTO_IDS
	FILE_MODEL
)

func (FileType) String

func (this FileType) String() string

type GenType

type GenType int
const (
	GEN_UNDEFINED GenType = iota
	GEN_GO
	GEN_TS
	GEN_JSON
	GEN_CS
)

type GenerateObjRemoveCondition

type GenerateObjRemoveCondition func(object GeneratorObject) bool

type Generator

type Generator struct {
	GenType           GenType
	Models            map[string]GeneratorFile
	GoModels          map[string]GeneratorFile
	Protos            map[string]GeneratorFile
	GoIds             *GoIdsFile
	ProtoIds          *ProtoIdsFile
	Conf              *ConfFile
	GoStructObjects   []*GoStructObject
	GoEnumObjects     []*GoEnumObject
	ProtoMsgObjects   []*ProtoMsgObject
	ModelClassObjects []*ModelClassObject
	ModelEnumObjects  []*ModelEnumObject
	ModelIdsObjects   map[uint16]*ModelId
	ModelErrorObjects map[int]*ModelError
	ModelPackages     map[string]*ModelPackageObject

	TsModels       []*TsModelFile
	TsIds          *TsIdsFile
	TsEnums        *TsEnumFile
	TsClassObjects []*TsClassObject
	TsEnumObjects  []*TsEnumObject

	Schemas []*ModelSchema

	Individual   bool
	TsDependPath string
	GoPath       string
	TsPath       string
	ProtoPath    string
	ModelPath    string
	CsPath       string

	Proto2GoCmdLinExec func(pack, protoPath, GoPath string) error
	Proto2TsCmdLinExec func(pack, protoPath, GoPath string) error
}

func NewGenerator

func NewGenerator(typ GenType) *Generator

func (*Generator) Clear

func (this *Generator) Clear()

func (*Generator) GenerateGo2Ts

func (this *Generator) GenerateGo2Ts()

func (*Generator) GenerateGo2TsIds

func (this *Generator) GenerateGo2TsIds()

func (*Generator) GenerateGoIds

func (this *Generator) GenerateGoIds(fromProto bool)

func (*Generator) GenerateModel2Cs

func (this *Generator) GenerateModel2Cs() error

func (*Generator) GenerateModel2Go

func (this *Generator) GenerateModel2Go() error

func (*Generator) GenerateModel2Ts

func (this *Generator) GenerateModel2Ts()

func (*Generator) GenerateProto2Go

func (this *Generator) GenerateProto2Go() error

func (*Generator) GenerateProto2GoIds

func (this *Generator) GenerateProto2GoIds()

func (*Generator) GenerateProto2Ids

func (this *Generator) GenerateProto2Ids()

func (*Generator) GenerateProto2Ts

func (this *Generator) GenerateProto2Ts() error

func (*Generator) GenerateProto2TsIds

func (this *Generator) GenerateProto2TsIds()

func (*Generator) GenerateProto2TsJsImport

func (this *Generator) GenerateProto2TsJsImport()

func (*Generator) GenerateTsEnum

func (this *Generator) GenerateTsEnum()

func (*Generator) GenerateTsModels

func (this *Generator) GenerateTsModels()

func (*Generator) GetErrorName added in v0.0.6

func (this *Generator) GetErrorName(id int) string

func (*Generator) InitDefaultSchemas

func (this *Generator) InitDefaultSchemas()

func (*Generator) IsEnum added in v0.0.6

func (this *Generator) IsEnum(s string) bool

func (*Generator) IsErrorName added in v0.0.6

func (this *Generator) IsErrorName(s string) bool

func (*Generator) LoadAndParseTsFile

func (this *Generator) LoadAndParseTsFile(modelsPath string) (*TsModelFile, error)

func (*Generator) LoadConf

func (this *Generator) LoadConf(p string) error

func (*Generator) LoadCsFolder

func (this *Generator) LoadCsFolder(p string) *promise.Promise

func (*Generator) LoadGo2TsFolder

func (this *Generator) LoadGo2TsFolder(p string, individual bool) *promise.Promise

func (*Generator) LoadGo2TsIds

func (this *Generator) LoadGo2TsIds(p string) error

func (*Generator) LoadGo2TsModels

func (this *Generator) LoadGo2TsModels(p string) error

func (*Generator) LoadGoFolder

func (this *Generator) LoadGoFolder(p string) *promise.Promise

func (*Generator) LoadGoIds

func (this *Generator) LoadGoIds(p string) error

func (*Generator) LoadGoModels

func (this *Generator) LoadGoModels(p string) error

func (*Generator) LoadModelFolder

func (this *Generator) LoadModelFolder(p string) *promise.Promise

func (*Generator) LoadModels

func (this *Generator) LoadModels(p string) error

func (*Generator) LoadProtoFolder

func (this *Generator) LoadProtoFolder(p string) *promise.Promise

func (*Generator) LoadProtoIds

func (this *Generator) LoadProtoIds(p string) error

func (*Generator) LoadProtos

func (this *Generator) LoadProtos(p string) error

func (*Generator) LoadTsEnums

func (this *Generator) LoadTsEnums(p string) error

func (*Generator) MatchGoEnum

func (this *Generator) MatchGoEnum(s string) bool

func (*Generator) MatchGoExistTag

func (this *Generator) MatchGoExistTag(s string) (tag BINARY_TAG, isEnum bool, tagstr1 string, tagstr2 string)

func (*Generator) MatchGoStruct

func (this *Generator) MatchGoStruct(s string) BINARY_TAG

func (*Generator) PostProcessAllGoSchemas

func (this *Generator) PostProcessAllGoSchemas()

func (*Generator) ProcessGoModel2Schema

func (this *Generator) ProcessGoModel2Schema(model *GoStructObject)

func (*Generator) SetOption

func (this *Generator) SetOption(opt GeneratorOption)

func (*Generator) SetProto2GoCmdLine

func (this *Generator) SetProto2GoCmdLine(f func(pack, protoPath, GoPath string) error)

func (*Generator) SetProto2TsCmdLine

func (this *Generator) SetProto2TsCmdLine(f func(pack, protoPath, TsPath string) error)

type GeneratorFile

type GeneratorFile interface {
	Parse() *promise.Promise
	Load(string) *promise.Promise
	GetFilePath() string
	GetTsRelativePath() string
	GetGoRelativePath() string
	SetGenerator(generator *Generator)
	GetLines() []*LineText
	GetFile() GeneratorFile
	AddObject(obj GeneratorObject)
	InsertObject(pos int, obj GeneratorObject)
}

type GeneratorObject

type GeneratorObject interface {
	Name() string
	File() GeneratorFile
	ObjectType() ObjectType
	GenerateToObject(typ ObjectType) GeneratorObject
	Lines() []*LineText
	GetLines(lineType LineType) []*LineText
	CheckLine(line *LineText) bool
	AddLine(line *LineText, lineType LineType) *LineText
	TryAddLine(line *LineText, lineType LineType) bool
	RemoveLineType(lineType LineType) []*LineText
	InsertLine(pos int, line *LineText) *LineText
	InsertAfter(line *LineText, after *LineText) *LineText
	String() string
}

type GeneratorOption

type GeneratorOption struct {
	SourcePath string
	DestPath   string
}

type GoAssignedId

type GoAssignedId struct {
	Tag     string
	Struct  string
	Package string
	Value   int
	Line    int
}

type GoDefineObject

type GoDefineObject struct {
	DefaultGeneratorObj
}

func NewGoDefineObject

func NewGoDefineObject(file GeneratorFile) *GoDefineObject

func (*GoDefineObject) CheckLine

func (this *GoDefineObject) CheckLine(line *LineText) bool

type GoEnumObject

type GoEnumObject struct {
	DefaultGeneratorObj
	// contains filtered or unexported fields
}

func NewGoEnumObject

func NewGoEnumObject(file GeneratorFile) *GoEnumObject

func (*GoEnumObject) CheckLine

func (this *GoEnumObject) CheckLine(line *LineText) bool

func (*GoEnumObject) Type

func (this *GoEnumObject) Type() string

type GoFuncObject

type GoFuncObject struct {
	DefaultGeneratorObj
}

func NewGoFuncObject

func NewGoFuncObject(file GeneratorFile) *GoFuncObject

func (*GoFuncObject) CheckLine

func (this *GoFuncObject) CheckLine(line *LineText) bool

type GoIdObject

type GoIdObject struct {
	DefaultGeneratorObj
}

func NewGoIdObject

func NewGoIdObject(file GeneratorFile) *GoIdObject

func (*GoIdObject) CheckLine

func (this *GoIdObject) CheckLine(line *LineText) bool

type GoIdRegObject

type GoIdRegObject struct {
	DefaultGeneratorObj
}

func NewGoIdRegObject

func NewGoIdRegObject(file GeneratorFile) *GoIdRegObject

func (*GoIdRegObject) CheckLine

func (this *GoIdRegObject) CheckLine(line *LineText) bool

type GoIdsFile

type GoIdsFile struct {
	*DefaultGeneratorFile
	TagName       string
	Offset        int
	AssignedIds   []*GoAssignedId
	AssignedTypes []*GoAssignedId
	MinId         int
	MaxId         int
}

func NewGoIdsFile

func NewGoIdsFile(generator *Generator) *GoIdsFile

func (*GoIdsFile) Generate

func (this *GoIdsFile) Generate() *promise.Promise

func (*GoIdsFile) Parse

func (this *GoIdsFile) Parse() *promise.Promise

func (*GoIdsFile) ProcessIds

func (this *GoIdsFile) ProcessIds()

type GoImportObject

type GoImportObject struct {
	DefaultGeneratorObj
}

func NewGoImportObject

func NewGoImportObject(file GeneratorFile) *GoImportObject

func (*GoImportObject) CheckLine

func (this *GoImportObject) CheckLine(line *LineText) bool

type GoInterfaceObject

type GoInterfaceObject struct {
	DefaultGeneratorObj
	// contains filtered or unexported fields
}

func NewGoInterfaceObject

func NewGoInterfaceObject(file GeneratorFile) *GoInterfaceObject

func (*GoInterfaceObject) CheckLine

func (this *GoInterfaceObject) CheckLine(line *LineText) bool

type GoModelFile

type GoModelFile struct {
	*DefaultGeneratorFile
}

func NewGoModelFile

func NewGoModelFile(generator *Generator) *GoModelFile

func (*GoModelFile) Generate

func (this *GoModelFile) Generate() *promise.Promise

func (*GoModelFile) Parse

func (this *GoModelFile) Parse() *promise.Promise

func (*GoModelFile) ProcessEnum

func (this *GoModelFile) ProcessEnum() []*GoEnumObject

func (*GoModelFile) ProcessStruct

func (this *GoModelFile) ProcessStruct() []*GoStructObject

type GoPackageObject

type GoPackageObject struct {
	DefaultGeneratorObj
	// contains filtered or unexported fields
}

func NewGoPackageObject

func NewGoPackageObject(file GeneratorFile) *GoPackageObject

func (*GoPackageObject) CheckLine

func (this *GoPackageObject) CheckLine(line *LineText) bool

type GoStructFields

type GoStructFields struct {
	Name    string
	Type    string
	Package string
	Index   int
}

type GoStructFuncObject

type GoStructFuncObject struct {
	DefaultGeneratorObj
}

func NewGoStructFuncObject

func NewGoStructFuncObject(file GeneratorFile) *GoStructFuncObject

func (*GoStructFuncObject) CheckLine

func (this *GoStructFuncObject) CheckLine(line *LineText) bool

type GoStructObject

type GoStructObject struct {
	DefaultGeneratorObj
	TagId BINARY_TAG

	Fields        []*GoStructFields
	Package       string
	StructName    string
	ISerializable bool
	IComponent    bool
	// contains filtered or unexported fields
}

func NewGoStructObject

func NewGoStructObject(file GeneratorFile) *GoStructObject

func (*GoStructObject) CheckLine

func (this *GoStructObject) CheckLine(line *LineText) bool

func (*GoStructObject) IsModel

func (this *GoStructObject) IsModel() bool

func (*GoStructObject) SetPackage

func (this *GoStructObject) SetPackage(pack string)

type GoVarObject

type GoVarObject struct {
	DefaultGeneratorObj
}

func NewGoVarObject

func NewGoVarObject(file GeneratorFile) *GoVarObject

func (*GoVarObject) CheckLine

func (this *GoVarObject) CheckLine(line *LineText) bool

type HandShake

type HandShake struct {
	Data []byte
}

func (*HandShake) GetId

func (this *HandShake) GetId() (BINARY_TAG, error)

func (*HandShake) Marshal

func (this *HandShake) Marshal() ([]byte, error)

func (*HandShake) Serializable

func (this *HandShake) Serializable() ISerializable

func (*HandShake) Unmarshal

func (this *HandShake) Unmarshal(from []byte) error

type IEnum added in v0.1.13

type IEnum interface {
	ToString() string
	Enum() Enum
}

type IEnumCollection added in v0.1.24

type IEnumCollection []IEnum

func (IEnumCollection) GetEnumByString added in v0.1.24

func (this IEnumCollection) GetEnumByString(s string) IEnum

func (IEnumCollection) GetEnumByValue added in v0.1.24

func (this IEnumCollection) GetEnumByValue(s Enum) IEnum

type IError

type IError interface {
	Error() string
	ErrCode() int
	Is(e error) bool
}

type ISerializable

type ISerializable interface {
	GetId() (BINARY_TAG, error)
	Serializable() ISerializable
}

type LineText

type LineText struct {
	Obj         GeneratorObject
	LineNum     int
	Text        string
	LineType    LineType
	PackageName string
	StructName  string
	Name        string
	TagName     string
	Value       int
	Type        string
	Comment     string
}

func (*LineText) GetName

func (this *LineText) GetName() string

func (*LineText) GetPkgName

func (this *LineText) GetPkgName() string

func (*LineText) GetStructName

func (this *LineText) GetStructName() string

func (*LineText) GetTagName

func (this *LineText) GetTagName() string

func (*LineText) GetTypeName

func (this *LineText) GetTypeName() string

func (*LineText) GetValue

func (this *LineText) GetValue() int

func (*LineText) IsLongStringTag

func (this *LineText) IsLongStringTag() bool

func (*LineText) ObjName

func (this *LineText) ObjName() string

func (*LineText) Parse

func (this *LineText) Parse() string

type LineType

type LineType int
const (
	LINE_UNDEFINED LineType = iota
	LINE_COMMENT
	LINE_COMMENT_START
	LINE_COMMENT_END
	LINE_ANY
	LINE_EMPTY
	LINE_GO_PACKAGE
	LINE_GO_IMPORT_HEADER
	LINE_GO_IMPORT_BODY
	LINE_GO_IMPORT_SINGLELINE
	LINE_GO_INTERFACE_HEADER
	LINE_GO_PUBLIC_STRUCT_HEADER
	LINE_GO_PRIVATE_STRUCT_HEADER
	LINE_GO_STRUCT_FIELD_INHERIT
	LINE_GO_STRUCT_FIELD_PUBLIC
	LINE_GO_STRUCT_FIELD_PRIVATE
	LINE_GO_FUNC_HEADER
	LINE_GO_INIT_FUNC_HEADER
	LINE_GO_STRUCT_FUNC_HEADER
	LINE_GO_DEFINER
	LINE_GO_ENUM_DEFINER
	LINE_GO_CONST
	LINE_GO_VARIABLE
	LINE_GO_TAG_DEFINER
	LINE_GO_TAG_REGISTRY
	LINE_GO_CONST_CLOSURE_START
	LINE_GO_VAR_CLOSURE_START
	LINE_GO_ENUM_VARIABLE_IOTA
	LINE_GO_ENUM_VARIABLE
	LINE_GO_ENUM_AUTO

	LINE_CONF_TAG
	LINE_CONF_PACKAGE
	LINE_CONF_OFFSET
	LINE_CONF_RECUR
	LINE_BRACKET_END
	LINE_CLOSURE_END

	LINE_TS_IMPORT_SINGLELINE
	LINE_TS_IMPORT_CLOSURE_START
	LINE_TS_IMPORT_CLOSURE_END
	LINE_TS_IMPORT_OBJ
	LINE_TS_ENUM_CLOSURE_START
	LINE_TS_ENUM_OBJ
	LINE_TS_CLASS_DECORATOR
	LINE_TS_CLASS_HEADER
	LINE_TS_CLASS_CONSTRUCTOR_HEADER
	LINE_TS_CLASS_FIELD_PUBLIC
	LINE_TS_CLASS_FIELD_PRIVATE
	LINE_TS_CLASS_GETTER_HEADER
	LINE_TS_CLASS_SETTER_HEADER
	LINE_TS_CLASS_FUNC_HEADER
	LINE_TS_CLASS_FUNC_END

	LINE_TS_FUNC_HEADER

	LINE_TS_VAR_SINGLELINE
	LINE_TS_VAR_CLOSURE_START
	LINE_TS_VAR_ARRAY_START
	LINE_TS_ARRAY_END

	LINE_TS_DEFINE_SINGLELINE
	LINE_TS_DEFINE_START
	LINE_TS_DEFINE_OBJ
	LINE_TS_DEFINE_END

	LINE_TS_INIT_FUNC_HEADER
	LINE_TS_INIT_FUNC_END
	LINE_TS_ID_REG
	LINE_TS_PROTO_ID_REG

	LINE_MODEL_PACKAGE
	LINE_MODEL_GOPACKAGE
	LINE_MODEL_CSPACKAGE
	LINE_MODEL_TSPACKAGE
	LINE_MODEL_IMPORTS
	LINE_MODEL_ERRORS_HEADER
	LINE_MODEL_ERROR
	LINE_MODEL_IDS_HEADER
	LINE_MODEL_ID
	LINE_MODEL_CLASS_HEADER
	LINE_MODEL_CLASS_FIELD
	LINE_MODEL_ENUM_HEADER
	LINE_MODEL_ENUM_FIELD

	LINE_PROTO_PACKAGE
	LINE_PROTO_HEADER
	LINE_PROTO_FIELD
	LINE_PROTO_ENUM_HEADER
	LINE_PROTO_ENUM_FIELD
	LINE_PROTO_ENUM_ALIAS
	LINE_PROTO_SYNTAX
	LINE_PROTO_ID
)

func (LineType) Parse

func (this LineType) Parse(origin string, args map[string]string) string

func (LineType) RegExp

func (this LineType) RegExp() *regexp.Regexp

func (LineType) RegMatch

func (this LineType) RegMatch(str string) bool

func (LineType) RegReplaceName

func (this LineType) RegReplaceName(str string) string

func (LineType) RegReplacePkg

func (this LineType) RegReplacePkg(str string) string

func (LineType) RegReplaceStructName

func (this LineType) RegReplaceStructName(str string) string

func (LineType) RegReplaceTagName

func (this LineType) RegReplaceTagName(str string) string

func (LineType) RegReplaceType

func (this LineType) RegReplaceType(str string) string

func (LineType) RegReplaceValue

func (this LineType) RegReplaceValue(str string) string

func (LineType) String

func (this LineType) String() string

type ModelClassFields

type ModelClassFields struct {
	Name    string
	Type    string
	Index   int
	Comment string
}

func (*ModelClassFields) CsString

func (this *ModelClassFields) CsString(g *Generator) string

func (*ModelClassFields) GoString

func (this *ModelClassFields) GoString(g *Generator) string

func (*ModelClassFields) ParamAssignString

func (this *ModelClassFields) ParamAssignString(g *Generator) string

func (*ModelClassFields) ParamString

func (this *ModelClassFields) ParamString(g *Generator) string

type ModelClassObject

type ModelClassObject struct {
	DefaultGeneratorObj
	TagId BINARY_TAG

	Fields    []*ModelClassFields
	Package   string
	CsPackage string
	GoPackage string
	TsPackage string
	ClassName string
	Comment   string
	// contains filtered or unexported fields
}

func NewModelClassObject

func NewModelClassObject(file GeneratorFile) *ModelClassObject

func (*ModelClassObject) CheckLine

func (this *ModelClassObject) CheckLine(line *LineText) bool

func (*ModelClassObject) CsString

func (this *ModelClassObject) CsString(g *Generator) string

func (*ModelClassObject) GoImplString

func (this *ModelClassObject) GoImplString(g *Generator) string

func (*ModelClassObject) GoString

func (this *ModelClassObject) GoString(g *Generator) string

func (*ModelClassObject) SetPackage

func (this *ModelClassObject) SetPackage(pack string)

type ModelEnumObject

type ModelEnumObject struct {
	DefaultGeneratorObj

	Package   string
	CsPackage string
	GoPackage string
	TsPackage string
	EnumName  string
	Comment   string
	// contains filtered or unexported fields
}

func NewModelEnumObject

func NewModelEnumObject(file GeneratorFile) *ModelEnumObject

func (*ModelEnumObject) CheckLine

func (this *ModelEnumObject) CheckLine(line *LineText) bool

func (*ModelEnumObject) CsString

func (this *ModelEnumObject) CsString(g *Generator) string

func (*ModelEnumObject) GoString

func (this *ModelEnumObject) GoString(g *Generator) string

func (*ModelEnumObject) SetPackage

func (this *ModelEnumObject) SetPackage(pack string)

type ModelError added in v0.0.6

type ModelError struct {
	ErrorName   string
	ErrorId     int
	ErrorText   string
	PackageName string
}

func (*ModelError) CsString added in v0.0.6

func (this *ModelError) CsString(g *Generator) string

func (*ModelError) GoString added in v0.0.6

func (this *ModelError) GoString(g *Generator) string

type ModelErrorsObject added in v0.0.6

type ModelErrorsObject struct {
	DefaultGeneratorObj
	PackageName   string
	GoPackageName string
	CsPackageName string
	TsPackageName string
	Errors        map[int]*ModelError
}

func NewModelErrorsObject added in v0.0.6

func NewModelErrorsObject(file GeneratorFile) *ModelErrorsObject

func (*ModelErrorsObject) CheckLine added in v0.0.6

func (this *ModelErrorsObject) CheckLine(line *LineText) bool

type ModelFile

type ModelFile struct {
	*DefaultGeneratorFile
	Package   string
	GoPackage string
	CsPackage string
	TsPackage string
}

func NewModelFile

func NewModelFile(generator *Generator) *ModelFile

func (*ModelFile) Generate

func (this *ModelFile) Generate() *promise.Promise

func (*ModelFile) Parse

func (this *ModelFile) Parse() *promise.Promise

func (*ModelFile) ProcessEnums

func (this *ModelFile) ProcessEnums() []*ModelEnumObject

func (*ModelFile) ProcessErrors added in v0.0.6

func (this *ModelFile) ProcessErrors() []*ModelError

func (*ModelFile) ProcessIds

func (this *ModelFile) ProcessIds() []*ModelId

func (*ModelFile) ProcessModels

func (this *ModelFile) ProcessModels() []*ModelClassObject

func (*ModelFile) ProcessPackages

func (this *ModelFile) ProcessPackages() *ModelPackageObject

type ModelId

type ModelId struct {
	Name         string
	Id           int
	Type         string
	Resp         string
	Comment      string
	PackageName  string
	ClassObj     *ModelClassObject
	RespClassObj *ModelClassObject
}

func (*ModelId) GetCsIdRegisterString

func (this *ModelId) GetCsIdRegisterString(g *Generator) string

func (*ModelId) GetCsMessageRegisterString

func (this *ModelId) GetCsMessageRegisterString(g *Generator) string

func (*ModelId) GetCsProtocolFuncString

func (this *ModelId) GetCsProtocolFuncString(g *Generator) string

func (*ModelId) GetGoIdAssignString

func (this *ModelId) GetGoIdAssignString(g *Generator) string

func (*ModelId) GetGoIdRegisterString

func (this *ModelId) GetGoIdRegisterString(g *Generator) string

func (*ModelId) GetGoProtocolFuncString

func (this *ModelId) GetGoProtocolFuncString(g *Generator) string

type ModelIdsObject

type ModelIdsObject struct {
	DefaultGeneratorObj

	PackageName string
	Ids         map[int]*ModelId
	// contains filtered or unexported fields
}

func NewModelIdsObject

func NewModelIdsObject(file GeneratorFile) *ModelIdsObject

func (*ModelIdsObject) CheckLine

func (this *ModelIdsObject) CheckLine(line *LineText) bool

type ModelImportObject

type ModelImportObject struct {
	DefaultGeneratorObj
	// contains filtered or unexported fields
}

func NewModelImportObject

func NewModelImportObject(file GeneratorFile) *ModelImportObject

func (*ModelImportObject) CheckLine

func (this *ModelImportObject) CheckLine(line *LineText) bool

type ModelPackageObject

type ModelPackageObject struct {
	DefaultGeneratorObj
	PackageName   string
	GoPackageName string
	CsPackageName string
	TsPackageName string
	Ids           map[BINARY_TAG]*ModelId
	Errors        map[int]*ModelError
}

func NewModelPackageObject

func NewModelPackageObject(file GeneratorFile) *ModelPackageObject

func (*ModelPackageObject) CheckLine

func (this *ModelPackageObject) CheckLine(line *LineText) bool

func (*ModelPackageObject) CsErrorString added in v0.0.6

func (this *ModelPackageObject) CsErrorString(g *Generator) string

func (*ModelPackageObject) CsString

func (this *ModelPackageObject) CsString(g *Generator) string

func (*ModelPackageObject) GetCsFuncString

func (this *ModelPackageObject) GetCsFuncString(g *Generator) string

func (*ModelPackageObject) GetCsIdRegString

func (this *ModelPackageObject) GetCsIdRegString(g *Generator) string

func (*ModelPackageObject) GetCsMessageRegString

func (this *ModelPackageObject) GetCsMessageRegString(g *Generator) string

func (*ModelPackageObject) GetCsPackageName

func (this *ModelPackageObject) GetCsPackageName() string

func (*ModelPackageObject) GetGoFuncString

func (this *ModelPackageObject) GetGoFuncString(g *Generator) string

func (*ModelPackageObject) GetGoIdAssignString

func (this *ModelPackageObject) GetGoIdAssignString(g *Generator) string

func (*ModelPackageObject) GetGoIdRegString

func (this *ModelPackageObject) GetGoIdRegString(g *Generator) string

func (*ModelPackageObject) GetGoPackageName

func (this *ModelPackageObject) GetGoPackageName() string

func (*ModelPackageObject) GoErrorString added in v0.0.6

func (this *ModelPackageObject) GoErrorString(g *Generator) string

func (*ModelPackageObject) GoString

func (this *ModelPackageObject) GoString(g *Generator) string

TODO

type ModelSchema

type ModelSchema struct {
	Index         int
	Name          string
	Path          string
	EnumName      string
	Component     bool
	IsLongString  bool
	Type          BINARY_TAG
	ContainerType BINARY_TAG
	KeyType       BINARY_TAG
	Body          []*ModelSchema
	Depends       []string
	// contains filtered or unexported fields
}

func (*ModelSchema) SetGoRelativePath

func (this *ModelSchema) SetGoRelativePath(goPath string)

func (*ModelSchema) ToJsonSchema

func (this *ModelSchema) ToJsonSchema() string

func (*ModelSchema) ToLineEnd

func (this *ModelSchema) ToLineEnd() string

func (*ModelSchema) ToLineObject

func (this *ModelSchema) ToLineObject() []string

func (*ModelSchema) ToLineStart

func (this *ModelSchema) ToLineStart() string

func (*ModelSchema) ToSingleLine

func (this *ModelSchema) ToSingleLine() string

func (*ModelSchema) ToTsClassHeader

func (this *ModelSchema) ToTsClassHeader() string

func (*ModelSchema) ToTsPublicSingleLine

func (this *ModelSchema) ToTsPublicSingleLine() string

func (*ModelSchema) ToTsPublicType

func (this *ModelSchema) ToTsPublicType() string

type ObjectId

type ObjectId struct {
	// contains filtered or unexported fields
}

A globally unique identifier for Objects.

func NewObjectId

func NewObjectId() ObjectId

News generates new ObjectID with a unique value.

func Parse

func Parse(input string) (o ObjectId, err error)

Parses a string and creates a new ObjectId.

func (ObjectId) Increment

func (o ObjectId) Increment() int32

func (ObjectId) Machine

func (o ObjectId) Machine() int32

func (ObjectId) Pid

func (o ObjectId) Pid() int32

func (ObjectId) String

func (o ObjectId) String() string

String returns the ObjectID id as a 24 byte hex string representation.

func (ObjectId) Timestamp

func (o ObjectId) Timestamp() int64

type ObjectType

type ObjectType int
const (
	OBJ_UNDEFINED ObjectType = iota
	OBJ_GO_PACKAGE
	OBJ_GO_IMPORTS
	OBJ_GO_INTERFACE
	OBJ_GO_STRUCT
	OBJ_GO_STRUCT_FUNC
	OBJ_GO_FUNC
	OBJ_GO_VAR
	OBJ_GO_ENUM
	OBJ_GO_ID
	OBJ_GO_ID_REG
	OBJ_GO_DEFINE
	OBJ_CONF

	OBJ_EMPTY
	OBJ_COMMENT

	OBJ_TS_CLASS
	OBJ_TS_IMPORTS
	OBJ_TS_VAR
	OBJ_TS_FUNC
	OBJ_TS_ENUM
	OBJ_TS_IDS

	OBJ_MODEL_PACKAGE
	OBJ_MODEL_IMPORTS
	OBJ_MODEL_IDS
	OBJ_MODEL_ERRORS
	OBJ_MODEL_CLASS
	OBJ_MODEL_ENUM

	OBJ_PROTO_PACKAGE
	OBJ_PROTO_SYNTAX
	OBJ_PROTO_MSG
	OBJ_PROTO_IDS
	OBJ_PROTO_ENUM

	OBJ_PROTO_TS_INTERFACE
)

func (ObjectType) Create

func (this ObjectType) Create(file GeneratorFile) GeneratorObject

func (ObjectType) String

func (this ObjectType) String() string

type Ping

type Ping struct {
	Time time.Time
}

func (*Ping) GetId

func (this *Ping) GetId() (BINARY_TAG, error)

func (*Ping) Marshal

func (this *Ping) Marshal() ([]byte, error)

func (*Ping) Serializable

func (this *Ping) Serializable() ISerializable

func (*Ping) Unmarshal

func (this *Ping) Unmarshal(from []byte) error

type Pong

type Pong struct {
	Time time.Time
}

func (*Pong) GetId

func (this *Pong) GetId() (BINARY_TAG, error)

func (*Pong) Marshal

func (this *Pong) Marshal() ([]byte, error)

func (*Pong) Serializable

func (this *Pong) Serializable() ISerializable

func (*Pong) Unmarshal

func (this *Pong) Unmarshal(from []byte) error

type ProtoEnumObject

type ProtoEnumObject struct {
	DefaultGeneratorObj
	Alias  bool
	Fields []*ProtoField
}

func NewProtoEnumObject

func NewProtoEnumObject(file GeneratorFile) *ProtoEnumObject

func (*ProtoEnumObject) CheckField

func (this *ProtoEnumObject) CheckField(line *LineText)

func (*ProtoEnumObject) CheckLine

func (this *ProtoEnumObject) CheckLine(line *LineText) bool

type ProtoField

type ProtoField struct {
	Repeated bool
	Map      bool
	Proto    bool
	Enum     bool
	KeyType  string
	Type     string
	Id       int
}

type ProtoFile

type ProtoFile struct {
	*DefaultGeneratorFile
}

func NewProtoFile

func NewProtoFile(generator *Generator) *ProtoFile

func (*ProtoFile) Generate

func (this *ProtoFile) Generate() *promise.Promise

func (*ProtoFile) Parse

func (this *ProtoFile) Parse() *promise.Promise

func (*ProtoFile) ProcessProtos

func (this *ProtoFile) ProcessProtos() []*ProtoMsgObject

type ProtoIdsFile

type ProtoIdsFile struct {
	*DefaultGeneratorFile
	Ids map[int]string
}

func NewProtoIdsFile

func NewProtoIdsFile(generator *Generator) *ProtoIdsFile

func (*ProtoIdsFile) AddId

func (this *ProtoIdsFile) AddId(s string, id int)

func (*ProtoIdsFile) Generate

func (this *ProtoIdsFile) Generate() *promise.Promise

func (*ProtoIdsFile) Parse

func (this *ProtoIdsFile) Parse() *promise.Promise

type ProtoIdsObj

type ProtoIdsObj struct {
	DefaultGeneratorObj
	ProtoName string
	Id        int
}

func NewProtoIdsObj

func NewProtoIdsObj(file GeneratorFile) *ProtoIdsObj

func (*ProtoIdsObj) Check

func (this *ProtoIdsObj) Check(line *LineText)

func (*ProtoIdsObj) CheckLine

func (this *ProtoIdsObj) CheckLine(line *LineText) bool

type ProtoMsgObject

type ProtoMsgObject struct {
	DefaultGeneratorObj
	ProtoName string
	ProtoId   int
	Fields    []*ProtoField
}

func NewProtoMsgObject

func NewProtoMsgObject(file GeneratorFile) *ProtoMsgObject

func (*ProtoMsgObject) CheckField

func (this *ProtoMsgObject) CheckField(line *LineText)

func (*ProtoMsgObject) CheckLine

func (this *ProtoMsgObject) CheckLine(line *LineText) bool

type ProtoPackageObj

type ProtoPackageObj struct {
	DefaultGeneratorObj
}

func NewProtoPackageObj

func NewProtoPackageObj(file GeneratorFile) *ProtoPackageObj

func (*ProtoPackageObj) CheckLine

func (this *ProtoPackageObj) CheckLine(line *LineText) bool

type ProtoSyntaxObj

type ProtoSyntaxObj struct {
	DefaultGeneratorObj
}

func NewProtoSyntaxObj

func NewProtoSyntaxObj(file GeneratorFile) *ProtoSyntaxObj

func (*ProtoSyntaxObj) CheckLine

func (this *ProtoSyntaxObj) CheckLine(line *LineText) bool

type RouteMessage

type RouteMessage struct {
	TransId   uint32
	Len       uint16
	Req       bool
	CmdId     BINARY_TAG
	InnerId   BINARY_TAG
	FromActor util.ID
	ToActor   util.ID
	Body      ISerializable
}

RouteMessage rpc message across server

func NewRouteMessage

func NewRouteMessage(fromActor util.ID, toActor util.ID, transId uint32, msg ISerializable, isReq bool) *RouteMessage

func (*RouteMessage) BinaryMessage

func (this *RouteMessage) BinaryMessage() *BinaryMessage

func (*RouteMessage) GetId

func (this *RouteMessage) GetId() (BINARY_TAG, error)

func (*RouteMessage) Marshal

func (this *RouteMessage) Marshal() ([]byte, error)

func (*RouteMessage) Serializable

func (this *RouteMessage) Serializable() ISerializable

func (*RouteMessage) Unmarshal

func (this *RouteMessage) Unmarshal(from []byte) error

type TYPE

type TYPE int
const (
	BINARY TYPE = 0
	JSON   TYPE = 1
)

func String2Type

func String2Type(s string) TYPE

func (TYPE) String

func (this TYPE) String() string

type TsClassMember

type TsClassMember struct {
	IsGetter bool
	IsSetter bool
	IsPublic bool
	Name     string
	Type     string
	Line     *LineText
}

type TsClassObject

type TsClassObject struct {
	DefaultGeneratorObj
	ClassName      string
	IsComponent    bool
	IsSerializable bool

	LongStringTag map[string]bool
	// contains filtered or unexported fields
}

func NewTsClassObject

func NewTsClassObject(file GeneratorFile) *TsClassObject

func (*TsClassObject) CheckLine

func (this *TsClassObject) CheckLine(line *LineText) bool

func (*TsClassObject) CheckLongString

func (this *TsClassObject) CheckLongString(mName string) bool

func (*TsClassObject) GetClassMember

func (this *TsClassObject) GetClassMember(s string) *TsClassMember

func (*TsClassObject) GetClassName

func (this *TsClassObject) GetClassName() string

func (*TsClassObject) IsModel

func (this *TsClassObject) IsModel() bool

func (*TsClassObject) Name

func (this *TsClassObject) Name() string

type TsEnumFile

type TsEnumFile struct {
	*DefaultGeneratorFile
}

func NewTsEnumFile

func NewTsEnumFile(generator *Generator) *TsEnumFile

func (*TsEnumFile) Generate

func (this *TsEnumFile) Generate() *promise.Promise

func (*TsEnumFile) Parse

func (this *TsEnumFile) Parse() *promise.Promise

type TsEnumObject

type TsEnumObject struct {
	DefaultGeneratorObj
}

func NewTsEnumObject

func NewTsEnumObject(file GeneratorFile) *TsEnumObject

func (*TsEnumObject) CheckLine

func (this *TsEnumObject) CheckLine(line *LineText) bool

type TsFuncObject

type TsFuncObject struct {
	DefaultGeneratorObj
}

func NewTsFuncObject

func NewTsFuncObject(file GeneratorFile) *TsFuncObject

func (*TsFuncObject) CheckLine

func (this *TsFuncObject) CheckLine(line *LineText) bool

type TsIdsFile

type TsIdsFile struct {
	*DefaultGeneratorFile
}

func NewTsIdsFile

func NewTsIdsFile(generator *Generator) *TsIdsFile

func (*TsIdsFile) Generate

func (this *TsIdsFile) Generate() *promise.Promise

func (*TsIdsFile) Parse

func (this *TsIdsFile) Parse() *promise.Promise

type TsIdsObject

type TsIdsObject struct {
	DefaultGeneratorObj
}

func NewTsIdsObject

func NewTsIdsObject(file GeneratorFile) *TsIdsObject

func (*TsIdsObject) CheckLine

func (this *TsIdsObject) CheckLine(line *LineText) bool

type TsImportObject

type TsImportObject struct {
	DefaultGeneratorObj
}

func NewTsImportObject

func NewTsImportObject(file GeneratorFile) *TsImportObject

func (*TsImportObject) CheckLine

func (this *TsImportObject) CheckLine(line *LineText) bool

type TsModelFile

type TsModelFile struct {
	*DefaultGeneratorFile
}

func NewTsModelFile

func NewTsModelFile(generator *Generator) *TsModelFile

func (*TsModelFile) Generate

func (this *TsModelFile) Generate() *promise.Promise

func (*TsModelFile) Parse

func (this *TsModelFile) Parse() *promise.Promise

func (*TsModelFile) ProcessClasses

func (this *TsModelFile) ProcessClasses() []*TsClassObject

type TsVarObject

type TsVarObject struct {
	DefaultGeneratorObj
}

func NewTsVarObject

func NewTsVarObject(file GeneratorFile) *TsVarObject

func (*TsVarObject) CheckLine

func (this *TsVarObject) CheckLine(line *LineText) bool

type TypeRegistry

type TypeRegistry struct {
	// contains filtered or unexported fields
}

func GetTypeRegistry

func GetTypeRegistry() *TypeRegistry

单例,进程唯一

func (*TypeRegistry) GetInterfaceByTag

func (this *TypeRegistry) GetInterfaceByTag(t BINARY_TAG) (ISerializable, error)

func (*TypeRegistry) GetNameByType

func (this *TypeRegistry) GetNameByType(t reflect.Type) string

func (*TypeRegistry) GetTagByName

func (this *TypeRegistry) GetTagByName(s string) BINARY_TAG

func (*TypeRegistry) GetTagByType

func (this *TypeRegistry) GetTagByType(p reflect.Type) (BINARY_TAG, error)

func (*TypeRegistry) GetTagName

func (this *TypeRegistry) GetTagName(t BINARY_TAG) string

func (*TypeRegistry) GetTypeByTag

func (this *TypeRegistry) GetTypeByTag(t BINARY_TAG) (reflect.Type, error)

func (*TypeRegistry) RegistrySystemTag

func (this *TypeRegistry) RegistrySystemTag(t BINARY_TAG, s string)

func (*TypeRegistry) RegistryTemplateTag

func (this *TypeRegistry) RegistryTemplateTag(t BINARY_TAG, s string)

func (*TypeRegistry) RegistryType

func (this *TypeRegistry) RegistryType(t BINARY_TAG, p reflect.Type)

Jump to

Keyboard shortcuts

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