当前位置: 首页>>代码示例>>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;未经允许,请勿转载。