Message Types

Proto3 message with enums, repeated fields, maps, and timestamps.

syntax = "proto3";

package shortener;

option go_package = "shortener/pb";

import "google/protobuf/timestamp.proto";

enum LinkStatus {
  LINK_STATUS_UNSPECIFIED = 0;
  LINK_STATUS_ACTIVE = 1;
  LINK_STATUS_DISABLED = 2;
  LINK_STATUS_EXPIRED = 3;
}

message Link {
  int64 id = 1;
  string url = 2;
  string short_code = 3;
  int64 clicks = 4;
  LinkStatus status = 5;
  repeated string tags = 6;
  map<string, string> metadata = 7;
  google.protobuf.Timestamp created_at = 8;
  optional int64 max_clicks = 9;
}

💻 Run locally

Copy the code above and run it on your machine

© 2026 ByteLearn.dev. Free courses for developers. · Privacy