mirror of
https://github.com/prometheus/prometheus.git
synced 2025-07-04 11:33:25 +00:00
20 lines
356 B
Go
20 lines
356 B
Go
![]() |
package main
|
||
|
|
||
|
import (
|
||
|
"code.google.com/p/goprotobuf/proto"
|
||
|
)
|
||
|
|
||
|
type ProtocolBufferEncoder struct {
|
||
|
message proto.Message
|
||
|
}
|
||
|
|
||
|
func (p *ProtocolBufferEncoder) Encode() ([]byte, error) {
|
||
|
return proto.Marshal(p.message)
|
||
|
}
|
||
|
|
||
|
func NewProtocolBufferEncoder(message proto.Message) *ProtocolBufferEncoder {
|
||
|
return &ProtocolBufferEncoder{
|
||
|
message: message,
|
||
|
}
|
||
|
}
|