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


Golang msgp.AppendString函數代碼示例

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


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

示例1: MarshalMsg

// MarshalMsg implements msgp.Marshaler
func (z *ServerResponse) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// array header, size 3
	o = append(o, 0x93)
	if z.Header == nil {
		o = msgp.AppendNil(o)
	} else {
		// map header, size 3
		// string "message_id"
		o = append(o, 0x83, 0xaa, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64)
		o = msgp.AppendString(o, z.Header.Id)
		// string "v"
		o = append(o, 0xa1, 0x76)
		o = msgp.AppendInt(o, z.Header.Version)
		// string "response_to"
		o = append(o, 0xab, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x74, 0x6f)
		o = msgp.AppendString(o, z.Header.ResponseTo)
	}
	o = msgp.AppendString(o, z.Name)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Params)))
	for bzg := range z.Params {
		o, err = msgp.AppendIntf(o, z.Params[bzg])
		if err != nil {
			return
		}
	}
	return
}
開發者ID:mengzhuo,項目名稱:zerorpc-golang,代碼行數:29,代碼來源:protocal_gen.go

示例2: MarshalMsg

// MarshalMsg implements msgp.Marshaler
func (z *SchemaT) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 5
	// string "PkgPath"
	o = append(o, 0x85, 0xa7, 0x50, 0x6b, 0x67, 0x50, 0x61, 0x74, 0x68)
	o = msgp.AppendString(o, z.PkgPath)
	// string "Structs"
	o = append(o, 0xa7, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x73)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Structs)))
	for zrsw := range z.Structs {
		o, err = z.Structs[zrsw].MarshalMsg(o)
		if err != nil {
			return
		}
	}
	// string "Interfaces"
	o = append(o, 0xaa, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Interfaces)))
	for zxpk := range z.Interfaces {
		o, err = z.Interfaces[zxpk].MarshalMsg(o)
		if err != nil {
			return
		}
	}
	// string "Deprecated"
	o = append(o, 0xaa, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64)
	o = msgp.AppendBool(o, z.Deprecated)
	// string "Comment"
	o = append(o, 0xa7, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74)
	o = msgp.AppendString(o, z.Comment)
	return
}
開發者ID:glycerine,項目名稱:zebra,代碼行數:33,代碼來源:zebra_gen.go

示例3: MarshalMsg

// MarshalMsg implements msgp.Marshaler
func (z *CacheRegistry) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 6
	// string "CacheKey"
	o = append(o, 0x86, 0xa8, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4b, 0x65, 0x79)
	o = msgp.AppendString(o, z.CacheKey)
	// string "Payload"
	o = append(o, 0xa7, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64)
	o, err = msgp.AppendIntf(o, z.Payload)
	if err != nil {
		return
	}
	// string "StoreTTL"
	o = append(o, 0xa8, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x54, 0x54, 0x4c)
	o = msgp.AppendFloat64(o, z.StoreTTL)
	// string "CacheTime"
	o = append(o, 0xa9, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x69, 0x6d, 0x65)
	o = msgp.AppendTime(o, z.CacheTime)
	// string "HasValue"
	o = append(o, 0xa8, 0x48, 0x61, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65)
	o = msgp.AppendBool(o, z.HasValue)
	// string "TypeName"
	o = append(o, 0xa8, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65)
	o = msgp.AppendString(o, z.TypeName)
	return
}
開發者ID:darciopacifico,項目名稱:enablecache,代碼行數:27,代碼來源:manager_gen.go

示例4: MarshalMsg

