Weed3 一個(gè)微型ORM框架(只有0.1Mb哦)
源碼:https://github.com/noear/weed3
源碼:https://gitee.com/noear/weed3
一、table() 執(zhí)行:鏈?zhǔn)絆RM操作
此處略(前面主要就講這個(gè)接口)
二存哲、call(..) 執(zhí)行:存儲(chǔ)過(guò)程 或 查詢過(guò)程
//執(zhí)行存儲(chǔ)過(guò)程
db.call("user_get").set("_user_id",1).getMap();
//執(zhí)行查詢過(guò)程(我暫時(shí)這么叫它)
db.call("select * from user where id=@user_id").set("@user_id",1).getMap();
三、sql(..) 執(zhí)行:SQL語(yǔ)句
db.sql("select * from user where id=?",1).getMap();
db.sql(..) 還有一個(gè)快捷版:db.exec(..)确垫。相當(dāng)于:db.sql(...).execute(); //批處理時(shí)鉴未,可快速寫(xiě)增业汰、刪渣玲、改動(dòng)作
例:db.exec("DELETE FROM test where a=1")
最終統(tǒng)一返回:IQuery (保證了體驗(yàn)的統(tǒng)一性)
db.table(..).select(..) -> IQuery
db.call(..) -> IQuery
db.sql(..) -> IQuery
public interface IQuery extends ICacheController<IQuery> {
long getCount() throws SQLException;
Object getValue() throws SQLException;
<T> T getValue(T def) throws SQLException;
Variate getVariate() throws SQLException;
Variate getVariate(Act2<CacheUsing,Variate> cacheCondition) throws SQLException;
<T extends IBinder> T getItem(T model) throws SQLException;
<T extends IBinder> T getItem(T model, Act2<CacheUsing, T> cacheCondition) throws SQLException;
<T extends IBinder> List<T> getList(T model) throws SQLException;
<T extends IBinder> List<T> getList(T model, Act2<CacheUsing, List<T>> cacheCondition) throws SQLException;
<T> T getItem(Class<T> cls) throws SQLException;
<T> T getItem(Class<T> cls,Act2<CacheUsing, T> cacheCondition) throws SQLException;
<T> List<T> getList(Class<T> cls) throws SQLException;
<T> List<T> getList(Class<T> cls,Act2<CacheUsing, List<T>> cacheCondition) throws SQLException;
DataList getDataList() throws SQLException;
DataList getDataList(Act2<CacheUsing, DataList> cacheCondition) throws SQLException;
DataItem getDataItem() throws SQLException;
DataItem getDataItem(Act2<CacheUsing, DataItem> cacheCondition) throws SQLException;
List<Map<String,Object>> getMapList() throws SQLException;
Map<String,Object> getMap() throws SQLException;
<T> List<T> getArray(String column) throws SQLException;
}