This is the ThingsDB documentation for version v0, click here for the latest version!
Deletes an existing Type.
It is not possible to delete a Type which is used by another Type. You should first change or delete the other Type before you are able to delete this Type. See the example below.
If there are still instances of the Type you delete, then all instances will be converted to normal things. No properties will be removed in this process. With type_count(..) you can view the number of instances of a certain Type.
This function generates an event.
del_type(type)
Argument | Type | Description |
---|---|---|
type | string | Name of the Type to be deleted. |
The value nil
.
This code shows how to use del_type():
// Create type `A`
new_type('A');
// Create type `B` which has a reference to type `A`
set_type('B', {
a: 'A'
});
// Cannot delete `A` since it is referenced by type `B`.
assert(is_err(try(del_type('A'))));
// First change type `B`
mod_type('B', 'mod', 'a', 'thing');
// Now we can remove type `A`
del_type('A');
Return value in JSON format
null