本文整理匯總了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}