res://addons/w4gd/w4rm/w4rm_mapper.gd
Inherits: RefCounted
Maps tables in the database to GDScript classes.
Properties
Variant |
||
Variant |
|
|
Dictionary |
Methods
void |
add_operation ( StringName p_name, Array p_arguments, StringName p_returns, String p_body, StringName p_language ) |
void |
add_table ( StringName p_name, Script p_schema, Variant p_base ) |
void |
add_type ( StringName p_name, Script p_schema, Variant p_base ) |
void |
copy ( Variant p_from, Variant p_to, Variant p_type ) |
void |
create ( Variant p_obj ) |
void |
create_watcher ( GDScript p_schema, Callable p_inserted, Callable p_updated, Callable p_delete, String p_cond ) |
void |
delete ( Variant p_obj ) |
void |
done ( ) |
void |
drop_sql ( Dictionary p_opts ) |
String |
generate_sql ( ) |
void |
get_all ( GDScript p_base ) |
void |
get_by_id ( GDScript p_base, Variant p_id ) |
bool |
init_db ( Dictionary p_opts ) |
void |
op ( Variant p_base ) |
void |
parse ( Variant p_data, Variant p_to ) |
void |
publish ( Script p_script, bool p_full ) |
void |
refresh ( Variant p_obj ) |
void |
to_json ( Variant p_obj ) |
void |
update ( Variant p_obj ) |
Property Descriptions
Variant client
There is currently no description for this property.
Variant connector = null
There is currently no description for this property.
res://addons/w4gd/w4rm/w4rm_mapper.gd:Log logger
There is currently no description for this property.
Dictionary state
There is currently no description for this property.
Method Descriptions
void add_operation ( StringName p_name, Array p_arguments, StringName p_returns, String p_body, StringName p_language )
Adds a function that will be stored in the database.
void add_table ( StringName p_name, Script p_schema, Variant p_base )
Adds a table based on a GDScript class.
void add_type ( StringName p_name, Script p_schema, Variant p_base )
Adds a composite database type based on a GDScript class.
void copy ( Variant p_from, Variant p_to, Variant p_type )
Copies the W4RM definition from one GDScript class to another.
void create ( Variant p_obj )
Creates a record in the database based on the given GDScript object.
void create_watcher ( GDScript p_schema, Callable p_inserted, Callable p_updated, Callable p_delete, String p_cond )
Creates a watcher object to watch for changes to the database table mapped to the given GDScript class.
void delete ( Variant p_obj )
Deletes a record in the database based on the given GDScript object.
void done ( )
Tells the mapper that we're done setting up our types, tables and operations.
void drop_sql ( Dictionary p_opts )
Generates the SQL to drop all the types, tables and operations that have been added to the mapper.
String generate_sql ( )
Generates SQL to create all the types, tables and operations that have been added to the mapper.
void get_all ( GDScript p_base )
Gets all records in the database for the given GDScript class, as instances of that class.
void get_by_id ( GDScript p_base, Variant p_id )
Gets a record in the database for the given GDScript class (identified by its id) as an instance of that class.
bool init_db ( Dictionary p_opts )
Updates the database based on the types, tables and operations that have been added to the mapper.
void op ( Variant p_base )
Gets an "operation proxy" that can be used to call operations in the database.
void parse ( Variant p_data, Variant p_to )
Parses the given data into an object of the requested GDScript class.
void publish ( Script p_script, bool p_full )
Mark this GDScript class so that it will publish realtime database changes (which can be monitored via create_watcher or res://addons/w4gd/supabase/realtime.gd).
void refresh ( Variant p_obj )
Refreshes the given GDScript object with the current record stored in the database.
void to_json ( Variant p_obj )
Converts an instance of a mapped GDScript class into JSON to send to Supabase.
void update ( Variant p_obj )
Updates a record in the database based on the given GDScript object.