title: Protobuf: trying to add 'scalingfactor' as metadata to .proto file
body: <p>I am trying to (mis??)use the <code>.proto</code> definition to add a <code>scalingFactor</code> to all my scalar values such that both sides that are communicating can decide for themselves to internally use money values in cents, floats or decimals. In that I want to end up with just an integer going over the wire. Not two integers (<code>value</code> and <code>scalingFactor</code> for instance, or <code>value</code> and <code>nanos</code>).</p>
  <p>If I had the freedom to just add some metadata at field level by putting it between <code>[]</code>, it would look like this:</p>
  <pre><code>    syntax = &quot;not valid proto3....&quot;;
      
      message Product1 {
        int32 id = 1;
        string productName = 2;
        int32 priceInCents = 3
        int32 weightInTons = 4
      }
      message Product2 {
        int32 id = 1;
        string productName = 2;
        int32 price = 3 [scalingFactor = .01]
        int32 weight = 4 [scalingFactor = 1000]
      }
  </code></pre>
  <p>I would like to end up with a definition like it is described (but not valid of course) for Product2. Such that both sides can get the <code>scalingFactor</code> from the <code>.proto</code> definition. And then use that <code>scalingFactor</code> in their own code. Some might convert the price to a <code>decimal</code> in JavaScript or leave it in cents in C (e.g. a struct called <code>price</code> with int32 for <code>value</code> (in cents) and int32 for <code>scale</code> (e.g. -2 representing .01) )</p>
  <p>Is there an obvious way to do this? Ideally it is simple.</p>
  <h2>UPDATE based on answer:</h2>
  I now realise by paxdiablo's reaction that I was both unclear and maybe even in doubt myself. 
  <p>Unclear part: If <code>price</code> is $2.50 and <code>weight</code> is 7000kg, I want to transmit <code>250</code> and <code>7</code> over the wire in all cases. What I was not looking for is for protobuf to handle the scaling for me. It is more that I wanted to have the context of how transmitted values are scaled to become available to the code.</p>
  <p>Doubt: I am not sure I want to use the generated classes in my own code at both sides. I saw protobuf more as the transport mechanism only. And create my own variables again based on the transmitted values or values to be transmitted.</p>