hero.baobab.generator #
Generator
The Generator synchronizes actor code and specifications, allowing bidirectional transformation between the two.
This a
Development Workflow
A sample development workflow using the generator would be like:1. generating actor specification from an actor openrpc / openapi specification (see specification reflection)2. generating actor code from the actor specification3. updating actor code by filling in method prototypes4. adding methods to the actor to develop actor further5. parsing specification back from actor
- regenerating actor from the specificationthis allows for
- a tool which takes dir as input
- is just some v files which define models
- outputs a generated code dir with
- heroscript to memory for the model
- supporting v script for manipulated model
- name of actor e.g. ProjectManager, module would be project_manager
how does the actor work
is a global e.g. projectmanager_factory
with double map
key1: cid
object: ProjectManager Object
Object: Project Manager
has as properties:
db_$rootobjectname which is map
key: oid
val: the Model which represents the rootobject
on factory
actions_process
process heroscript through path or text (params)
action_process
take 1 action as input
${rootobjectname}_export
export all known objects as heroscript in chosen dir
name of heroscript would be ${rootobjectname}_define.md
${rootobjectname}_get(oid)
returns rootobject as copy
${rootobjectname}_list()!
returns list as copy
${rootobjectname}_set(oid,obj)!
${rootobjectname}_delete(oid)!
${rootobjectname}_new()!
in action we have
define
export/import
get
list
fn generate_actor_module #
fn generate_actor_module(spec ActorSpecification) !Module
fn generate_client_file #
fn generate_client_file(spec ActorSpecification) !VFile
fn generate_client_method #
fn generate_client_method(method ActorMethod) !string
fn generate_cmd_function #
fn generate_cmd_function(spec ActorSpecification) string
fn generate_command_file #
fn generate_command_file(spec ActorSpecification) !VFile
fn generate_handle_function #
fn generate_handle_function(spec ActorSpecification) string
fn generate_method_cmd #
fn generate_method_cmd(method ActorMethod) string
fn generate_method_cmd_function #
fn generate_method_cmd_function(actor_name string, method ActorMethod) string
fn generate_method_function #
fn generate_method_function(actor_name string, method ActorMethod) !string
fn generate_method_handle #
fn generate_method_handle(actor_name string, method ActorMethod) !string
fn generate_methods_file #
fn generate_methods_file(spec ActorSpecification) !VFile
fn generate_object_code #
fn generate_object_code(actor Struct, object BaseObject) VFile
fn generate_object_test_code #
fn generate_object_test_code(actor Struct, object BaseObject) !VFile
generate_object_methods generates CRUD actor methods for a provided structure
fn generate_openapi_file #
fn generate_openapi_file(spec ActorSpecification) !File
fn generate_openrpc_client_file #
fn generate_openrpc_client_file(spec OpenRPC) !VFile
fn generate_openrpc_client_test_file #
fn generate_openrpc_client_test_file(spec OpenRPC) !VFile
fn generate_openrpc_file #
fn generate_openrpc_file(spec OpenRPC) !File
- README
- fn generate_actor_module
- fn generate_client_file
- fn generate_client_method
- fn generate_cmd_function
- fn generate_command_file
- fn generate_handle_function
- fn generate_method_cmd
- fn generate_method_cmd_function
- fn generate_method_function
- fn generate_method_handle
- fn generate_methods_file
- fn generate_object_code
- fn generate_object_test_code
- fn generate_openapi_file
- fn generate_openrpc_client_file
- fn generate_openrpc_client_test_file
- fn generate_openrpc_file