39 lines
970 B
Markdown
39 lines
970 B
Markdown
Metagen package is used to describe structures, interfaces, functions, RPC calls using DSL.
|
|
This can be useful for codegen, bindings, etc.
|
|
|
|
Here is an example of some imaginary DSL:
|
|
|
|
#include enum.meta
|
|
|
|
func GetPlayer(
|
|
id : uint32
|
|
) : DataPlayer
|
|
|
|
func Apply(
|
|
fn : func(float, DataPlayer) : uint32
|
|
)
|
|
|
|
struct DataPlayer
|
|
@POD @table:player @pkey:id
|
|
id : uint32
|
|
version : string @strmax:16
|
|
gold : uint8 @default:0 #bonus
|
|
registered : bool @default:true
|
|
|
|
func Equals(
|
|
o : DataPlayer
|
|
v : uint32
|
|
) : bool,bool
|
|
end
|
|
|
|
struct ProtoBase
|
|
id : uint32
|
|
title : string @strmax:16 @default:"Hello"
|
|
end
|
|
|
|
struct ProtoBuilding extends ProtoBase
|
|
floors : int32
|
|
arr : uint32[] @default:[1,2,3]
|
|
end
|
|
|
|
[Look at tests for an actual API usage.](../master/tests/run.php) |