W4RM
Inherits: RefCounted
Static class that provides access to everything in w4rm, and some helper functions.
Methods
void |
array ( String p_type ) |
void |
backref ( String p_ref, Dictionary p_opts ) |
res://addons/w4gd/w4rm/w4rm_security.gd:W4RMSecurityPolicyBuilder |
build_security_policy_for ( Variant p_roles ) |
void |
load_client ( ) |
void |
mapper ( Variant p_node, Dictionary p_config, bool p_service ) |
void |
option ( Dictionary p_opts ) |
void |
security_policy ( Dictionary p_opts ) |
void |
tref ( String p_ref, Dictionary p_opts ) |
trigger_builder ( Variant p_table ) |
Method Descriptions
void array ( String p_type )
Converts a type name into the name of an array of that type.
void backref ( String p_ref, Dictionary p_opts )
Utility function for setting options on a column that holds a back-reference to another table.
class OtherObject:
var ref: Dictionary
static func _w4rm_type_options(opts):
opts["ref"] = W4RM.backref("Profile.some_ref", {
map = true,
})
res://addons/w4gd/w4rm/w4rm_security.gd:W4RMSecurityPolicyBuilder build_security_policy_for ( Variant p_roles )
Utility function for creating a security policy builder to assist in setting up a table's security policy.
class Profile:
static func _w4rm_security_policies(policies) -> void:
policies["Anyone can view profiles"] = W4RM.build_security_policy_for(['anon', 'authenticated']).can_select();
void load_client ( )
Loads the Supabase client.
void mapper ( Variant p_node, Dictionary p_config, bool p_service )
Creates a mapper. p_node
is a node that can be used to attach HTTPRequests. p_config
contains connection information (url, key, etc) for Supabase. Set p_service
to true if using a service key.
void option ( Dictionary p_opts )
Utility function for setting options on a column.
class Profile:
var id: StringName
static func _w4rm_type_options(opts):
opts["id"] = W4RM.option({
default = "auth.uid()",
unique = true,
})
void security_policy ( Dictionary p_opts )
Utility function for creating a table's security policy.
class Profile:
static func _w4rm_security_policies(policies) -> void:
policies["Anyone can view profiles"] = W4RM.security_policy({
roles = ['anon', 'authenticated'],
command = W4RM.W4RMTables.Command.SELECT,
})
void tref ( String p_ref, Dictionary p_opts )
Utility function for settings options on column that holds a reference to another table.
class Profile:
var some_ref: StringName
static func _w4rm_type_options(opts):
opts["some_ref"] = W4RM.tref("OtherObject", {
nullable = true,
})
res://addons/w4gd/w4rm/w4rm_triggers.gd:W4RMTriggerBuilder trigger_builder ( Variant p_table )
Utility function for creating a trigger builder to assist in setting up a table trigger.
var tb = W4RM.trigger_builder(table)
tb.force_default("id")
vars triggers := {}
tb.build(triggers)