weed3-6.嵌入到脚本或模板
2019-10-11 本文已影响0人
草编椅
Weed3 一个超轻量级ORM框架(只有90kb不到哦)
源码:https://github.com/noear/weed3
嵌入到脚本引擎
- 嵌入到javascript引擎(nashorn)
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
ScriptEngine _eng = scriptEngineManager.getEngineByName("nashorn");
Invocable _eng_call = (Invocable)_eng;
_eng.put("db", db);
var map = db.table("test").where('id=?',1).getMap();
- 嵌入到groovy引擎
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
ScriptEngine _eng = scriptEngineManager.getEngineByName("groovy");
Invocable _eng_call = (Invocable)_eng;
_eng.put("db", db);
def map = db.table("test").where('id=?',1).getMap();
嵌入到模板引擎
- 嵌入到Freemarker引擎
<#assign tag_name=ctx.param('tag_name','') />
<#assign tags=db.table("a_config").where('label=?',label).groupBy('edit_placeholder').select("edit_placeholder as tag").getMapList() />
<!DOCTYPE HTML>
<html>
<head>
...