// MarshalMsg implements msgp.Marshaler
func (z *MetricData) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 9
	// string "OrgId"
	o = append(o, 0x89, 0xa5, 0x4f, 0x72, 0x67, 0x49, 0x64)
	o = msgp.AppendInt(o, z.OrgId)
	// string "Name"
	o = append(o, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
	o = msgp.AppendString(o, z.Name)
	// string "Metric"
	o = append(o, 0xa6, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63)
	o = msgp.AppendString(o, z.Metric)
	// string "Interval"
	o = append(o, 0xa8, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c)
	o = msgp.AppendInt(o, z.Interval)
	// string "Value"
	o = append(o, 0xa5, 0x56, 0x61, 0x6c, 0x75, 0x65)
	o = msgp.AppendFloat64(o, z.Value)
	// string "Unit"
	o = append(o, 0xa4, 0x55, 0x6e, 0x69, 0x74)
	o = msgp.AppendString(o, z.Unit)
	// string "Time"
	o = append(o, 0xa4, 0x54, 0x69, 0x6d, 0x65)
	o = msgp.AppendInt64(o, z.Time)
	// string "TargetType"
	o = append(o, 0xaa, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65)
	o = msgp.AppendString(o, z.TargetType)
	// string "Tags"
	o = append(o, 0xa4, 0x54, 0x61, 0x67, 0x73)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Tags)))
	for xvk := range z.Tags {
		o = msgp.AppendString(o, z.Tags[xvk])
	}
	return
}
開發者ID:aglagla,項目名稱:raintank-metric,代碼行數:36,代碼來源:metric_gen.go

示例5: MarshalMsg

// MarshalMsg implements msgp.Marshaler
func (z *Message) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 5
	// string "id"
	o = append(o, 0x85, 0xa2, 0x69, 0x64)
	o = msgp.AppendUint64(o, z.ID)
	// string "fn"
	o = append(o, 0xa2, 0x66, 0x6e)
	o = msgp.AppendString(o, z.Func)
	// string "args"
	o = append(o, 0xa4, 0x61, 0x72, 0x67, 0x73)
	o, err = z.Args.MarshalMsg(o)
	if err != nil {
		return
	}
	// string "result"
	o = append(o, 0xa6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74)
	o, err = z.Result.MarshalMsg(o)
	if err != nil {
		return
	}
	// string "error"
	o = append(o, 0xa5, 0x65, 0x72, 0x72, 0x6f, 0x72)
	if z.Error == nil {
		o = msgp.AppendNil(o)
	} else {
		// map header, size 1
		// string "msg"
		o = append(o, 0x81, 0xa3, 0x6d, 0x73, 0x67)
		o = msgp.AppendString(o, z.Error.Msg)
	}
	return
}
開發者ID:sztanpet,項目名稱:bimpc,代碼行數:34,代碼來源:mpc_gen.go

示例6: MarshalMsg

// MarshalMsg implements msgp.Marshaler
func (z *Event) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 4
	// string "id"
	o = append(o, 0x84, 0xa2, 0x69, 0x64)
	o = msgp.AppendInt(o, z.Id)
	// string "user"
	// map header, size 2
	// string "first"
	o = append(o, 0xa4, 0x75, 0x73, 0x65, 0x72, 0x82, 0xa5, 0x66, 0x69, 0x72, 0x73, 0x74)
	o = msgp.AppendString(o, z.User.First)
	// string "last"
	o = append(o, 0xa4, 0x6c, 0x61, 0x73, 0x74)
	o = msgp.AppendString(o, z.User.Last)
	// string "flight"
	o = append(o, 0xa6, 0x66, 0x6c, 0x69, 0x67, 0x68, 0x74)
	o = msgp.AppendString(o, z.Flight)
	// string "pilot"
	o = append(o, 0xa5, 0x70, 0x69, 0x6c, 0x6f, 0x74)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Pilot)))
	for xvk := range z.Pilot {
		o = msgp.AppendString(o, z.Pilot[xvk])
	}
	return
}
開發者ID:glycerine,項目名稱:zygomys,代碼行數:26,代碼來源:demo_go_structs_gen.go

示例7: pack

func (ps __red__pairs) pack() []byte {
	sort.Sort(ps)
	data := msgp.AppendArrayHeader([]byte{}, uint32(len(ps)))
	for _, p := range ps {
		data = msgp.AppendArrayHeader(data, 2)
		data = msgp.AppendString(data, p[0])
		data = msgp.AppendString(data, p[1])
	}

	return data
}
開發者ID:themakers,項目名稱:red-go,代碼行數:11,代碼來源:red.gen.go

