protocompose

command module
v0.0.0-...-7e958e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 9 Imported by: 0

README

protocompose

This tool can process @compose "annotations" in comments of Protobuf message definitions.

how it works

Given the source file containing:

message Source {
    // the identifier
    string id = 10;    

    // date of issue
    google.type.Date issue_date = 11;

    // unused
    string external_code = 12;
}

// Dimension is for objects that have a size: W x H
message Dimension {
  // width in pixels
  int32 width = 10;

  // height in pixels
  int32 height = 20;
}

and the any target file containing @compose annotations:

// @compose somepackage.v2.Source.id
// @compose somepackage.v2.Source.issue_date
// @compose somepackage.v2.Dimension.width
// @compose somepackage.v2.Dimension.height
message Composed {
  // must be empty
}

after processing all proto files with protocompose, you will get:

// @compose somepackage.v2.Source.id
// @compose somepackage.v2.Source.issue_date
// @compose somepackage.v2.Dimension.width
// @compose somepackage.v2.Dimension.height
message Composed {
  
  // the identifier
  string id = 1;
  
  // date of issue
  google.type.Date issue_date = 2;

  // width in pixels
  int32 width = 3;

  // height in pixels
  int32 height = 4;
}

which contains copies of the fields as specified by each annotation.

Field numbers follow the order as described.

Supported fields: Normal and Map.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL