當前位置: 首頁>>代碼示例>>Golang>>正文


Golang thrift.TProtocol類代碼示例

本文整理匯總了Golang中github.com/sipin/gothrift/thrift.TProtocol的典型用法代碼示例。如果您正苦於以下問題:Golang TProtocol類的具體用法?Golang TProtocol怎麽用?Golang TProtocol使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TProtocol類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Read

func (p *UserGroup) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return fmt.Errorf("%T read error: %s", p, err)
	}
	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		case 2:
			if err := p.readField2(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return fmt.Errorf("%T read struct end error: %s", p, err)
	}
	return nil
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:35,代碼來源:gen_usergroup.go

示例2: readField13

func (p *User) readField13(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return fmt.Errorf("error reading field 13: %s", err)
	} else {
		p.OrganizationID = v
	}
	return nil
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:8,代碼來源:gen_user.go

示例3: readField14

func (p *User) readField14(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return fmt.Errorf("error reading field 14: %s", err)
	} else {
		p.Gender = v
	}
	return nil
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:8,代碼來源:gen_user.go

示例4: readField1

func (p *UserGroup) readField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return fmt.Errorf("error reading field 1: %s", err)
	} else {
		p.ID = bson.ObjectId(v)
	}
	return nil
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:8,代碼來源:gen_usergroup.go

示例5: readField2

func (p *UserGroup) readField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return fmt.Errorf("error reading field 2: %s", err)
	} else {
		p.Name = v
	}
	return nil
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:8,代碼來源:gen_usergroup.go

示例6: readField9

func (p *User) readField9(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return fmt.Errorf("error reading field 9: %s", err)
	} else {
		p.IsAdmin = v
	}
	return nil
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:8,代碼來源:gen_user.go

示例7: readField15

func (p *User) readField15(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return fmt.Errorf("error reading field 15: %s", err)
	} else {
		p.Index = v
	}
	return nil
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:8,代碼來源:gen_user.go

示例8: Write

func (p *User) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("User"); err != nil {
		return fmt.Errorf("%T write struct begin error: %s", p, err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := p.writeField2(oprot); err != nil {
		return err
	}
	if err := p.writeField3(oprot); err != nil {
		return err
	}
	if err := p.writeField4(oprot); err != nil {
		return err
	}
	if err := p.writeField5(oprot); err != nil {
		return err
	}
	if err := p.writeField6(oprot); err != nil {
		return err
	}
	if err := p.writeField7(oprot); err != nil {
		return err
	}
	if err := p.writeField8(oprot); err != nil {
		return err
	}
	if err := p.writeField9(oprot); err != nil {
		return err
	}
	if err := p.writeField10(oprot); err != nil {
		return err
	}
	if err := p.writeField11(oprot); err != nil {
		return err
	}
	if err := p.writeField12(oprot); err != nil {
		return err
	}
	if err := p.writeField13(oprot); err != nil {
		return err
	}
	if err := p.writeField14(oprot); err != nil {
		return err
	}
	if err := p.writeField15(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return fmt.Errorf("write field stop error: %s", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return fmt.Errorf("write struct stop error: %s", err)
	}
	return nil
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:57,代碼來源:gen_user.go

示例9: writeField2

func (p *UserGroup) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Name", thrift.STRING, 2); err != nil {
		return fmt.Errorf("%T write field begin error 2:Name: %s", p, err)
	}
	if err := oprot.WriteString(string(p.Name)); err != nil {
		return fmt.Errorf("%T.Name (2) field write error: %s", p, err)
	}

	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 2:Name: %s", p, err)
	}
	return err
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:13,代碼來源:gen_usergroup.go

示例10: writeField15

func (p *User) writeField15(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Index", thrift.I32, 15); err != nil {
		return fmt.Errorf("%T write field begin error 15:Index: %s", p, err)
	}
	if err := oprot.WriteI32(int32(p.Index)); err != nil {
		return fmt.Errorf("%T.Index (15) field write error: %s", p, err)
	}

	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 15:Index: %s", p, err)
	}
	return err
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:13,代碼來源:gen_user.go

示例11: writeField14

func (p *User) writeField14(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Gender", thrift.STRING, 14); err != nil {
		return fmt.Errorf("%T write field begin error 14:Gender: %s", p, err)
	}
	if err := oprot.WriteString(string(p.Gender)); err != nil {
		return fmt.Errorf("%T.Gender (14) field write error: %s", p, err)
	}

	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 14:Gender: %s", p, err)
	}
	return err
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:13,代碼來源:gen_user.go

示例12: writeField5

func (p *User) writeField5(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Email", thrift.STRING, 5); err != nil {
		return fmt.Errorf("%T write field begin error 5:Email: %s", p, err)
	}
	if err := oprot.WriteString(string(p.Email)); err != nil {
		return fmt.Errorf("%T.Email (5) field write error: %s", p, err)
	}

	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 5:Email: %s", p, err)
	}
	return err
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:13,代碼來源:gen_user.go

示例13: writeField13

func (p *User) writeField13(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("OrganizationID", thrift.STRING, 13); err != nil {
		return fmt.Errorf("%T write field begin error 13:OrganizationID: %s", p, err)
	}
	if err := oprot.WriteString(string(p.OrganizationID)); err != nil {
		return fmt.Errorf("%T.OrganizationID (13) field write error: %s", p, err)
	}

	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 13:OrganizationID: %s", p, err)
	}
	return err
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:13,代碼來源:gen_user.go

示例14: writeField6

func (p *User) writeField6(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("Intro", thrift.STRING, 6); err != nil {
		return fmt.Errorf("%T write field begin error 6:Intro: %s", p, err)
	}
	if err := oprot.WriteString(string(p.Intro)); err != nil {
		return fmt.Errorf("%T.Intro (6) field write error: %s", p, err)
	}

	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 6:Intro: %s", p, err)
	}
	return err
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:13,代碼來源:gen_user.go

示例15: writeField12

func (p *User) writeField12(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("PubInfoID", thrift.STRING, 12); err != nil {
		return fmt.Errorf("%T write field begin error 12:PubInfoID: %s", p, err)
	}
	if err := oprot.WriteString(string(p.PubInfoID)); err != nil {
		return fmt.Errorf("%T.PubInfoID (12) field write error: %s", p, err)
	}

	if err := oprot.WriteFieldEnd(); err != nil {
		return fmt.Errorf("%T write field end error 12:PubInfoID: %s", p, err)
	}
	return err
}
開發者ID:qiandashuai,項目名稱:xuanwu,代碼行數:13,代碼來源:gen_user.go


注:本文中的github.com/sipin/gothrift/thrift.TProtocol類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。