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


Golang proto.NewRequiredNotSetError函數代碼示例

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


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

示例1: MarshalTo

func (m *CounterEvent) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Name == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("name")
	} else {
		data[i] = 0xa
		i++
		i = encodeVarintMetric(data, i, uint64(len(*m.Name)))
		i += copy(data[i:], *m.Name)
	}
	if m.Delta == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("delta")
	} else {
		data[i] = 0x10
		i++
		i = encodeVarintMetric(data, i, uint64(*m.Delta))
	}
	if m.Total != nil {
		data[i] = 0x18
		i++
		i = encodeVarintMetric(data, i, uint64(*m.Total))
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:cwlbraa,項目名稱:cf-acceptance-tests,代碼行數:30,代碼來源:metric.pb.go

示例2: MarshalTo

func (m *Entry) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Name == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("name")
	} else {
		data[i] = 0xa
		i++
		i = encodeVarintState(data, i, uint64(len(*m.Name)))
		i += copy(data[i:], *m.Name)
	}
	if m.Uuid == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("uuid")
	} else {
		data[i] = 0x12
		i++
		i = encodeVarintState(data, i, uint64(len(m.Uuid)))
		i += copy(data[i:], m.Uuid)
	}
	if m.Value == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value")
	} else {
		data[i] = 0x1a
		i++
		i = encodeVarintState(data, i, uint64(len(m.Value)))
		i += copy(data[i:], m.Value)
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:waterytowers,項目名稱:global-hack-day-3,代碼行數:34,代碼來源:state.pb.go

示例3: MarshalTo

func (m *ServerInfoResponse) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Server == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("server")
	} else {
		data[i] = 0xa
		i++
		i = encodeVarintCarbonzipper(data, i, uint64(len(*m.Server)))
		i += copy(data[i:], *m.Server)
	}
	if m.Info == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("info")
	} else {
		data[i] = 0x12
		i++
		i = encodeVarintCarbonzipper(data, i, uint64(m.Info.Size()))
		n2, err := m.Info.MarshalTo(data[i:])
		if err != nil {
			return 0, err
		}
		i += n2
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:szibis,項目名稱:carbonzipper,代碼行數:30,代碼來源:carbonzipper.pb.go

示例4: MarshalTo

func (m *Error) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Source == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("source")
	} else {
		data[i] = 0xa
		i++
		i = encodeVarintError(data, i, uint64(len(*m.Source)))
		i += copy(data[i:], *m.Source)
	}
	if m.Code == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("code")
	} else {
		data[i] = 0x10
		i++
		i = encodeVarintError(data, i, uint64(*m.Code))
	}
	if m.Message == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("message")
	} else {
		data[i] = 0x1a
		i++
		i = encodeVarintError(data, i, uint64(len(*m.Message)))
		i += copy(data[i:], *m.Message)
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:Reejoshi,項目名稱:cli,代碼行數:33,代碼來源:error.pb.go

示例5: MarshalTo

func (m *ContainerMetric) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.ApplicationId == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("applicationId")
	} else {
		data[i] = 0xa
		i++
		i = encodeVarintMetric(data, i, uint64(len(*m.ApplicationId)))
		i += copy(data[i:], *m.ApplicationId)
	}
	if m.InstanceIndex == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("instanceIndex")
	} else {
		data[i] = 0x10
		i++
		i = encodeVarintMetric(data, i, uint64(*m.InstanceIndex))
	}
	if m.CpuPercentage == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("cpuPercentage")
	} else {
		data[i] = 0x19
		i++
		i = encodeFixed64Metric(data, i, uint64(math.Float64bits(float64(*m.CpuPercentage))))
	}
	if m.MemoryBytes == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("memoryBytes")
	} else {
		data[i] = 0x20
		i++
		i = encodeVarintMetric(data, i, uint64(*m.MemoryBytes))
	}
	if m.DiskBytes == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("diskBytes")
	} else {
		data[i] = 0x28
		i++
		i = encodeVarintMetric(data, i, uint64(*m.DiskBytes))
	}
	if m.MemoryBytesQuota != nil {
		data[i] = 0x30
		i++
		i = encodeVarintMetric(data, i, uint64(*m.MemoryBytesQuota))
	}
	if m.DiskBytesQuota != nil {
		data[i] = 0x38
		i++
		i = encodeVarintMetric(data, i, uint64(*m.DiskBytesQuota))
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:cloudfoundry,項目名稱:v3-cli-plugin,代碼行數:56,代碼來源:metric.pb.go

示例6: MarshalTo

func (m *ControlMessage) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Origin == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("origin")
	} else {
		data[i] = 0xa
		i++
		i = encodeVarintControlmessage(data, i, uint64(len(*m.Origin)))
		i += copy(data[i:], *m.Origin)
	}
	if m.Identifier == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("identifier")
	} else {
		data[i] = 0x12
		i++
		i = encodeVarintControlmessage(data, i, uint64(m.Identifier.Size()))
		n1, err := m.Identifier.MarshalTo(data[i:])
		if err != nil {
			return 0, err
		}
		i += n1
	}
	if m.Timestamp == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("timestamp")
	} else {
		data[i] = 0x18
		i++
		i = encodeVarintControlmessage(data, i, uint64(*m.Timestamp))
	}
	if m.ControlType == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("controlType")
	} else {
		data[i] = 0x20
		i++
		i = encodeVarintControlmessage(data, i, uint64(*m.ControlType))
	}
	if m.HeartbeatRequest != nil {
		data[i] = 0x2a
		i++
		i = encodeVarintControlmessage(data, i, uint64(m.HeartbeatRequest.Size()))
		n2, err := m.HeartbeatRequest.MarshalTo(data[i:])
		if err != nil {
			return 0, err
		}
		i += n2
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:trainchou,項目名稱:gorouter,代碼行數:54,代碼來源:controlmessage.pb.go

示例7: MarshalTo

func (m *LogMessage) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Message == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("message")
	} else {
		data[i] = 0xa
		i++
		i = encodeVarintLog(data, i, uint64(len(m.Message)))
		i += copy(data[i:], m.Message)
	}
	if m.MessageType == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("message_type")
	} else {
		data[i] = 0x10
		i++
		i = encodeVarintLog(data, i, uint64(*m.MessageType))
	}
	if m.Timestamp == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("timestamp")
	} else {
		data[i] = 0x18
		i++
		i = encodeVarintLog(data, i, uint64(*m.Timestamp))
	}
	if m.AppId != nil {
		data[i] = 0x22
		i++
		i = encodeVarintLog(data, i, uint64(len(*m.AppId)))
		i += copy(data[i:], *m.AppId)
	}
	if m.SourceType != nil {
		data[i] = 0x2a
		i++
		i = encodeVarintLog(data, i, uint64(len(*m.SourceType)))
		i += copy(data[i:], *m.SourceType)
	}
	if m.SourceInstance != nil {
		data[i] = 0x32
		i++
		i = encodeVarintLog(data, i, uint64(len(*m.SourceInstance)))
		i += copy(data[i:], *m.SourceInstance)
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:fujitsu-cf,項目名稱:cli,代碼行數:50,代碼來源:log.pb.go

示例8: MarshalTo

func (m *Message) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Header == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("header")
	} else {
		data[i] = 0xa
		i++
		i = encodeVarintApi(data, i, uint64(m.Header.Size()))
		n1, err := m.Header.MarshalTo(data[i:])
		if err != nil {
			return 0, err
		}
		i += n1
	}
	if len(m.Frames) > 0 {
		for _, msg := range m.Frames {
			data[i] = 0x12
			i++
			i = encodeVarintApi(data, i, uint64(msg.Size()))
			n, err := msg.MarshalTo(data[i:])
			if err != nil {
				return 0, err
			}
			i += n
		}
	}
	return i, nil
}
開發者ID:jackdoe,項目名稱:no,代碼行數:31,代碼來源:api.pb.go

