当前位置: 首页>>代码示例>>Golang>>正文


Golang tl.Decoder类代码示例

本文整理汇总了Golang中github.com/tamtam-im/teleport/lib/go/tl.Decoder的典型用法代码示例。如果您正苦于以下问题:Golang Decoder类的具体用法?Golang Decoder怎么用?Golang Decoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Decoder类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Read

func (t *RpcError) Read(decoder tl.Decoder, waitress tl.Waitress, bind_uuid uuid.UUID) (err error) {
	t.ErrorCode, err = decoder.ReadInt()
	if err != nil {
		return
	}
	t.ErrorMessage, err = decoder.ReadString()
	return
}
开发者ID:tamtam-im,项目名称:teleport,代码行数:8,代码来源:box_rpc_error.go

示例2: Read

func (b *ObjectBox) Read(decoder tl.Decoder, waitress tl.Waitress, bind_uuid uuid.UUID) (err error) {
	id, err := decoder.ReadTypeBegin()
	if err != nil {
		return
	}
	err = b.Bind(id)
	if err != nil {
		return
	}
	bare, err := b.Bare()
	if err != nil {
		return
	}
	err = bare.Read(decoder, waitress, bind_uuid)
	return
}
开发者ID:tamtam-im,项目名称:teleport,代码行数:16,代码来源:box_object.go

示例3: Read

func (t *MockRPCResult) Read(decoder tl.Decoder, waitress tl.Waitress, bind_uuid uuid.UUID) (err error) {
	val0 := &t.Arg

	h0, err := decoder.ReadTypeBegin()
	if err != nil {
		return err
	}
	if h0 != builtin.TL_ID_VECTOR_T {
		return fmt.Errorf("bad vector crc %0x08d", h0)
	}

	n0, err := decoder.ReadInt()
	if err != nil {
		return err
	}

	for i0 := 0; i0 < int(n0); i0++ {
		val1 := new(int32)
		if *val1, err = decoder.ReadInt(); err != nil {
			return err
		}
		*val0 = append(*val0, *val1)
	}
	if len(*val0) != int(n0) {
		return fmt.Errorf("bad multi size %d != %d", n0, len(*val0))
	}
	return
}
开发者ID:tamtam-im,项目名称:teleport,代码行数:28,代码来源:box_rpc_result_test.go

示例4: Read

func (t *RpcResult) Read(decoder tl.Decoder, waitress tl.Waitress, session uuid.UUID) (err error) {
	t.ReqMsgId, err = decoder.ReadLong()
	if err != nil {
		return
	}

	var res_err, err_err error
	// try to get bare constructor from waitress
	// track to res_err
	if cons_id, _, _, res_err := waitress.GetResult(session, t.ReqMsgId); res_err == nil {
		result_box := &ObjectBox{}
		if res_err = result_box.Bind(cons_id); res_err == nil {
			t.Result, res_err = result_box.Bare()
		}
	}

	// Check for error
	if peek_cons_id, err_err := decoder.PeekType(); err_err == nil && peek_cons_id == TL_ID_RPC_ERROR {
		// got err - read it and return
		err_box := (&RpcError{}).Box()
		if err_err = err_box.Read(decoder, waitress, session); err_err == nil {
			if err_bare, err_err := err_box.Bare(); err_err == nil {
				t.RpcError = err_bare.(*RpcError)
			}
		}
	}
	if res_err == nil && err_err == nil && t.RpcError == nil {
		res_err = t.Result.Read(decoder, waitress, session)
	}
	// return one of res_err or err_err
	if res_err != nil {
		err = res_err
	} else if err_err != nil {
		err = err_err
	}

	return
}
开发者ID:tamtam-im,项目名称:teleport,代码行数:38,代码来源:box_rpc_result.go

示例5: Read

func (t *Double) Read(decoder tl.Decoder, waitress tl.Waitress, bind_uuid uuid.UUID) (err error) {
	t.value, err = decoder.ReadDouble()
	return
}
开发者ID:tamtam-im,项目名称:teleport,代码行数:4,代码来源:box_double.go

示例6: Read

func (t *Bytes) Read(decoder tl.Decoder, waitress tl.Waitress, bind_uuid uuid.UUID) (err error) {
	t.value, err = decoder.ReadBytes()
	return
}
开发者ID:tamtam-im,项目名称:teleport,代码行数:4,代码来源:box_bytes.go

示例7: Read

func (t *String) Read(decoder tl.Decoder, waitress tl.Waitress, bind_uuid uuid.UUID) (err error) {
	t.value, err = decoder.ReadString()
	return
}
开发者ID:tamtam-im,项目名称:teleport,代码行数:4,代码来源:box_string.go


注:本文中的github.com/tamtam-im/teleport/lib/go/tl.Decoder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。