示例8: MarshalMsg

// MarshalMsg implements msgp.Marshaler
func (z Incoming) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 2
	// string "from"
	o = append(o, 0x82, 0xa4, 0x66, 0x72, 0x6f, 0x6d)
	o = msgp.AppendString(o, z.From)
	// string "message"
	o = append(o, 0xa7, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65)
	o = msgp.AppendString(o, z.Message)
	return
}
開發者ID:sztanpet,項目名稱:bimpc,代碼行數:12,代碼來源:main_gen.go

示例9: MarshalMsg

// MarshalMsg implements msgp.Marshaler
func (z Attribute) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 3
	// string "Id"
	o = append(o, 0x83, 0xa2, 0x49, 0x64)
	o = msgp.AppendInt(o, z.Id)
	// string "Name"
	o = append(o, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
	o = msgp.AppendString(o, z.Name)
	// string "Value"
	o = append(o, 0xa5, 0x56, 0x61, 0x6c, 0x75, 0x65)
	o = msgp.AppendString(o, z.Value)
	return
}
開發者ID:darciopacifico,項目名稱:enablecache,代碼行數:15,代碼來源:schema_gen.go

示例10: gStruct

func (s *sizeGen) gStruct(st *Struct) {
	if !s.p.ok() {
		return
	}

	nfields := uint32(len(st.Fields))

	if st.AsTuple {
		data := msgp.AppendArrayHeader(nil, nfields)
		s.addConstant(strconv.Itoa(len(data)))
		for i := range st.Fields {
			if !s.p.ok() {
				return
			}
			next(s, st.Fields[i].FieldElem)
		}
	} else {
		data := msgp.AppendMapHeader(nil, nfields)
		s.addConstant(strconv.Itoa(len(data)))
		for i := range st.Fields {
			data = data[:0]
			data = msgp.AppendString(data, st.Fields[i].FieldTag)
			s.addConstant(strconv.Itoa(len(data)))
			next(s, st.Fields[i].FieldElem)
		}
	}
}
開發者ID:Congenital,項目名稱:msgp,代碼行數:27,代碼來源:size.go

示例11: Error

func (r *responseStream) Error(ctx context.Context, num uint64, code [2]int, msg string) error {
	r.Lock()
	defer r.Unlock()
	if r.closed {
		apexctx.GetLogger(r.ctx).WithError(errStreamIsClosed).Error("responseStream.Error")
		return errStreamIsClosed
	}
	defer r.close(ctx)

	p := msgpackBytePool.Get().([]byte)[:0]
	defer msgpackBytePool.Put(p)

	// NOTE: `3` without headers!
	p = msgp.AppendArrayHeader(p, 3)
	p = msgp.AppendUint64(p, r.channel)
	p = msgp.AppendUint64(p, num)

	// code_category + error message
	p = msgp.AppendArrayHeader(p, 2)

	// code & category
	p = msgp.AppendArrayHeader(p, 2)
	p = msgp.AppendInt(p, code[0])
	p = msgp.AppendInt(p, code[1])

	// error message
	p = msgp.AppendString(p, msg)

	if _, err := r.wr.Write(p); err != nil {
		apexctx.GetLogger(r.ctx).WithError(err).Errorf("responseStream.Error")
		return err
	}
	return nil
}
開發者ID:noxiouz,項目名稱:stout,代碼行數:34,代碼來源:conn_handler.go

示例12: fixedsizeExpr

