You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 lines
1.5 KiB

package com.xsn.explorer.helpers
import com.alexitc.playsonify.sql.FieldOrderingSQLInterpreter
import com.xsn.explorer.data.anorm.dao._
import com.xsn.explorer.data.anorm.{BlockPostgresDataHandler, LedgerPostgresDataHandler, TransactionPostgresDataHandler}
import play.api.db.Database
trait DataHandlerObjects {
lazy val fieldOrderingSQLInterpreter = new FieldOrderingSQLInterpreter
lazy val transactionInputDAO = new TransactionInputPostgresDAO
lazy val transactionOutputDAO = new TransactionOutputPostgresDAO
lazy val addressTransactionDetailsDAO = new AddressTransactionDetailsPostgresDAO
lazy val transactionPostgresDAO = new TransactionPostgresDAO(
transactionInputDAO,
transactionOutputDAO,
addressTransactionDetailsDAO,
fieldOrderingSQLInterpreter)
lazy val blockPostgresDAO = new BlockPostgresDAO(fieldOrderingSQLInterpreter)
lazy val balancePostgresDAO = new BalancePostgresDAO(fieldOrderingSQLInterpreter)
lazy val aggregatedAmountPostgresDAO = new AggregatedAmountPostgresDAO
def createLedgerDataHandler(database: Database) = {
new LedgerPostgresDataHandler(
database,
blockPostgresDAO,
transactionPostgresDAO,
balancePostgresDAO,
aggregatedAmountPostgresDAO)
}
def createBlockDataHandler(database: Database) = {
new BlockPostgresDataHandler(database, blockPostgresDAO)
}
def createTransactionDataHandler(database: Database) = {
new TransactionPostgresDataHandler(database, transactionOutputDAO, transactionPostgresDAO)
}
}
object DataHandlerObjects extends DataHandlerObjects