Documentation
¶
Index ¶
- func ErrorVariantNames(errorTypes []*onkir.Message) []string
- func GenerateClient(file *onkir.File) []byte
- func GenerateClientWithResolver(file *onkir.File, resolver PackageResolver) []byte
- func GenerateServer(file *onkir.File) []byte
- func GenerateServerWithResolver(file *onkir.File, resolver PackageResolver) []byte
- func GenerateTypes(file *onkir.File) []byte
- func GenerateTypesWithResolver(file *onkir.File, resolver PackageResolver) []byte
- func OneofTypeName(message *onkir.Message, field *onkir.Field) string
- func PascalCase(value string) string
- func RustEnumName(enum *onkir.Enum) string
- func RustIdent(value string) string
- func RustMessageName(message *onkir.Message) string
- func RustScalarType(kind onkir.ScalarKind) string
- func SnakeCase(value string) string
- func WriteWSClientRuntime(p *Printer, hasWSCorrelation bool)
- func WriteWSServerRuntime(p *Printer, hasWSCorrelation bool)
- type PackageRef
- type PackageResolver
- type Printer
- func (p *Printer) Blank()
- func (p *Printer) Bytes() []byte
- func (p *Printer) Dedent()
- func (p *Printer) EnumTypeName(enum *onkir.Enum) string
- func (p *Printer) Indent()
- func (p *Printer) MessageTypeName(message *onkir.Message) string
- func (p *Printer) P(args ...any)
- func (p *Printer) Raw(source string)
- func (p *Printer) RustType(t *onkir.Type) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorVariantNames ¶
func GenerateClient ¶
func GenerateClientWithResolver ¶
func GenerateClientWithResolver(file *onkir.File, resolver PackageResolver) []byte
func GenerateServer ¶
func GenerateServerWithResolver ¶
func GenerateServerWithResolver(file *onkir.File, resolver PackageResolver) []byte
func GenerateTypes ¶
func GenerateTypesWithResolver ¶
func GenerateTypesWithResolver(file *onkir.File, resolver PackageResolver) []byte
func PascalCase ¶
PascalCase converts a schema name to the Rust type / enum variant spelling. The result is passed through mangleNonRawKeyword because `self` PascalCases to `Self`, one of the four keywords that cannot be raw-escaped.
func RustEnumName ¶
func RustMessageName ¶
func RustScalarType ¶
func RustScalarType(kind onkir.ScalarKind) string
func WriteWSClientRuntime ¶
WriteWSClientRuntime emits the client-side runtime shared by every @ws method in the file: WsFrameSocket (typed send/receive/close over a mutex- guarded split sink/stream - fixes the pre-existing lack of write serialization, and now actually encodes/decodes instead of passing raw strings), and, when any method uses @ws_id, WsCallSocket (adds Call and a background reader task routing correlated replies away from receive()).
func WriteWSServerRuntime ¶
WriteWSServerRuntime emits the server-side runtime shared by every @ws method in the file: WsSink (mutex-guarded, Clone - so a handler can retain it and send from a spawned task, and so the read loop above can hand a fresh clone to every frame's handler call without moving it away), and, when any method uses @ws_id, WsPending (the correlation map) and WsCallSink (WsSink plus the Call helper).
Types ¶
type PackageRef ¶
type PackageRef struct {
ModulePath string
}
PackageRef is a module path from the generated Rust source file to another generated directory's types module.
type PackageResolver ¶
type PackageResolver interface {
ResolveMessage(message *onkir.Message) (PackageRef, bool)
ResolveEnum(enum *onkir.Enum) (PackageRef, bool)
}