本文整理汇总了Golang中github.com/tinylib/msgp/msgp.Require函数的典型用法代码示例。如果您正苦于以下问题:Golang Require函数的具体用法?Golang Require怎么用?Golang Require使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Require函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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
}
示例2: 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
}
示例3: 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
}
示例4: MarshalMsg
// MarshalMsg implements msgp.Marshaler
func (z *Incident) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
o = msgp.AppendMapHeader(o, 9)
o = msgp.AppendString(o, "event_name")
o = msgp.AppendBytes(o, z.EventName)
o = msgp.AppendString(o, "time")
o = msgp.AppendInt64(o, z.Time)
o = msgp.AppendString(o, "id")
o = msgp.AppendInt64(o, z.Id)
o = msgp.AppendString(o, "active")
o = msgp.AppendBool(o, z.Active)
o = msgp.AppendString(o, "escalation")
o = msgp.AppendString(o, z.Escalation)
o = msgp.AppendString(o, "description")
o = msgp.AppendString(o, z.Description)
o = msgp.AppendString(o, "policy")
o = msgp.AppendString(o, z.Policy)
o = msgp.AppendString(o, "Status")
o = msgp.AppendInt(o, z.Status)
o = msgp.AppendString(o, "Event")
o, err = z.Event.MarshalMsg(o)
if err != nil {
return
}
return
}
示例5: MarshalMsg
// MarshalMsg implements msgp.Marshaler
func (z *Node) 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.AppendBytes(o, []byte(z.ID))
// string "il"
o = append(o, 0xa2, 0x69, 0x6c)
o = msgp.AppendBool(o, z.IsLeaf)
// string "cv"
o = append(o, 0xa2, 0x63, 0x76)
o = msgp.AppendArrayHeader(o, uint32(len(z.ChildValues)))
for cmr := range z.ChildValues {
o, err = msgp.AppendIntf(o, z.ChildValues[cmr])
if err != nil {
return
}
}
// string "ck"
o = append(o, 0xa2, 0x63, 0x6b)
o = msgp.AppendArrayHeader(o, uint32(len(z.ChildKeys)))
for ajw := range z.ChildKeys {
if z.ChildKeys[ajw] == nil {
o = msgp.AppendNil(o)
} else {
o, err = z.ChildKeys[ajw].MarshalMsg(o)
if err != nil {
return
}
}
}
return
}
示例6: 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
}
示例7: MarshalMsg
// MarshalMsg implements msgp.Marshaler
func (z *MetricDefinition) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
// map header, size 9
// string "Id"
o = append(o, 0x89, 0xa2, 0x49, 0x64)
o = msgp.AppendString(o, z.Id)
// string "OrgId"
o = append(o, 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 "Unit"
o = append(o, 0xa4, 0x55, 0x6e, 0x69, 0x74)
o = msgp.AppendString(o, z.Unit)
// 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 hct := range z.Tags {
o = msgp.AppendString(o, z.Tags[hct])
}
// string "LastUpdate"
o = append(o, 0xaa, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65)
o = msgp.AppendInt64(o, z.LastUpdate)
return
}
示例8: MarshalMsg
// MarshalMsg implements msgp.Marshaler
func (z *MethodT) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
// map header, size 6
// string "MethodId"
o = append(o, 0x86, 0xa8, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x49, 0x64)
o = msgp.AppendInt64(o, z.MethodId)
// string "Name"
o = append(o, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
o = msgp.AppendString(o, z.Name)
// string "Inputs"
o = append(o, 0xa6, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x73)
o, err = z.Inputs.MarshalMsg(o)
if err != nil {
return
}
// string "Returns"
o = append(o, 0xa7, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73)
o, err = z.Returns.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
}
示例9: 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
}
示例10: MarshalMsg
// MarshalMsg implements msgp.Marshaler
func (z *roaringArray) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
// map header, size 4
// string "keys"
o = append(o, 0x84, 0xa4, 0x6b, 0x65, 0x79, 0x73)
o = msgp.AppendArrayHeader(o, uint32(len(z.keys)))
for zhct := range z.keys {
o = msgp.AppendUint16(o, z.keys[zhct])
}
// string "needCopyOnWrite"
o = append(o, 0xaf, 0x6e, 0x65, 0x65, 0x64, 0x43, 0x6f, 0x70, 0x79, 0x4f, 0x6e, 0x57, 0x72, 0x69, 0x74, 0x65)
o = msgp.AppendArrayHeader(o, uint32(len(z.needCopyOnWrite)))
for zcua := range z.needCopyOnWrite {
o = msgp.AppendBool(o, z.needCopyOnWrite[zcua])
}
// string "copyOnWrite"
o = append(o, 0xab, 0x63, 0x6f, 0x70, 0x79, 0x4f, 0x6e, 0x57, 0x72, 0x69, 0x74, 0x65)
o = msgp.AppendBool(o, z.copyOnWrite)
// string "conserz"
o = append(o, 0xa7, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x72, 0x7a)
o = msgp.AppendArrayHeader(o, uint32(len(z.conserz)))
for zxhx := range z.conserz {
// map header, size 2
// string "t"
o = append(o, 0x82, 0xa1, 0x74)
o = msgp.AppendUint8(o, uint8(z.conserz[zxhx].t))
// string "r"
o = append(o, 0xa1, 0x72)
o, err = z.conserz[zxhx].r.MarshalMsg(o)
if err != nil {
return
}
}
return
}
示例11: 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
}
示例12: MarshalMsg
// MarshalMsg implements msgp.Marshaler
func (z Num) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
// map header, size 1
// string "val"
o = append(o, 0x81, 0xa3, 0x76, 0x61, 0x6c)
o = msgp.AppendFloat64(o, z.Value)
return
}
示例13: MarshalMsg
// MarshalMsg implements msgp.Marshaler
func (z DocumentList) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
o = msgp.AppendArrayHeader(o, uint32(len(z)))
for bai := range z {
o = msgp.AppendUint(o, uint(z[bai]))
}
return
}
示例14: MarshalMsg
// MarshalMsg implements msgp.Marshaler
func (z *KV) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
o = msgp.AppendArrayHeader(o, 2)
for xvk := range z {
o = msgp.AppendBytes(o, []byte(z[xvk]))
}
return
}
示例15: MarshalMsg
// MarshalMsg implements msgp.Marshaler
func (z uint32Slice) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize())
o = msgp.AppendArrayHeader(o, uint32(len(z)))
for zzpf := range z {
o = msgp.AppendUint32(o, z[zzpf])
}
return
}