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


Golang sortkeys.Strings函數代碼示例

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


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

示例1: String

func (this *MapStruct) String() string {
	if this == nil {
		return "nil"
	}
	keysForNullableMap := make([]string, 0, len(this.NullableMap))
	for k, _ := range this.NullableMap {
		keysForNullableMap = append(keysForNullableMap, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForNullableMap)
	mapStringForNullableMap := "map[string]*BasicScalar{"
	for _, k := range keysForNullableMap {
		mapStringForNullableMap += fmt.Sprintf("%v: %v,", k, this.NullableMap[k])
	}
	mapStringForNullableMap += "}"
	keysForNonnullableMap := make([]string, 0, len(this.NonnullableMap))
	for k, _ := range this.NonnullableMap {
		keysForNonnullableMap = append(keysForNonnullableMap, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForNonnullableMap)
	mapStringForNonnullableMap := "map[string]BasicScalar{"
	for _, k := range keysForNonnullableMap {
		mapStringForNonnullableMap += fmt.Sprintf("%v: %v,", k, this.NonnullableMap[k])
	}
	mapStringForNonnullableMap += "}"
	s := strings.Join([]string{`&MapStruct{`,
		`NullableMap:` + mapStringForNullableMap + `,`,
		`NonnullableMap:` + mapStringForNonnullableMap + `,`,
		`}`,
	}, "")
	return s
}
開發者ID:docker,項目名稱:swarmkit,代碼行數:31,代碼來源:deepcopy.pb.go

示例2: GoString

func (this *TNode) GoString() string {
	if this == nil {
		return "nil"
	}
	s := make([]string, 0, 7)
	s = append(s, "&index.TNode{")
	if this.Node != nil {
		s = append(s, "Node: "+fmt.Sprintf("%#v", this.Node)+",\n")
	}
	keysForChildren := make([]string, 0, len(this.Children))
	for k, _ := range this.Children {
		keysForChildren = append(keysForChildren, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForChildren)
	mapStringForChildren := "map[string]*TNode{"
	for _, k := range keysForChildren {
		mapStringForChildren += fmt.Sprintf("%#v: %#v,", k, this.Children[k])
	}
	mapStringForChildren += "}"
	if this.Children != nil {
		s = append(s, "Children: "+mapStringForChildren+",\n")
	}
	s = append(s, "Mutex: "+fmt.Sprintf("%#v", this.Mutex)+",\n")
	s = append(s, "}")
	return strings.Join(s, "")
}
開發者ID:kadirahq,項目名稱:kadiyadb,代碼行數:26,代碼來源:protocol.pb.go

示例3: MarshalTo

func (m *ProtoRoutes) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.Routes) > 0 {
		keysForRoutes := make([]string, 0, len(m.Routes))
		for k, _ := range m.Routes {
			keysForRoutes = append(keysForRoutes, k)
		}
		github_com_gogo_protobuf_sortkeys.Strings(keysForRoutes)
		for _, k := range keysForRoutes {
			data[i] = 0xa
			i++
			v := m.Routes[k]
			mapSize := 1 + len(k) + sovDesiredLrp(uint64(len(k))) + 1 + len(v) + sovDesiredLrp(uint64(len(v)))
			i = encodeVarintDesiredLrp(data, i, uint64(mapSize))
			data[i] = 0xa
			i++
			i = encodeVarintDesiredLrp(data, i, uint64(len(k)))
			i += copy(data[i:], k)
			data[i] = 0x12
			i++
			i = encodeVarintDesiredLrp(data, i, uint64(len(v)))
			i += copy(data[i:], v)
		}
	}
	return i, nil
}
開發者ID:davidwadden,項目名稱:lattice-release,代碼行數:29,代碼來源:desired_lrp.pb.go

示例4: String

func (this *SQSMessagePayload) String() string {
	if this == nil {
		return "nil"
	}
	keysForUserAttributes := make([]string, 0, len(this.UserAttributes))
	for k, _ := range this.UserAttributes {
		keysForUserAttributes = append(keysForUserAttributes, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForUserAttributes)
	mapStringForUserAttributes := "map[string]*UserAttribute{"
	for _, k := range keysForUserAttributes {
		mapStringForUserAttributes += fmt.Sprintf("%v: %v,", k, this.UserAttributes[k])
	}
	mapStringForUserAttributes += "}"
	s := strings.Join([]string{`&SQSMessagePayload{`,
		`Payload:` + fmt.Sprintf("%v", this.Payload) + `,`,
		`MD5OfMessageBody:` + fmt.Sprintf("%v", this.MD5OfMessageBody) + `,`,
		`MD5OfMessageAttributes:` + fmt.Sprintf("%v", this.MD5OfMessageAttributes) + `,`,
		`SenderId:` + fmt.Sprintf("%v", this.SenderId) + `,`,
		`SentTimestamp:` + fmt.Sprintf("%v", this.SentTimestamp) + `,`,
		`UserAttributes:` + mapStringForUserAttributes + `,`,
		`}`,
	}, "")
	return s
}
開發者ID:vburenin,項目名稱:firempq,代碼行數:25,代碼來源:sqspayload.pb.go

示例5: GoString

func (this *SQSMessagePayload) GoString() string {
	if this == nil {
		return "nil"
	}
	s := make([]string, 0, 10)
	s = append(s, "&sqsmsg.SQSMessagePayload{")
	s = append(s, "Payload: "+fmt.Sprintf("%#v", this.Payload)+",\n")
	s = append(s, "MD5OfMessageBody: "+fmt.Sprintf("%#v", this.MD5OfMessageBody)+",\n")
	s = append(s, "MD5OfMessageAttributes: "+fmt.Sprintf("%#v", this.MD5OfMessageAttributes)+",\n")
	s = append(s, "SenderId: "+fmt.Sprintf("%#v", this.SenderId)+",\n")
	s = append(s, "SentTimestamp: "+fmt.Sprintf("%#v", this.SentTimestamp)+",\n")
	keysForUserAttributes := make([]string, 0, len(this.UserAttributes))
	for k, _ := range this.UserAttributes {
		keysForUserAttributes = append(keysForUserAttributes, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForUserAttributes)
	mapStringForUserAttributes := "map[string]*UserAttribute{"
	for _, k := range keysForUserAttributes {
		mapStringForUserAttributes += fmt.Sprintf("%#v: %#v,", k, this.UserAttributes[k])
	}
	mapStringForUserAttributes += "}"
	if this.UserAttributes != nil {
		s = append(s, "UserAttributes: "+mapStringForUserAttributes+",\n")
	}
	s = append(s, "}")
	return strings.Join(s, "")
}
開發者ID:vburenin,項目名稱:firempq,代碼行數:27,代碼來源:sqspayload.pb.go

示例6: MarshalTo

func (m *TNode) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Node != nil {
		data[i] = 0xa
		i++
		i = encodeVarintProtocol(data, i, uint64(m.Node.Size()))
		n1, err := m.Node.MarshalTo(data[i:])
		if err != nil {
			return 0, err
		}
		i += n1
	}
	if len(m.Children) > 0 {
		keysForChildren := make([]string, 0, len(m.Children))
		for k, _ := range m.Children {
			keysForChildren = append(keysForChildren, k)
		}
		github_com_gogo_protobuf_sortkeys.Strings(keysForChildren)
		for _, k := range keysForChildren {
			data[i] = 0x12
			i++
			v := m.Children[k]
			if v == nil {
				return 0, errors.New("proto: map has nil element")
			}
			msgSize := v.Size()
			mapSize := 1 + len(k) + sovProtocol(uint64(len(k))) + 1 + msgSize + sovProtocol(uint64(msgSize))
			i = encodeVarintProtocol(data, i, uint64(mapSize))
			data[i] = 0xa
			i++
			i = encodeVarintProtocol(data, i, uint64(len(k)))
			i += copy(data[i:], k)
			data[i] = 0x12
			i++
			i = encodeVarintProtocol(data, i, uint64(v.Size()))
			n2, err := v.MarshalTo(data[i:])
			if err != nil {
				return 0, err
			}
			i += n2
		}
	}
	data[i] = 0x1a
	i++
	i = encodeVarintProtocol(data, i, uint64(m.Mutex.Size()))
	n3, err := m.Mutex.MarshalTo(data[i:])
	if err != nil {
		return 0, err
	}
	i += n3
	return i, nil
}
開發者ID:kadirahq,項目名稱:kadiyadb,代碼行數:55,代碼來源:protocol.pb.go

示例7: GoString

func (this *Topic) GoString() string {
	if this == nil {
		return "nil"
	}
	s := make([]string, 0, 13)
	s = append(s, "&dbdata.Topic{")
	s = append(s, "Arn: "+fmt.Sprintf("%#v", this.Arn)+",\n")
	s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n")
	s = append(s, "DisplayName: "+fmt.Sprintf("%#v", this.DisplayName)+",\n")
	s = append(s, "Policy: "+fmt.Sprintf("%#v", this.Policy)+",\n")
	s = append(s, "DeliveryPolicy: "+fmt.Sprintf("%#v", this.DeliveryPolicy)+",\n")
	s = append(s, "EffectiveDeliveryPolicy: "+fmt.Sprintf("%#v", this.EffectiveDeliveryPolicy)+",\n")
	s = append(s, "DeletedSubscriptions: "+fmt.Sprintf("%#v", this.DeletedSubscriptions)+",\n")
	keysForSqsSubscriptions := make([]string, 0, len(this.SqsSubscriptions))
	for k, _ := range this.SqsSubscriptions {
		keysForSqsSubscriptions = append(keysForSqsSubscriptions, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForSqsSubscriptions)
	mapStringForSqsSubscriptions := "map[string]*Subscription{"
	for _, k := range keysForSqsSubscriptions {
		mapStringForSqsSubscriptions += fmt.Sprintf("%#v: %#v,", k, this.SqsSubscriptions[k])
	}
	mapStringForSqsSubscriptions += "}"
	if this.SqsSubscriptions != nil {
		s = append(s, "SqsSubscriptions: "+mapStringForSqsSubscriptions+",\n")
	}
	keysForOtherSubscriptions := make([]string, 0, len(this.OtherSubscriptions))
	for k, _ := range this.OtherSubscriptions {
		keysForOtherSubscriptions = append(keysForOtherSubscriptions, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForOtherSubscriptions)
	mapStringForOtherSubscriptions := "map[string]*Subscription{"
	for _, k := range keysForOtherSubscriptions {
		mapStringForOtherSubscriptions += fmt.Sprintf("%#v: %#v,", k, this.OtherSubscriptions[k])
	}
	mapStringForOtherSubscriptions += "}"
	if this.OtherSubscriptions != nil {
		s = append(s, "OtherSubscriptions: "+mapStringForOtherSubscriptions+",\n")
	}
	s = append(s, "}")
	return strings.Join(s, "")
}
開發者ID:vburenin,項目名稱:firempq,代碼行數:42,代碼來源:topic_data.pb.go

示例8: String

func (this *Topic) String() string {
	if this == nil {
		return "nil"
	}
	keysForSqsSubscriptions := make([]string, 0, len(this.SqsSubscriptions))
	for k, _ := range this.SqsSubscriptions {
		keysForSqsSubscriptions = append(keysForSqsSubscriptions, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForSqsSubscriptions)
	mapStringForSqsSubscriptions := "map[string]*Subscription{"
	for _, k := range keysForSqsSubscriptions {
		mapStringForSqsSubscriptions += fmt.Sprintf("%v: %v,", k, this.SqsSubscriptions[k])
	}
	mapStringForSqsSubscriptions += "}"
	keysForOtherSubscriptions := make([]string, 0, len(this.OtherSubscriptions))
	for k, _ := range this.OtherSubscriptions {
		keysForOtherSubscriptions = append(keysForOtherSubscriptions, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForOtherSubscriptions)
	mapStringForOtherSubscriptions := "map[string]*Subscription{"
	for _, k := range keysForOtherSubscriptions {
		mapStringForOtherSubscriptions += fmt.Sprintf("%v: %v,", k, this.OtherSubscriptions[k])
	}
	mapStringForOtherSubscriptions += "}"
	s := strings.Join([]string{`&Topic{`,
		`Arn:` + fmt.Sprintf("%v", this.Arn) + `,`,
		`Name:` + fmt.Sprintf("%v", this.Name) + `,`,
		`DisplayName:` + fmt.Sprintf("%v", this.DisplayName) + `,`,
		`Policy:` + fmt.Sprintf("%v", this.Policy) + `,`,
		`DeliveryPolicy:` + fmt.Sprintf("%v", this.DeliveryPolicy) + `,`,
		`EffectiveDeliveryPolicy:` + fmt.Sprintf("%v", this.EffectiveDeliveryPolicy) + `,`,
		`DeletedSubscriptions:` + fmt.Sprintf("%v", this.DeletedSubscriptions) + `,`,
		`SqsSubscriptions:` + mapStringForSqsSubscriptions + `,`,
		`OtherSubscriptions:` + mapStringForOtherSubscriptions + `,`,
		`}`,
	}, "")
	return s
}
開發者ID:vburenin,項目名稱:firempq,代碼行數:38,代碼來源:topic_data.pb.go

示例9: MarshalTo

func (m *SpanContextCarrier) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.TraceID != 0 {
		data[i] = 0x8
		i++
		i = encodeVarintSpanContextCarrier(data, i, uint64(m.TraceID))
	}
	if m.SpanID != 0 {
		data[i] = 0x10
		i++
		i = encodeVarintSpanContextCarrier(data, i, uint64(m.SpanID))
	}
	if m.Sampled {
		data[i] = 0x18
		i++
		if m.Sampled {
			data[i] = 1
		} else {
			data[i] = 0
		}
		i++
	}
	if len(m.Baggage) > 0 {
		keysForBaggage := make([]string, 0, len(m.Baggage))
		for k := range m.Baggage {
			keysForBaggage = append(keysForBaggage, string(k))
		}
		github_com_gogo_protobuf_sortkeys.Strings(keysForBaggage)
		for _, k := range keysForBaggage {
			data[i] = 0x22
			i++
			v := m.Baggage[string(k)]
			mapSize := 1 + len(k) + sovSpanContextCarrier(uint64(len(k))) + 1 + len(v) + sovSpanContextCarrier(uint64(len(v)))
			i = encodeVarintSpanContextCarrier(data, i, uint64(mapSize))
			data[i] = 0xa
			i++
			i = encodeVarintSpanContextCarrier(data, i, uint64(len(k)))
			i += copy(data[i:], k)
			data[i] = 0x12
			i++
			i = encodeVarintSpanContextCarrier(data, i, uint64(len(v)))
			i += copy(data[i:], v)
		}
	}
	return i, nil
}
開發者ID:knz,項目名稱:cockroach,代碼行數:49,代碼來源:span_context_carrier.pb.go

示例10: GoString

func (this *ProtoRoutes) GoString() string {
	if this == nil {
		return "nil"
	}
	keysForRoutes := make([]string, 0, len(this.Routes))
	for k, _ := range this.Routes {
		keysForRoutes = append(keysForRoutes, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForRoutes)
	mapStringForRoutes := "map[string][]byte{"
	for _, k := range keysForRoutes {
		mapStringForRoutes += fmt.Sprintf("%#v: %#v,", k, this.Routes[k])
	}
	mapStringForRoutes += "}"
	s := strings.Join([]string{`&models.ProtoRoutes{` +
		`Routes:` + mapStringForRoutes + `}`}, ", ")
	return s
}
開發者ID:davidwadden,項目名稱:lattice-release,代碼行數:18,代碼來源:desired_lrp.pb.go

示例11: String

func (this *SnapInfo) String() string {
	if this == nil {
		return "nil"
	}
	keysForBranches := make([]string, 0, len(this.Branches))
	for k, _ := range this.Branches {
		keysForBranches = append(keysForBranches, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForBranches)
	mapStringForBranches := "map[string]*Offset{"
	for _, k := range keysForBranches {
		mapStringForBranches += fmt.Sprintf("%v: %v,", k, this.Branches[k])
	}
	mapStringForBranches += "}"
	s := strings.Join([]string{`&SnapInfo{`,
		`Branches:` + mapStringForBranches + `,`,
		`}`,
	}, "")
	return s
}
開發者ID:kadirahq,項目名稱:kadiyadb,代碼行數:20,代碼來源:protocol.pb.go

示例12: String

func (this *Network) String() string {
	if this == nil {
		return "nil"
	}
	keysForProperties := make([]string, 0, len(this.Properties))
	for k, _ := range this.Properties {
		keysForProperties = append(keysForProperties, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForProperties)
	mapStringForProperties := "map[string]string{"
	for _, k := range keysForProperties {
		mapStringForProperties += fmt.Sprintf("%v: %v,", k, this.Properties[k])
	}
	mapStringForProperties += "}"
	s := strings.Join([]string{`&Network{`,
		`Properties:` + mapStringForProperties + `,`,
		`}`,
	}, "")
	return s
}
開發者ID:cloudfoundry,項目名稱:bbs,代碼行數:20,代碼來源:network.pb.go

示例13: String

func (this *Struct) String() string {
	if this == nil {
		return "nil"
	}
	keysForFields := make([]string, 0, len(this.Fields))
	for k := range this.Fields {
		keysForFields = append(keysForFields, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForFields)
	mapStringForFields := "map[string]*Value{"
	for _, k := range keysForFields {
		mapStringForFields += fmt.Sprintf("%v: %v,", k, this.Fields[k])
	}
	mapStringForFields += "}"
	s := strings.Join([]string{`&Struct{`,
		`Fields:` + mapStringForFields + `,`,
		`}`,
	}, "")
	return s
}
開發者ID:pascaldekloe,項目名稱:colfer,代碼行數:20,代碼來源:struct.pb.go

示例14: String

func (this *LabelSelector) String() string {
	if this == nil {
		return "nil"
	}
	keysForMatchLabels := make([]string, 0, len(this.MatchLabels))
	for k := range this.MatchLabels {
		keysForMatchLabels = append(keysForMatchLabels, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForMatchLabels)
	mapStringForMatchLabels := "map[string]string{"
	for _, k := range keysForMatchLabels {
		mapStringForMatchLabels += fmt.Sprintf("%v: %v,", k, this.MatchLabels[k])
	}
	mapStringForMatchLabels += "}"
	s := strings.Join([]string{`&LabelSelector{`,
		`MatchLabels:` + mapStringForMatchLabels + `,`,
		`MatchExpressions:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.MatchExpressions), "LabelSelectorRequirement", "LabelSelectorRequirement", 1), `&`, ``, 1) + `,`,
		`}`,
	}, "")
	return s
}
開發者ID:CodeJuan,項目名稱:kubernetes,代碼行數:21,代碼來源:generated.pb.go

示例15: String

func (this *ClusterResourceQuotaSelector) String() string {
	if this == nil {
		return "nil"
	}
	keysForAnnotationSelector := make([]string, 0, len(this.AnnotationSelector))
	for k := range this.AnnotationSelector {
		keysForAnnotationSelector = append(keysForAnnotationSelector, k)
	}
	github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotationSelector)
	mapStringForAnnotationSelector := "map[string]string{"
	for _, k := range keysForAnnotationSelector {
		mapStringForAnnotationSelector += fmt.Sprintf("%v: %v,", k, this.AnnotationSelector[k])
	}
	mapStringForAnnotationSelector += "}"
	s := strings.Join([]string{`&ClusterResourceQuotaSelector{`,
		`LabelSelector:` + strings.Replace(fmt.Sprintf("%v", this.LabelSelector), "LabelSelector", "k8s_io_kubernetes_pkg_api_unversioned.LabelSelector", 1) + `,`,
		`AnnotationSelector:` + mapStringForAnnotationSelector + `,`,
		`}`,
	}, "")
	return s
}
開發者ID:juanluisvaladas,項目名稱:origin,代碼行數:21,代碼來源:generated.pb.go


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