How do I represent a UUID in a protobuf message?

You should probably use string or bytes to represent a UUID. Use string if it is most convenient to keep the UUID in human-readable format (e.g. "de305d54-75b4-431b-adb2-eb6b9e546014") or use bytes if you are storing the 128-bit value raw. (If you aren’t sure, you probably want string.)

Wrapping the value in a message type called UUID can be helpful to make the code more self-documenting but will have some performance overhead and isn’t strictly required. If you want to do this, define the type like:

message UUID {
  required string value = 1;
}

or:

message UUID {
  required bytes value = 1;
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)