// return a fixed-size expression, if possible.
// only possible for *BaseElem and *Array.
// returns (expr, ok)
func fixedsizeExpr(e Elem) (string, bool) {
	switch e := e.(type) {
	case *Array:
		if str, ok := fixedsizeExpr(e.Els); ok {
			return fmt.Sprintf("(%s * (%s))", e.Size, str), true
		}
	case *BaseElem:
		if fixedSize(e.Value) {
			return builtinSize(e.BaseName()), true
		}
	case *Struct:
		var str string
		for _, f := range e.Fields {
			if fs, ok := fixedsizeExpr(f.FieldElem); ok {
				if str == "" {
					str = fs
				} else {
					str += "+" + fs
				}
			} else {
				return "", false
			}
		}
		var hdrlen int
		mhdr := msgp.AppendMapHeader(nil, uint32(len(e.Fields)))
		hdrlen += len(mhdr)
		var strbody []byte
		for _, f := range e.Fields {
			strbody = msgp.AppendString(strbody[:0], f.FieldTag)
			hdrlen += len(strbody)
		}
		return fmt.Sprintf("%d + %s", hdrlen, str), true
	}
	return "", false
}
開發者ID:Congenital,項目名稱:msgp,代碼行數:38,代碼來源:size.go

示例13: MarshalMsg

// MarshalMsg implements msgp.Marshaler
func (z *ColorGroup) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 3
	// string "id"
	o = append(o, 0x83, 0xa2, 0x69, 0x64)
	o = msgp.AppendInt(o, z.Id)
	// string "name"
	o = append(o, 0xa4, 0x6e, 0x61, 0x6d, 0x65)
	o = msgp.AppendString(o, z.Name)
	// string "colors"
	o = append(o, 0xa6, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x73)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Colors)))
	for xvk := range z.Colors {
		o = msgp.AppendString(o, z.Colors[xvk])
	}
	return
}
開發者ID:jameswei,項目名稱:gosercomp,代碼行數:18,代碼來源:msgp_gen.go

示例14: MarshalMsg

// MarshalMsg implements msgp.Marshaler
func (z *ProbeEvent) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 8
	// string "Id"
	o = append(o, 0x88, 0xa2, 0x49, 0x64)
	o = msgp.AppendString(o, z.Id)
	// string "EventType"
	o = append(o, 0xa9, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65)
	o = msgp.AppendString(o, z.EventType)
	// string "OrgId"
	o = append(o, 0xa5, 0x4f, 0x72, 0x67, 0x49, 0x64)
	o = msgp.AppendInt64(o, z.OrgId)
	// string "Severity"
	o = append(o, 0xa8, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79)
	o = msgp.AppendString(o, z.Severity)
	// string "Source"
	o = append(o, 0xa6, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65)
	o = msgp.AppendString(o, z.Source)
	// string "Timestamp"
	o = append(o, 0xa9, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70)
	o = msgp.AppendInt64(o, z.Timestamp)
	// string "Message"
	o = append(o, 0xa7, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65)
	o = msgp.AppendString(o, z.Message)
	// string "Tags"
	o = append(o, 0xa4, 0x54, 0x61, 0x67, 0x73)
	o = msgp.AppendMapHeader(o, uint32(len(z.Tags)))
	for xvk, bzg := range z.Tags {
		o = msgp.AppendString(o, xvk)
		o = msgp.AppendString(o, bzg)
	}
	return
}
開發者ID:graphite-ng,項目名稱:carbon-relay-ng,代碼行數:34,代碼來源:event_gen.go

示例15: MarshalMsg

// MarshalMsg implements msgp.Marshaler
func (z *Event) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	o = msgp.AppendMapHeader(o, 5)
	o = msgp.AppendString(o, "host")
	o = msgp.AppendString(o, z.Host)
	o = msgp.AppendString(o, "service")
	o = msgp.AppendString(o, z.Service)
	o = msgp.AppendString(o, "sub_service")
	o = msgp.AppendString(o, z.SubService)
	o = msgp.AppendString(o, "metric")
	o = msgp.AppendFloat64(o, z.Metric)
	o = msgp.AppendString(o, "tags")
	o = msgp.AppendMapHeader(o, uint32(len(z.Tags)))
	for xvk, bzg := range z.Tags {
		o = msgp.AppendString(o, xvk)
		o = msgp.AppendString(o, bzg)
	}
	return
}
開發者ID:postfix,項目名稱:bangarang,代碼行數:20,代碼來源:event_gen.go


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