示例9: MarshalTo

func (m *Header) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.TimeId == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("time_id")
	} else {
		data[i] = 0x8
		i++
		i = encodeVarintData(data, i, uint64(*m.TimeId))
	}
	if m.Offset == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("offset")
	} else {
		data[i] = 0x10
		i++
		i = encodeVarintData(data, i, uint64(*m.Offset))
	}
	if m.NodeId == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("node_id")
	} else {
		data[i] = 0x18
		i++
		i = encodeVarintData(data, i, uint64(*m.NodeId))
	}
	if len(m.Tags) > 0 {
		for _, s := range m.Tags {
			data[i] = 0x22
			i++
			l = len(s)
			for l >= 1<<7 {
				data[i] = uint8(uint64(l)&0x7f | 0x80)
				l >>= 7
				i++
			}
			data[i] = uint8(l)
			i++
			i += copy(data[i:], s)
		}
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:mrares,項目名稱:no,代碼行數:46,代碼來源:data.pb.go

示例10: MarshalTo

func (m *InternalAuthenticationResult) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Success == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("success")
	} else {
		data[i] = 0x8
		i++
		if *m.Success {
			data[i] = 1
		} else {
			data[i] = 0
		}
		i++
	}
	if m.Completed == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("completed")
	} else {
		data[i] = 0x10
		i++
		if *m.Completed {
			data[i] = 1
		} else {
			data[i] = 0
		}
		i++
	}
	if m.Pid == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("pid")
	} else {
		data[i] = 0x1a
		i++
		i = encodeVarintInternal(data, i, uint64(len(*m.Pid)))
		i += copy(data[i:], *m.Pid)
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:basho-labs,項目名稱:mesos-go,代碼行數:42,代碼來源:internal.pb.go

示例11: MarshalTo

func (m *NodeInfo) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.PubKey == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("pubKey")
	} else {
		data[i] = 0xa
		i++
		i = encodeVarintTest(data, i, uint64(m.PubKey.Size()))
		n3, err := m.PubKey.MarshalTo(data[i:])
		if err != nil {
			return 0, err
		}
		i += n3
	}
	data[i] = 0x12
	i++
	i = encodeVarintTest(data, i, uint64(len(m.Moniker)))
	i += copy(data[i:], m.Moniker)
	data[i] = 0x1a
	i++
	i = encodeVarintTest(data, i, uint64(len(m.Network)))
	i += copy(data[i:], m.Network)
	data[i] = 0x22
	i++
	i = encodeVarintTest(data, i, uint64(len(m.RemoteAddr)))
	i += copy(data[i:], m.RemoteAddr)
	data[i] = 0x2a
	i++
	i = encodeVarintTest(data, i, uint64(len(m.ListenAddr)))
	i += copy(data[i:], m.ListenAddr)
	data[i] = 0x32
	i++
	i = encodeVarintTest(data, i, uint64(len(m.Version)))
	i += copy(data[i:], m.Version)
	if len(m.Other) > 0 {
		for _, s := range m.Other {
			data[i] = 0x3a
			i++
			l = len(s)
			for l >= 1<<7 {
				data[i] = uint8(uint64(l)&0x7f | 0x80)
				l >>= 7
				i++
			}
			data[i] = uint8(l)
			i++
			i += copy(data[i:], s)
		}
	}
	return i, nil
}
開發者ID:jannop64,項目名稱:tendermint,代碼行數:54,代碼來源:test.pb.go

