servo

module
v0.0.0-...-b57a2b4 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT

README

servo

A toy DSL and framework for cross-language API generation

Servo DSL

Options

Plugin options can be specified for configuring code generation.

option gojson.package = "package";
Message

Messages have fields with specified types

message AllTypes {
  // message fields
  message_field: OtherType;
  // 32-bit integers
  int_field: int32;
  // 64-bit integers
  long_field: int64;
  // 32-bit floating points
  float_field: float32;
  // 64-bit floating points
  double_field: float64;
  // maps (key must be primitive)
  map_field: map[string]int;
  // lists
  list_field: list[string];
}
RPC Service

Services can define RPCs that send and receive messages.

message EchoRequest {
  message: string;
}

message EchoResponse {
  message: string;
}

// Echo a message
service EchoService {
  rpc echo(EchoRequest): EchoResponse;
}
PubSub Service

Services can define Publish methods that send messages without responses.

message StatusUpdate {
  message: string;
}

service StatusService {
  pub update(StatusUpdate);
}

Directories

Path Synopsis
cmd
example
client
Code generated by servoc (gohttp plugin).
Code generated by servoc (gohttp plugin).
server
Code generated by servoc (gohttp plugin).
Code generated by servoc (gohttp plugin).
internal
pkg
ast
ipc

Jump to

Keyboard shortcuts

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