Mount names
Entities, objects, operations, and queries have mount names:
- for entities and objects, those names are the SQL table names where the data gets stored
- for operations and queries, you use a mount name to invoke an operation or a query from the outside
By default, you define a mount name by a fully qualified name of a definition.
Example
namespace foo {
namespace bar {
entity user {}
}
}
The mount name for the user
entity becomes foo.bar.user
, reflecting its hierarchical position.
Custom mount names
You can use the @mount
annotation to specify a custom mount name. You can specify the @mount
annotation for
entities, objects, operations, and queries.
Syntax: @mount('desired_mount_name')
Example
@mount('foo.bar.user')
entity user {}
Mount for namespace
Prefix elements within a namespace with a custom mount name.
Example
@mount('foo.bar')
namespace ns {
entity user {}
}
The mount name of a user
is foo.bar.user
.
Mount for module
Prefix elements within a module with a custom mount name.
Example
@mount('foo.bar')
module;
entity user {}
The mount name of a user
is foo.bar.user
.
Nested namespace mounts
A mount name can be relative to the context mount name. For example, when defined in a namespace:
Example
@mount('a.b.c')
namespace ns {
entity user {}
}
The entity user
has the following mount names when annotated with @mount
:
@mount('.d.user')
->a.b.c.d.user
@mount('^.user')
->a.b.user
@mount('^^.x.user')
->a.x.user
Construct complex mount names relative to context using special characters
.
(dot): Appends names to the current context mount name.^
(caret): Removes the last part from the context mount name.
@mount("foo.")
entity user {
}
// mount name = "foo.user"
@mount("foo")
entity user {
}
// mount name = "foo"