示例12: MarshalTo

func (m *Heartbeat) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.SentCount == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("sentCount")
	} else {
		data[i] = 0x8
		i++
		i = encodeVarintHeartbeat(data, i, uint64(*m.SentCount))
	}
	if m.ReceivedCount == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("receivedCount")
	} else {
		data[i] = 0x10
		i++
		i = encodeVarintHeartbeat(data, i, uint64(*m.ReceivedCount))
	}
	if m.ErrorCount == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("errorCount")
	} else {
		data[i] = 0x18
		i++
		i = encodeVarintHeartbeat(data, i, uint64(*m.ErrorCount))
	}
	if m.ControlMessageIdentifier != nil {
		data[i] = 0x22
		i++
		i = encodeVarintHeartbeat(data, i, uint64(m.ControlMessageIdentifier.Size()))
		n1, err := m.ControlMessageIdentifier.MarshalTo(data[i:])
		if err != nil {
			return 0, err
		}
		i += n1
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:cwlbraa,項目名稱:cf-acceptance-tests,代碼行數:41,代碼來源:heartbeat.pb.go

示例13: MarshalTo

func (m *LogEntry) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Index == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("Index")
	} else {
		data[i] = 0x8
		i++
		i = encodeVarintLogEntry(data, i, uint64(*m.Index))
	}
	if m.Term == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("Term")
	} else {
		data[i] = 0x10
		i++
		i = encodeVarintLogEntry(data, i, uint64(*m.Term))
	}
	if m.CommandName == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("CommandName")
	} else {
		data[i] = 0x1a
		i++
		i = encodeVarintLogEntry(data, i, uint64(len(*m.CommandName)))
		i += copy(data[i:], *m.CommandName)
	}
	if m.Command != nil {
		data[i] = 0x22
		i++
		i = encodeVarintLogEntry(data, i, uint64(len(m.Command)))
		i += copy(data[i:], m.Command)
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:johnmccawley,項目名稱:origin,代碼行數:38,代碼來源:log_entry.pb.go

示例14: MarshalTo

func (m *UUID) MarshalTo(data []byte) (n int, err error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Low == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("low")
	} else {
		data[i] = 0x8
		i++
		i = encodeVarintUuid(data, i, uint64(*m.Low))
	}
	if m.High == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("high")
	} else {
		data[i] = 0x10
		i++
		i = encodeVarintUuid(data, i, uint64(*m.High))
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:msschwartz,項目名稱:firehose-to-syslog,代碼行數:24,代碼來源:uuid.pb.go

示例15: MarshalTo

func (m *AuthenticationStepMessage) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Data == nil {
		return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("data")
	} else {
		data[i] = 0xa
		i++
		i = encodeVarintAuthentication(data, i, uint64(len(m.Data)))
		i += copy(data[i:], m.Data)
	}
	if m.XXX_unrecognized != nil {
		i += copy(data[i:], m.XXX_unrecognized)
	}
	return i, nil
}
開發者ID:GaizkaRubio,項目名稱:mesos-dns,代碼行數:18,代碼來源:authentication.pb.go


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