Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator generates implementations of an RPC server for a package. It will declare a new type with the following name: {serviceName}Server with the first letter in lower case. In case the type already exists in the package, it will not be generated again. The purpose of that is that you can customize the type, even though the methods are automatically generated. Same happens with the constructor. If it does not exist, a function named new{ServiceName}Server with no parameters and a single result of the type {serviceName}Server will be generated. It can be defined, to avoid a default implementation, but the same signature is required, as it is used for registering the server implementation.
So, if you have a service named FooService, you can implement `fooServiceServer` and `func newFooServiceServer() *fooServiceServer`.
All generated methods will use as receiver a field in the server implementation with the same name as the type of the receiver. For example, the method generated for `func (*Foo) Bar()` will be require that our `fooServiceServer` had a field with that name.
type fooServiceServer struct { Foo *Foo }
For every method you want to generate an RPC method for, you have to implement its receiver by yourself in the server implementation type and the constructor.
A single file per package will be generated containing all the RPC methods. The file will be written to the package path and it will be named "server.proteus.go"