Categorygithub.com/fireland15/rpc-gen
module
0.0.0-20250221021731-bc25c976b737
Repository: https://github.com/fireland15/rpc-gen.git
Documentation: pkg.go.dev

# README

RPC-Gen

Generate client and server code from a common definition file.

Supported Languages/Frameworks

More will be added as needed.

LanguageFrameworkServerClient
TypescriptN/A
GoEcho

Definitions

Definition files describe the interface between clients and servers. RPC-Gen translates this definition into interfaces & implementations in various languages for both clients and servers.

The primary part of a definition file is a RPC statement. It looks something like:

rpc AssignUser(request AssignUserRequest) AssignUserResponse

The rpc keyword indicates the statement is for an RPC method. Then, the name of the method, its parameters, and finally the return value. The return value can be omitted.

The definition file also defines the data models of the service. For example:

model AssignUserRequest {
    userId    uuid
    projectId uuid
    makeOwner bool?
    tags      string[]
}

Models can have one or more fields with scalar or model types. Fields can be marked optional with the optional keyword.

Built-in Scalar Types

TypeGoTS
boolboolboolean
intintnumber
floatfloatnumber
stringstringstring
datetime.Timestring

Custom types can be defined in the config file for each language.

Usage

go run ./cmd/cli/main.go -c ./config.json

# Packages

No description provided by the author