Skip to content

activatedio/protogen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Protogen

This is a library to enable generation of proto files from go language inputs

GitHub Workflow Status Go Report Card

Protogen

Simple project to generate proto files from go language inputs

Usage

f := NewFile("unit")

f.AddMessages(
    NewMessage("Message1").AddFields(
        NewField("Field1", FieldParams{
            FieldType: "bool",
            Number:    1001,
            Repeated:  false,
        }),
        NewField("Field2", FieldParams{
            FieldType: "string",
            Number:    1002,
            Repeated:  true,
        }),
    ),
    NewMessage("Message2").AddFields(
        NewField("Field3", FieldParams{
            FieldType: "number",
            Number:    1001,
            Repeated:  false,
        }),
        NewField("Field4", FieldParams{
            FieldType: "string",
            Number:    1002,
            Repeated:  false,
        }),
    ),
).AddServices(
    NewService("Service1").AddMethods(
        NewMethod("Method1"),
        NewMethod("Method2"),
    ),
    NewService("Service2").AddMethods(
        NewMethod("Method3"),
        NewMethod("Method4"),
    ),
)

buf := &bytes.Buffer{}
err := f.Write(buf)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages