Documentation ¶
Index ¶
- Constants
- Variables
- func CreateBinaryLongPacket(data []byte, idx int) ([]byte, error)
- func CreateJsonLongPacket(data []byte, idx int) ([]byte, error)
- func CreateLongPacket(protocol TYPE) func(data []byte, idx int) ([]byte, error)
- func GetLineRegExps() map[string]*regexp.Regexp
- func IsProtobuf() bool
- func MarshalBinary(s interface{}) ([]byte, error)
- func MarshalBinaryMessage(transId uint32, data interface{}) (ret []byte, err error)
- func MarshalJsonMessage(transId uint32, data interface{}) (ret []byte, err error)
- func MarshalMessage(transId uint32, data interface{}, t TYPE) (ret []byte, err error)
- func MatchGoProtoTag(s string) bool
- func PickBinaryLongPacket(data []byte) (bool, int, []byte)
- func PickJsonLongPacket(data []byte) (bool, int, []byte)
- func PickLongPacket(protocol TYPE) func(data []byte) (bool, int, []byte)
- func SetProtobuf()
- func SetTypeRegistry(registry *TypeRegistry)
- func Split(data []byte, atEOF bool) (advance int, token []byte, err error)
- func Unmarshal(data []byte, v interface{}) (err error)
- func UnmarshalFromBytes(data []byte, v interface{}) error
- type BINARY_LENGTH
- type BINARY_NAME_SIZE
- type BINARY_TAG
- func GetCmdId(data []byte) BINARY_TAG
- func GetCmdId16(data []byte) BINARY_TAG
- func GetCmdIdFromType(data interface{}) (BINARY_TAG, error)
- func GetModelProtoTag(s string) BINARY_TAG
- func MatchGoSystemTag(s string) (BINARY_TAG, string, string)
- func MatchModelProtoTag(s string) BINARY_TAG
- func MatchModelSystemTag(s string) (BINARY_TAG, string, string)
- func (tag BINARY_TAG) CsTypeString() string
- func (tag BINARY_TAG) GoTypeString() string
- func (tag BINARY_TAG) IsArrayLike() bool
- func (tag BINARY_TAG) IsBaseValue() bool
- func (tag BINARY_TAG) IsProto() bool
- func (this BINARY_TAG) MatchRegExp(str string) bool
- func (tag BINARY_TAG) String() string
- func (tag BINARY_TAG) TsTagString() string
- func (tag BINARY_TAG) TsTypeString() string
- type BinaryMessage
- type CommentObject
- type ComposeData
- type Compression
- type ConfFile
- type ConfObject
- type DefaultGeneratorFile
- func (this *DefaultGeneratorFile) AddObject(obj GeneratorObject)
- func (this *DefaultGeneratorFile) CheckFinish(offset int) bool
- func (this *DefaultGeneratorFile) Generate(typ FileType) *promise.Promise
- func (this *DefaultGeneratorFile) GetFile() GeneratorFile
- func (this *DefaultGeneratorFile) GetFilePath() string
- func (this *DefaultGeneratorFile) GetGoRelativePath() string
- func (this *DefaultGeneratorFile) GetLines() []*LineText
- func (this *DefaultGeneratorFile) GetLogger() log.ILogger
- func (this *DefaultGeneratorFile) GetObj(objType ObjectType) []GeneratorObject
- func (this *DefaultGeneratorFile) GetTsRelativePath() string
- func (this *DefaultGeneratorFile) InsertAfter(obj GeneratorObject, after GeneratorObject)
- func (this *DefaultGeneratorFile) InsertObject(pos int, obj GeneratorObject)
- func (this *DefaultGeneratorFile) Load(path string) *promise.Promise
- func (this *DefaultGeneratorFile) MarshalToFile(path string) *promise.Promise
- func (this *DefaultGeneratorFile) Parse() *promise.Promise
- func (this *DefaultGeneratorFile) RemoveAutoGenHeader()
- func (this *DefaultGeneratorFile) RemoveObjByCondition(condition GenerateObjRemoveCondition)
- func (this *DefaultGeneratorFile) RemoveObjType(objType ObjectType)
- func (this *DefaultGeneratorFile) SetGenerator(generator *Generator)
- type DefaultGeneratorObj
- func (this *DefaultGeneratorObj) AddLine(line *LineText, lineType LineType) *LineText
- func (this *DefaultGeneratorObj) CheckLine(line *LineText) bool
- func (this *DefaultGeneratorObj) File() GeneratorFile
- func (this *DefaultGeneratorObj) GenerateToObject(typ ObjectType) GeneratorObject
- func (this *DefaultGeneratorObj) GetFile() GeneratorFile
- func (this *DefaultGeneratorObj) GetLines(lineType LineType) []*LineText
- func (this *DefaultGeneratorObj) GetLogger() log.ILogger
- func (this *DefaultGeneratorObj) InsertAfter(line *LineText, after *LineText) *LineText
- func (this *DefaultGeneratorObj) InsertLine(pos int, line *LineText) *LineText
- func (this *DefaultGeneratorObj) Lines() []*LineText
- func (this *DefaultGeneratorObj) Name() string
- func (this *DefaultGeneratorObj) ObjectType() ObjectType
- func (this *DefaultGeneratorObj) RemoveLineType(lineType LineType) []*LineText
- func (this *DefaultGeneratorObj) String() string
- func (this *DefaultGeneratorObj) TryAddLine(line *LineText, lineType LineType) bool
- func (this *DefaultGeneratorObj) TryAddLineStrict(line *LineText, lineType LineType) bool
- type EmptyObject
- type Enum
- type EnumCollection
- type ErrCode
- type ErrMsg
- type Fields
- type FileType
- type GenType
- type GenerateObjRemoveCondition
- type Generator
- func (this *Generator) Clear()
- func (this *Generator) GenerateModel2Cs() error
- func (this *Generator) GenerateModel2Go() error
- func (this *Generator) GenerateModel2Ts() error
- func (this *Generator) GetEnumByName(s string) *ModelEnumObject
- func (this *Generator) GetErrorName(id int) string
- func (this *Generator) GetLogger() log.ILogger
- func (this *Generator) GetModelByName(s string) *ModelClassObject
- func (this *Generator) IsEnum(s string) bool
- func (this *Generator) IsErrorName(s string) bool
- func (this *Generator) LoadAndParseTsFile(modelsPath string) (*TsModelFile, error)
- func (this *Generator) LoadCsFolder(p string) *promise.Promise
- func (this *Generator) LoadGo2TsModels(p string) error
- func (this *Generator) LoadModelFolder(p string) *promise.Promise
- func (this *Generator) LoadModels(p string) error
- func (this *Generator) LoadTsFolder(p string) *promise.Promise
- func (this *Generator) LoadTsIds(p string) error
- func (this *Generator) SetLogger(logger log.ILogger)
- func (this *Generator) SetOption(opt GeneratorOption)
- func (this *Generator) SetProto2GoCmdLine(f func(pack, protoPath, GoPath string) error)
- func (this *Generator) SetProto2TsCmdLine(f func(pack, protoPath, TsPath string) error)
- type GeneratorFile
- type GeneratorObject
- type GeneratorOption
- type GoAssignedId
- type GoDefineObject
- type GoEnumObject
- type GoFuncObject
- type GoIdObject
- type GoIdRegObject
- type GoIdsFile
- type GoImportObject
- type GoInterfaceObject
- type GoModelFile
- type GoPackageObject
- type GoStructFields
- type GoStructFuncObject
- type GoStructObject
- type GoVarObject
- type HandShake
- type IEnum
- type IEnumCollection
- type IError
- type ISerializable
- type LineText
- func (this *LineText) GetName() string
- func (this *LineText) GetPkgName() string
- func (this *LineText) GetStructName() string
- func (this *LineText) GetTagName() string
- func (this *LineText) GetTypeName() string
- func (this *LineText) GetValue() int
- func (this *LineText) IsBufferTag() bool
- func (this *LineText) IsLongStringTag() bool
- func (this *LineText) ObjName() string
- func (this *LineText) Parse() string
- type LineType
- func (this LineType) Parse(origin string, args map[string]string) string
- func (this LineType) RegExp() *regexp.Regexp
- func (this LineType) RegMatch(str string) bool
- func (this LineType) RegReplaceName(str string) string
- func (this LineType) RegReplacePkg(str string) string
- func (this LineType) RegReplaceStructName(str string) string
- func (this LineType) RegReplaceTagName(str string) string
- func (this LineType) RegReplaceType(str string) string
- func (this LineType) RegReplaceValue(str string) string
- func (this LineType) String() string
- type ModelClassFields
- func (this *ModelClassFields) CsString(g *Generator) string
- func (this *ModelClassFields) Deps(g *Generator) []string
- func (this *ModelClassFields) GoString(g *Generator) string
- func (this *ModelClassFields) ParamAssignString(g *Generator) string
- func (this *ModelClassFields) ParamString(g *Generator) string
- func (this *ModelClassFields) TsDefineTags(g *Generator, tsClass *TsClassObject) string
- func (this *ModelClassFields) TsPublicString(g *Generator) string
- func (this *ModelClassFields) TsPublicType(g *Generator) string
- type ModelClassObject
- func (this *ModelClassObject) CheckLine(line *LineText) bool
- func (this *ModelClassObject) CsString(g *Generator) string
- func (this *ModelClassObject) Deps(g *Generator) []string
- func (this *ModelClassObject) GoImplString(g *Generator) string
- func (this *ModelClassObject) GoString(g *Generator) string
- func (this *ModelClassObject) SetPackage(pack string)
- func (this *ModelClassObject) ToTsClassHeader(g *Generator, object *TsClassObject) string
- func (this *ModelClassObject) TsDefineEnd(g *Generator) string
- func (this *ModelClassObject) TsDefineLines(g *Generator, tsClass *TsClassObject) []string
- func (this *ModelClassObject) TsDefineSingleLine(g *Generator) string
- func (this *ModelClassObject) TsDefineStart(g *Generator) string
- type ModelEnumObject
- type ModelError
- type ModelErrorsObject
- type ModelFile
- func (this *ModelFile) Generate() *promise.Promise
- func (this *ModelFile) Parse() *promise.Promise
- func (this *ModelFile) ProcessEnums() []*ModelEnumObject
- func (this *ModelFile) ProcessErrors() []*ModelError
- func (this *ModelFile) ProcessIds() []*ModelId
- func (this *ModelFile) ProcessImports() []string
- func (this *ModelFile) ProcessModels() []*ModelClassObject
- func (this *ModelFile) ProcessPackages() *ModelPackageObject
- type ModelId
- func (this *ModelId) Deps(g *Generator) []string
- func (this *ModelId) GetCsIdRegisterString(g *Generator) string
- func (this *ModelId) GetCsMessageRegisterString(g *Generator) string
- func (this *ModelId) GetCsProtocolFuncString(g *Generator) string
- func (this *ModelId) GetGoIdAssignString(g *Generator) string
- func (this *ModelId) GetGoIdRegisterString(g *Generator) string
- func (this *ModelId) GetGoProtocolFuncString(g *Generator) string
- type ModelIdsObject
- type ModelImportObject
- type ModelPackageObject
- func (this *ModelPackageObject) CheckLine(line *LineText) bool
- func (this *ModelPackageObject) CsErrorString(g *Generator) string
- func (this *ModelPackageObject) CsString(g *Generator) string
- func (this *ModelPackageObject) GetCsFuncString(g *Generator) string
- func (this *ModelPackageObject) GetCsIdRegString(g *Generator) string
- func (this *ModelPackageObject) GetCsMessageRegString(g *Generator) string
- func (this *ModelPackageObject) GetCsPackageName() string
- func (this *ModelPackageObject) GetGoFuncString(g *Generator) string
- func (this *ModelPackageObject) GetGoIdAssignString(g *Generator) string
- func (this *ModelPackageObject) GetGoIdRegString(g *Generator) string
- func (this *ModelPackageObject) GetGoPackageName() string
- func (this *ModelPackageObject) GoErrorString(g *Generator) string
- func (this *ModelPackageObject) GoString(g *Generator) string
- func (this *ModelPackageObject) TsErrorString(g *Generator) string
- func (this *ModelPackageObject) TsString(g *Generator) string
- type ObjectId
- type ObjectType
- type Ping
- type Pong
- type ProtoEnumObject
- type ProtoField
- type ProtoFile
- type ProtoIdsFile
- type ProtoIdsObj
- type ProtoMsgObject
- type ProtoPackageObj
- type ProtoSyntaxObj
- type REGEXP_LINE_ENUM
- type RouteMessage
- type TYPE
- type TsClassMember
- type TsClassObject
- func (this *TsClassObject) CheckBuffer(mName string) bool
- func (this *TsClassObject) CheckLine(line *LineText) bool
- func (this *TsClassObject) CheckLongString(mName string) bool
- func (this *TsClassObject) GetClassMember(s string) *TsClassMember
- func (this *TsClassObject) GetClassName() string
- func (this *TsClassObject) IsModel() bool
- func (this *TsClassObject) Name() string
- type TsEnumFile
- type TsEnumObject
- type TsErrorsObject
- type TsFuncObject
- type TsIdsFile
- type TsIdsObject
- type TsImportObject
- type TsModelFile
- type TsVarObject
- type TypeRegistry
- func (this *TypeRegistry) GetInterfaceByTag(t BINARY_TAG) (ISerializable, error)
- func (this *TypeRegistry) GetNameByType(t reflect.Type) string
- func (this *TypeRegistry) GetTagByName(s string) BINARY_TAG
- func (this *TypeRegistry) GetTagByType(p reflect.Type) (BINARY_TAG, error)
- func (this *TypeRegistry) GetTagName(t BINARY_TAG) string
- func (this *TypeRegistry) GetTypeByTag(t BINARY_TAG) (reflect.Type, error)
- func (this *TypeRegistry) RegistrySystemTag(t BINARY_TAG, s string)
- func (this *TypeRegistry) RegistryTemplateTag(t BINARY_TAG, s string)
- func (this *TypeRegistry) RegistryType(t BINARY_TAG, p reflect.Type)
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 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") ERR_RPC_FAILED = CreateError(-102, "rpc failed") //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 CreateLongPacket ¶
func GetLineRegExps ¶
func IsProtobuf ¶
func IsProtobuf() bool
func MarshalBinary ¶
func MarshalBinaryMessage ¶
func MarshalJsonMessage ¶
func MarshalMessage ¶
func MatchGoProtoTag ¶
func SetProtobuf ¶
func SetProtobuf()
func SetTypeRegistry ¶
func SetTypeRegistry(registry *TypeRegistry)
func UnmarshalFromBytes ¶
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_Color 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 ¶
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 ¶
type ConfObject ¶
type ConfObject struct {
DefaultGeneratorObj
}
func NewConfObject ¶
func NewConfObject(file GeneratorFile) *ConfObject
func (*ConfObject) CheckLine ¶
func (this *ConfObject) CheckLine(line *LineText) bool
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) GetLogger ¶ added in v0.1.31
func (this *DefaultGeneratorFile) GetLogger() log.ILogger
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) GetLogger ¶ added in v0.1.31
func (this *DefaultGeneratorObj) GetLogger() log.ILogger
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 EnumCollection ¶ added in v0.2.2
type EnumCollection[T IEnum] struct { Collection []T }
func NewEnumCollection ¶ added in v0.2.2
func NewEnumCollection[T IEnum](colletion []T) EnumCollection[T]
func (EnumCollection[T]) GetEnumByString ¶ added in v0.2.2
func (this EnumCollection[T]) GetEnumByString(s string) T
func (EnumCollection[T]) GetEnumByValue ¶ added in v0.2.2
func (this EnumCollection[T]) GetEnumByValue(s Enum) T
func (EnumCollection[T]) Has ¶ added in v0.2.2
func (this EnumCollection[T]) Has(i int32) bool
type ErrMsg ¶
func NewErrorMsg ¶
func (*ErrMsg) GetId ¶
func (this *ErrMsg) GetId() (BINARY_TAG, error)
func (*ErrMsg) Serializable ¶
func (this *ErrMsg) Serializable() ISerializable
type GenerateObjRemoveCondition ¶
type GenerateObjRemoveCondition func(object GeneratorObject) bool
type Generator ¶
type Generator struct { CsCamelCase bool 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 Individual bool GoPath string TsPath string ProtoPath string ModelPath string CsPath string Proto2GoCmdLinExec func(pack, protoPath, GoPath string) error Proto2TsCmdLinExec func(pack, protoPath, GoPath string) error // contains filtered or unexported fields }
func NewGenerator ¶
func NewGenerator() *Generator
func (*Generator) GenerateModel2Cs ¶
func (*Generator) GenerateModel2Go ¶
func (*Generator) GenerateModel2Ts ¶
func (*Generator) GetEnumByName ¶ added in v0.1.25
func (this *Generator) GetEnumByName(s string) *ModelEnumObject
func (*Generator) GetErrorName ¶ added in v0.0.6
func (*Generator) GetModelByName ¶ added in v0.1.25
func (this *Generator) GetModelByName(s string) *ModelClassObject
func (*Generator) IsErrorName ¶ added in v0.0.6
func (*Generator) LoadAndParseTsFile ¶
func (this *Generator) LoadAndParseTsFile(modelsPath string) (*TsModelFile, error)
func (*Generator) LoadGo2TsModels ¶
func (*Generator) LoadModelFolder ¶
func (*Generator) LoadModels ¶
func (*Generator) LoadTsFolder ¶ added in v0.1.26
func (*Generator) SetOption ¶
func (this *Generator) SetOption(opt GeneratorOption)
func (*Generator) SetProto2GoCmdLine ¶
func (*Generator) SetProto2TsCmdLine ¶
type GeneratorFile ¶
type GeneratorFile interface { GetLogger() log.ILogger 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 GoAssignedId ¶
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 (*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 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) Serializable ¶
func (this *HandShake) Serializable() ISerializable
type IEnumCollection ¶ added in v0.1.24
type IEnumCollection []IEnum
func GetAllLineRegExpEnums ¶ added in v0.1.25
func GetAllLineRegExpEnums() IEnumCollection
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
func (IEnumCollection) Has ¶ added in v0.2.1
func (this IEnumCollection) Has(i int32) 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) GetPkgName ¶
func (*LineText) GetStructName ¶
func (*LineText) GetTagName ¶
func (*LineText) GetTypeName ¶
func (*LineText) IsBufferTag ¶ added in v0.1.33
func (*LineText) IsLongStringTag ¶
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_COCOS LINE_TS_CLASS_DECORATOR LINE_TS_CLASS_HEADER LINE_TS_CLASS_CONSTRUCTOR_HEADER LINE_TS_CLASS_FIELD LINE_TS_CLASS_FIELD_PUBLIC LINE_TS_CLASS_FIELD_PRIVATE LINE_TS_CLASS_FIELD_PROTECTED 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_ERRORS_HEADER LINE_TS_ERRORS_FIELD LINE_TS_INIT_FUNC_HEADER LINE_TS_INIT_FUNC_COCOS 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) RegReplaceName ¶
func (LineType) RegReplacePkg ¶
func (LineType) RegReplaceStructName ¶
func (LineType) RegReplaceTagName ¶
func (LineType) RegReplaceType ¶
func (LineType) RegReplaceValue ¶
type ModelClassFields ¶
func (*ModelClassFields) CsString ¶
func (this *ModelClassFields) CsString(g *Generator) string
func (*ModelClassFields) Deps ¶ added in v0.1.25
func (this *ModelClassFields) Deps(g *Generator) []string
TODO:dep
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
func (*ModelClassFields) TsDefineTags ¶ added in v0.1.26
func (this *ModelClassFields) TsDefineTags(g *Generator, tsClass *TsClassObject) string
func (*ModelClassFields) TsPublicString ¶ added in v0.1.26
func (this *ModelClassFields) TsPublicString(g *Generator) string
func (*ModelClassFields) TsPublicType ¶ added in v0.1.26
func (this *ModelClassFields) TsPublicType(g *Generator) string
type ModelClassObject ¶
type ModelClassObject struct { DefaultGeneratorObj TagId BINARY_TAG Fields []*ModelClassFields Component bool Package string CsPackage string GoPackage string TsPackage string ClassName string Comment string Depends []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) Deps ¶ added in v0.1.25
func (this *ModelClassObject) Deps(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)
func (*ModelClassObject) ToTsClassHeader ¶ added in v0.1.26
func (this *ModelClassObject) ToTsClassHeader(g *Generator, object *TsClassObject) string
func (*ModelClassObject) TsDefineEnd ¶ added in v0.1.26
func (this *ModelClassObject) TsDefineEnd(g *Generator) string
func (*ModelClassObject) TsDefineLines ¶ added in v0.1.26
func (this *ModelClassObject) TsDefineLines(g *Generator, tsClass *TsClassObject) []string
func (*ModelClassObject) TsDefineSingleLine ¶ added in v0.1.26
func (this *ModelClassObject) TsDefineSingleLine(g *Generator) string
func (*ModelClassObject) TsDefineStart ¶ added in v0.1.26
func (this *ModelClassObject) TsDefineStart(g *Generator) 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)
func (*ModelEnumObject) TsString ¶ added in v0.1.26
func (this *ModelEnumObject) TsString(g *Generator) string
type ModelError ¶ added in v0.0.6
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
func (*ModelError) TsString ¶ added in v0.1.33
func (this *ModelError) TsString(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 (*ModelFile) ProcessEnums ¶
func (this *ModelFile) ProcessEnums() []*ModelEnumObject
func (*ModelFile) ProcessErrors ¶ added in v0.0.6
func (this *ModelFile) ProcessErrors() []*ModelError
func (*ModelFile) ProcessIds ¶
func (*ModelFile) ProcessImports ¶ added in v0.1.25
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 (*ModelId) GetCsMessageRegisterString ¶
func (*ModelId) GetCsProtocolFuncString ¶
func (*ModelId) GetGoIdAssignString ¶
func (*ModelId) GetGoIdRegisterString ¶
func (*ModelId) GetGoProtocolFuncString ¶
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
func (*ModelIdsObject) Deps ¶ added in v0.1.25
func (this *ModelIdsObject) Deps(g *Generator) []string
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 Imports map[string]*ModelPackageObject 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
func (*ModelPackageObject) TsErrorString ¶ added in v0.1.33
func (this *ModelPackageObject) TsErrorString(g *Generator) string
func (*ModelPackageObject) TsString ¶ added in v0.1.26
func (this *ModelPackageObject) TsString(g *Generator) string
type ObjectId ¶
type ObjectId struct {
// contains filtered or unexported fields
}
A globally unique identifier for Objects.
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_TS_ERRORS 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 ¶
func (*Ping) GetId ¶
func (this *Ping) GetId() (BINARY_TAG, error)
func (*Ping) Serializable ¶
func (this *Ping) Serializable() ISerializable
type Pong ¶
func (*Pong) GetId ¶
func (this *Pong) GetId() (BINARY_TAG, error)
func (*Pong) Serializable ¶
func (this *Pong) Serializable() ISerializable
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 ProtoFile ¶
type ProtoFile struct {
*DefaultGeneratorFile
}
func NewProtoFile ¶
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 REGEXP_LINE_ENUM ¶ added in v0.1.25
type REGEXP_LINE_ENUM Enum
func (REGEXP_LINE_ENUM) Enum ¶ added in v0.1.25
func (this REGEXP_LINE_ENUM) Enum() Enum
func (REGEXP_LINE_ENUM) ToString ¶ added in v0.1.25
func (this REGEXP_LINE_ENUM) ToString() string
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 TsClassMember ¶
type TsClassObject ¶
type TsClassObject struct { DefaultGeneratorObj Package string ClassName string IsComponent bool IsRenderComponent bool IsSerializable bool LongStringTag map[string]bool BufferTag map[string]bool // contains filtered or unexported fields }
func NewTsClassObject ¶
func NewTsClassObject(file GeneratorFile) *TsClassObject
func (*TsClassObject) CheckBuffer ¶ added in v0.1.33
func (this *TsClassObject) CheckBuffer(mName string) bool
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 TsErrorsObject ¶ added in v0.1.33
type TsErrorsObject struct {
DefaultGeneratorObj
}
func NewTsErrorsObject ¶ added in v0.1.33
func NewTsErrorsObject(file GeneratorFile) *TsErrorsObject
func (*TsErrorsObject) CheckLine ¶ added in v0.1.33
func (this *TsErrorsObject) 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 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 Package string ClassName string }
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 (*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)
Source Files ¶
- decode.go
- encode.go
- errors.go
- generator.go
- generator_cs.go
- generator_file.go
- generator_go.go
- generator_line.go
- generator_model.go
- generator_obj.go
- generator_ts.go
- global.go
- object_id.go
- parser_conf.go
- parser_go.go
- parser_go_ids.go
- parser_model.go
- parser_proto.go
- parser_proto_ids.go
- parser_tag.go
- parser_ts.go
- parser_ts_enum.go
- parser_ts_ids.go
- protocol.go
- tag.go
- type.go
Click to show internal directories.
Click to hide internal directories.