4 "github.com/golang/protobuf/proto"
7 // StringP returns a pointer to a string whose pointee is same as the given string value.
8 func StringP(val string) (*string, error) {
9 return proto.String(val), nil
12 // BoolP parses the given string representation of a boolean value,
13 // and returns a pointer to a bool whose value is same as the parsed value.
14 func BoolP(val string) (*bool, error) {
19 return proto.Bool(b), nil
22 // Float64P parses the given string representation of a floating point number,
23 // and returns a pointer to a float64 whose value is same as the parsed number.
24 func Float64P(val string) (*float64, error) {
25 f, err := Float64(val)
29 return proto.Float64(f), nil
32 // Float32P parses the given string representation of a floating point number,
33 // and returns a pointer to a float32 whose value is same as the parsed number.
34 func Float32P(val string) (*float32, error) {
35 f, err := Float32(val)
39 return proto.Float32(f), nil
42 // Int64P parses the given string representation of an integer
43 // and returns a pointer to a int64 whose value is same as the parsed integer.
44 func Int64P(val string) (*int64, error) {
49 return proto.Int64(i), nil
52 // Int32P parses the given string representation of an integer
53 // and returns a pointer to a int32 whose value is same as the parsed integer.
54 func Int32P(val string) (*int32, error) {
59 return proto.Int32(i), err
62 // Uint64P parses the given string representation of an integer
63 // and returns a pointer to a uint64 whose value is same as the parsed integer.
64 func Uint64P(val string) (*uint64, error) {
69 return proto.Uint64(i), err
72 // Uint32P parses the given string representation of an integer
73 // and returns a pointer to a uint32 whose value is same as the parsed integer.
74 func Uint32P(val string) (*uint32, error) {
79 return proto.Uint32(i), err