processor
In fastn
ftd
gives a way for its platform, fastn
, to define some functions known as
processors
. These functions, then, can be used in the ftd
, and their
execution is handled by the platform.
At present, fastn
contains the following processors:
fastn/processor
which must be imported
to use any of these processors.fastn
in
static site mode, then how the page looked when fastn build
was
called will be shown to everyone. But if you are using dynamic
mode then this page would be regenerated on every page load.$processor$
$processor$
key is used.-- import: fastn/processors as pr
-- person list people:
$processor$: pr.package-query
db: db.sqlite
SELECT * FROM user;
As you see $processor$
key was used when defining the variable called
people
. Once $processor$
is used, the rest of the section is in determined
bu the specific processor used. Like in this case the processor
pr.package-query
expects a key named db
, which refers to the database file,
and the body of the section is the SQL query to execute against the database.
A processor must be used on a variable or a list with matching type as the
output of the processor. In this case we are using SELECT * FROM user;
so the
columns of the user
table must match the fields of the record person
. Extra
data will be ignored, but all required data must be passed for processor to
work correctly.
fastn
is planning to use wasmtime to let anyone write
their own custom processors, which will allow much more functionalities.