title: How correctly describe a proto file?
body: <p>Let's say we want to create such table in the future:</p>
  
  <pre><code>CREATE TABLE CITY (
      CITY_ID INT8 UNIQUE NOT NULL,
      FOUNDATION_DATE TIMESTAMPTZ NOT NULL DEFAULT NOW(),
      CITY_NAME VARCHAR NULL,
      CITY_TYPE VARCHAR DEFAULT 'Unknown',
      INVISIBLE BOOL NULL
  );
  </code></pre>
  
  <p>I am trying to create a <code>proto</code> file that will match and not conflict with this table structure. But unfortunately, I got confused and need some help. I found out from the official documentation that <code>proto3</code> doesn't have the option to specify required and optional fields in the <code>message</code>. I also can't figure out how to specify default values in fields.</p>
  
  <p>At this point I have described the following <code>city.proto</code> file:</p>
  
  <pre><code>syntax = "proto3";
  
  import "google/protobuf/timestamp.proto";
  import "google/protobuf/wrappers.proto";
  
  message City {
      google.protobuf.UInt64Value city_id = 1;
      google.protobuf.Timestamp foundation_date = 1;
      google.protobuf.StringValue city_name = 3;
      google.protobuf.StringValue city_type = 4;
      google.protobuf.BoolValue invisible = 5;
  }
  </code></pre>
  
  <p>After generating go code via the <code>protoc</code> compiler, we usually get a strongly typed <code>struct</code>. With the help of <a href="https://gorm.io/" rel="nofollow noreferrer">GORM</a> package, I want to make automigration and create a table based on this struct.</p>
  
  <p>In my project, I use <code>go modules</code>.</p>
  
  <p>I use such command to generate go code:</p>
  
  <pre><code>protoc proto/city.proto -I. -I%GOPATH%/src --go_out=plugins=grpc:proto/city
  </code></pre>
  
  <p>Unfortunately, the command causes the following error:</p>
  
  <pre><code>--go_out: protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC
  </code></pre>
  
  <p><strong>go version</strong>:</p>
  
  <pre><code>go version go1.12.9 windows/amd64
  </code></pre>
  
  <p><strong>protoc --version</strong>:</p>
  
  <pre><code>libprotoc 3.11.4
  </code></pre>
  
  <p><strong>QUESTION</strong>:</p>
  
  <p>How to correctly describe the proto file for our table and how to generate go code correctly?</p>