1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00
MiraiGo/internal/proto/wrapper.go
wdvxdr ec4cd4a6f3
style: internal/proto
use this package for conveniently replacing proto package
in the future.
2021-11-22 22:05:19 +08:00

38 lines
1.1 KiB
Go

package proto
import "google.golang.org/protobuf/proto"
type Message = proto.Message
func Marshal(m Message) ([]byte, error) {
return proto.Marshal(m)
}
func Unmarshal(b []byte, m Message) error {
return proto.Unmarshal(b, m)
}
// Bool stores v in a new bool value and returns a pointer to it.
func Bool(v bool) *bool { return &v }
// Int32 stores v in a new int32 value and returns a pointer to it.
func Int32(v int32) *int32 { return &v }
// Int64 stores v in a new int64 value and returns a pointer to it.
func Int64(v int64) *int64 { return &v }
// Float32 stores v in a new float32 value and returns a pointer to it.
func Float32(v float32) *float32 { return &v }
// Float64 stores v in a new float64 value and returns a pointer to it.
func Float64(v float64) *float64 { return &v }
// Uint32 stores v in a new uint32 value and returns a pointer to it.
func Uint32(v uint32) *uint32 { return &v }
// Uint64 stores v in a new uint64 value and returns a pointer to it.
func Uint64(v uint64) *uint64 { return &v }
// String stores v in a new string value and returns a pointer to it.
func String(v string) *string { return &v }