本文整理了Java中de.greenrobot.dao.query.Query.unique
方法的一些代码示例,展示了Query.unique
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.unique
方法的具体详情如下:
包路径:de.greenrobot.dao.query.Query
类名称:Query
方法名:unique
[英]Executes the query and returns the unique result or null.
[中]执行查询并返回唯一结果或null。
代码示例来源:origin: kaku2015/ColorfulNews
public static NewsChannelTable loadNewsChannel(int position) {
return App.getNewsChannelTableDao().queryBuilder()
.where(NewsChannelTableDao.Properties.NewsChannelIndex.eq(position)).build().unique();
}
代码示例来源:origin: org.greenrobot/greendao-encryption
/**
* Executes the query and returns the unique result (never null).
*
* @return Entity
* @throws DaoException if the result is not unique or no entity was found
*/
public T uniqueOrThrow() {
T entity = unique();
if (entity == null) {
throw new DaoException("No entity found for query");
}
return entity;
}
代码示例来源:origin: de.greenrobot/greendao
/**
* Executes the query and returns the unique result (never null).
*
* @return Entity
* @throws DaoException if the result is not unique or no entity was found
*/
public T uniqueOrThrow() {
T entity = unique();
if (entity == null) {
throw new DaoException("No entity found for query");
}
return entity;
}
代码示例来源:origin: de.greenrobot/greendao
/**
* Shorthand for {@link QueryBuilder#build() build()}.{@link Query#unique() unique()}; see {@link Query#unique()}
* for details. To execute a query more than once, you should build the query and keep the {@link Query} object for
* efficiency reasons.
*/
public T unique() {
return build().unique();
}
代码示例来源:origin: org.greenrobot/greendao-encryption
/**
* Shorthand for {@link QueryBuilder#build() build()}.{@link Query#unique() unique()}; see {@link Query#unique()}
* for details. To execute a query more than once, you should build the query and keep the {@link Query} object for
* efficiency reasons.
*/
public T unique() {
return build().unique();
}
代码示例来源:origin: bodismile/bmob-newim-demo
/**
* 获取本地的好友请求
* @param uid
* @param time
* @return
*/
private NewFriend getNewFriend(String uid,Long time){
NewFriendDao dao = openReadableDb().getNewFriendDao();
return dao.queryBuilder().where(NewFriendDao.Properties.Uid.eq(uid))
.where(NewFriendDao.Properties.Time.eq(time)).build().unique();
}
代码示例来源:origin: org.greenrobot/greendao-encryption
break;
case QueryUnique:
operation.result = ((Query) operation.parameter).forCurrentThread().unique();
break;
case DeleteByKey:
代码示例来源:origin: de.greenrobot/greendao
break;
case QueryUnique:
operation.result = ((Query) operation.parameter).forCurrentThread().unique();
break;
case DeleteByKey:
内容来源于网络,如有侵权,请联系作者删除!