2017-10-13 02:06:55 +00:00
|
|
|
package cy.agorise.crystalwallet.dao;
|
|
|
|
|
2018-11-29 18:20:25 +00:00
|
|
|
import androidx.lifecycle.LiveData;
|
|
|
|
import androidx.room.Dao;
|
|
|
|
import androidx.room.Insert;
|
|
|
|
import androidx.room.OnConflictStrategy;
|
|
|
|
import androidx.room.Query;
|
2017-10-13 02:06:55 +00:00
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import cy.agorise.crystalwallet.models.CryptoCoinBalance;
|
|
|
|
import cy.agorise.crystalwallet.models.CryptoNetBalance;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by Henry Varona on 10/9/2017.
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Dao
|
|
|
|
public interface CryptoCoinBalanceDao {
|
|
|
|
|
|
|
|
@Query("SELECT * FROM crypto_coin_balance")
|
|
|
|
List<CryptoCoinBalance> getAll();
|
|
|
|
|
2017-10-18 01:14:37 +00:00
|
|
|
@Query("SELECT id as account_id, crypto_net FROM crypto_net_account")
|
2017-10-15 02:02:55 +00:00
|
|
|
LiveData<List<CryptoNetBalance>> getAllBalances();
|
|
|
|
|
2018-01-21 21:20:09 +00:00
|
|
|
@Query("SELECT id FROM crypto_net_account WHERE crypto_net = 'BITSHARES' ORDER BY id ASC LIMIT 1")
|
|
|
|
long getFirstBitsharesAccountId();
|
|
|
|
|
2017-10-15 02:02:55 +00:00
|
|
|
@Query("SELECT * FROM crypto_coin_balance WHERE account_id = :accountId")
|
|
|
|
LiveData<List<CryptoCoinBalance>> getBalancesFromAccount(long accountId);
|
2017-10-13 02:06:55 +00:00
|
|
|
|
2017-11-09 02:42:22 +00:00
|
|
|
@Query("SELECT * FROM crypto_coin_balance WHERE account_id IN (SELECT id FROM crypto_net_account WHERE crypto_net = 'BITSHARES')")
|
|
|
|
LiveData<List<CryptoCoinBalance>> getBalancesFromBitsharesAccount();
|
|
|
|
|
2017-10-26 01:33:38 +00:00
|
|
|
@Query("SELECT * FROM crypto_coin_balance WHERE account_id = :accountId AND crypto_currency_id = :assetId")
|
|
|
|
CryptoCoinBalance getBalanceFromAccount(long accountId, long assetId);
|
|
|
|
|
2017-10-13 02:06:55 +00:00
|
|
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
|
|
|
public long[] insertCryptoCoinBalance(CryptoCoinBalance... balances);
|
|
|
|
|
|
|
|
}
|