2017-10-16 00:23:44 +00:00
|
|
|
package cy.agorise.crystalwallet.dao;
|
|
|
|
|
2018-01-31 01:44:37 +00:00
|
|
|
import android.arch.lifecycle.LiveData;
|
2017-10-16 00:23:44 +00:00
|
|
|
import android.arch.persistence.room.Dao;
|
|
|
|
import android.arch.persistence.room.Insert;
|
|
|
|
import android.arch.persistence.room.OnConflictStrategy;
|
|
|
|
import android.arch.persistence.room.Query;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import cy.agorise.crystalwallet.models.CryptoCurrency;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by henry on 15/10/2017.
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Dao
|
|
|
|
public interface CryptoCurrencyDao {
|
|
|
|
|
|
|
|
@Query("SELECT * FROM crypto_currency")
|
|
|
|
List<CryptoCurrency> getAll();
|
|
|
|
|
2017-10-18 00:35:37 +00:00
|
|
|
@Query("SELECT * FROM crypto_currency WHERE id = :id")
|
2017-10-29 00:58:39 +00:00
|
|
|
CryptoCurrency getById(long id);
|
2017-10-16 00:23:44 +00:00
|
|
|
|
2018-10-11 01:57:40 +00:00
|
|
|
@Query("SELECT * FROM crypto_currency WHERE id = :id")
|
|
|
|
LiveData<CryptoCurrency> getLDById(long id);
|
|
|
|
|
2017-11-09 02:42:22 +00:00
|
|
|
@Query("SELECT * FROM crypto_currency WHERE name = :name AND crypto_net = :cryptoNet")
|
|
|
|
CryptoCurrency getByNameAndCryptoNet(String name,String cryptoNet);
|
|
|
|
|
2017-10-26 01:33:38 +00:00
|
|
|
@Query("SELECT * FROM crypto_currency WHERE id IN (:ids)")
|
|
|
|
List<CryptoCurrency> getByIds(List<Long> ids);
|
|
|
|
|
2018-01-31 01:44:37 +00:00
|
|
|
@Query("SELECT * FROM crypto_currency WHERE name = :name")
|
|
|
|
LiveData<CryptoCurrency> getLiveDataByName(String name);
|
|
|
|
|
2018-10-31 02:16:27 +00:00
|
|
|
@Query("SELECT * FROM crypto_currency WHERE name = :name and crypto_net = :cryptoNet")
|
|
|
|
CryptoCurrency getByName(String name, String cryptoNet);
|
2017-10-24 03:25:09 +00:00
|
|
|
|
2018-09-21 04:43:29 +00:00
|
|
|
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
2017-10-16 00:23:44 +00:00
|
|
|
public long[] insertCryptoCurrency(CryptoCurrency... currencies);
|
|
|
|
|
|
|
|
}
|