-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何调用异步标签,目前是不是不支持异步标签? #877
Comments
Can you translate in English? |
Hello, I understand that you are facing some issues with the tera template engine in the actix_web framework. Here is a translation of your previous message into English: For example, in a Java program, there is a freemarker template plugin that defines a module's tag at the Java backend. For instance, it can be an article list tag that allows setting various parameters. Then, in the template, you can directly call this tag with parameters to retrieve the desired content. This tag can be global. Currently, I am using actix_web and the tera engine. I encountered the following issues: The tera.register_function method cannot invoke asynchronous functions, such as retrieving data from a database. |
If you are using an asynchronous function to retrieve an article list and the returned content can be of various types, but Tera only accepts Result as the output type, you will need to handle the conversion from different types to Value within your code. `pub async fn article_tags(args: &HashMap<String, Value>) -> Result {
|
Tera doesn't support async tests/functions/filters no |
Is there a plan to support asynchronous calling of tags? |
No |
@sunkaifei async functions你有没有实现出来? |
@dw0616 没有,我技术能力有限,没搞定就没搞了 |
@dw0616 作者好像没有实现这个功能想法,哈哈 |
哥们,你的问题解决了吗?你具体怎么使用的,能给个例子吗? |
一个网站里有很多模块,首页要推荐很多栏目列表,这些列表要从数据库读取,例如文章的推荐类型就有最新的,推荐的,热门的等等,如果这个标签可以通过设置的参数调用各个所需的内容就行了
The text was updated successfully, but these errors were encountered: