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:

All processors are defined in a module fastn/processor which must be imported to use any of these processors.
⚠️
Static Vs Dynamic
This feature works better with dynamic hosting. If you are using 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$

A processor is used when declaring a variable. The processor is in control of the variable if $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.

The details of what the processor returns is documented as part of each processors documentation.

Planned: Custom Processors

fastn is planning to use wasmtime to let anyone write their own custom processors, which will allow much more functionalities.

Support fastn!

Enjoying fastn? Please consider giving us a star ⭐️ on GitHub to show your support!

Getting Help

Have a question or need help?

Visit our GitHub Q&A discussion to get answers and subscribe to it to stay tuned.

Join our Discord channel and share your thoughts, suggestion, question etc.

Connect with our community!

Found an issue?

If you find some issue, please visit our GitHub issues to tell us about it.

Join us

We welcome you to join our Discord community today.

We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.
Copyright Β© 2023 - FifthTry.com