• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Scala Row类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Scala中com.datastax.driver.core.Row的典型用法代码示例。如果您正苦于以下问题:Scala Row类的具体用法?Scala Row怎么用?Scala Row使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Row类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。

示例1: BenefitRepository

//设置package包名称以及导入依赖的类
package repositories.payroll.common


import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.payroll.common.Benefit
import scala.concurrent.Future

class BenefitRepository extends CassandraTable[BenefitRepository,Benefit]{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object benefitId extends StringColumn(this)  with PrimaryKey[String]
  object name extends StringColumn(this)
  object date extends DateTimeColumn(this)
  object state extends StringColumn(this)


  override def fromRow(r: Row): Benefit = {
    Benefit(organisationId(r), benefitId(r), name(r), date(r), state(r))
  }
}

object BenefitRepository extends BenefitRepository with RootConnector {
  override lazy val tableName = "benefit"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(benefit: Benefit): Future[ResultSet] = {
    insert
      .value(_.organisationId, benefit.organisationId)
      .value(_.benefitId, benefit.benefitId)
      .value(_.name, benefit.name)
      .value(_.date, benefit.date)
      .value(_.state, benefit.state)
      .future()
  }

  def getFileResultById(organisationId: String, benefitId: String): Future[Option[Benefit]] = {
    select.where(_.organisationId eqs organisationId).and (_.benefitId eqs benefitId).one()
  }

  def findAll: Future[Seq[Benefit]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getBenefit(organisationId: String): Future[Seq[Benefit]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(organisationId: String, benefitId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId).and (_.benefitId eqs benefitId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:58,代码来源:BenefitRepository.scala


示例2: LeaveTypeRepository

//设置package包名称以及导入依赖的类
package repositories.payroll.common
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.payroll.common.LeaveType

import scala.concurrent.Future

class LeaveTypeRepository extends CassandraTable[LeaveTypeRepository,LeaveType]{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object leaveTypeId extends StringColumn(this) with PrimaryKey[String]
  object name extends StringColumn(this)


  override def fromRow(r: Row): LeaveType = {
    LeaveType(organisationId(r), leaveTypeId(r), name(r))
  }
}

object LeaveTypeRepository extends LeaveTypeRepository with RootConnector {
  override lazy val tableName = "leavetype"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(leaveType :LeaveType): Future[ResultSet] = {
    insert
      .value(_.organisationId, leaveType.organisationId)
      .value(_.leaveTypeId, leaveType.leaveTypeId)
      .value(_.name, leaveType.name)
      .future()
  }

  def getFileResultById(organisationId: String, leaveTypeId: String): Future[Option[LeaveType]] = {
    select.where(_.organisationId eqs organisationId).and (_.leaveTypeId eqs leaveTypeId).one()
  }

  def findAll: Future[Seq[LeaveType]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getLeaveType(organisationId: String): Future[Seq[LeaveType]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(organisationId: String, leaveTypeId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId).and (_.leaveTypeId eqs leaveTypeId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:53,代码来源:LeaveTypeRepository.scala


示例3: MedicalAidRepository

//设置package包名称以及导入依赖的类
package repositories.payroll.common
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.payroll.common.MedicalAid

import scala.concurrent.Future

class MedicalAidRepository extends CassandraTable[MedicalAidRepository,MedicalAid]{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object medicalAidId extends StringColumn(this) with PrimaryKey[String]
  object name extends StringColumn(this)
  object code extends StringColumn(this)


  override def fromRow(r: Row): MedicalAid = {
    MedicalAid(organisationId(r), medicalAidId(r), name(r), code(r))
  }
}

object MedicalAidRepository extends MedicalAidRepository with RootConnector {
  override lazy val tableName = "medicalaid"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(medicalAid: MedicalAid): Future[ResultSet] = {
    insert
      .value(_.organisationId, medicalAid.organisationId)
      .value(_.medicalAidId, medicalAid.medicalAidId)
      .value(_.name, medicalAid.name)
      .value(_.code, medicalAid.code)
      .future()
  }

  def getFileResultById(organisationId: String, medicalAidId: String): Future[Option[MedicalAid]] = {
    select.where(_.organisationId eqs organisationId).and (_.medicalAidId eqs medicalAidId).one()
  }

  def findAll: Future[Seq[MedicalAid]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getMedicalAid(organisationId: String): Future[Seq[MedicalAid]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(organisationId: String, medicalAidId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId).and (_.medicalAidId eqs medicalAidId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:55,代码来源:MedicalAidRepository.scala


示例4: ContactTypeRepository

//设置package包名称以及导入依赖的类
package repositories.contacts

import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.common.contacts.ContactType

import scala.concurrent.Future

sealed class ContactTypeRepository extends CassandraTable[ContactTypeRepository,ContactType]{
  object contactTypeId extends StringColumn(this) with PartitionKey[String]
  object name extends StringColumn(this)
  override def fromRow(r: Row): ContactType = {
    ContactType(contactTypeId(r),name(r))
  }
}

object ContactTypeRepository extends ContactTypeRepository with RootConnector {
  override lazy val tableName = "contypes"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(contypes: ContactType): Future[ResultSet] = {
    insert
      .value(_.contactTypeId, contypes.contactTypeId)
      .value(_.name, contypes.name)
      .future()
  }

  def findById(contactTypeId: String):Future[Option[ContactType]] = {
    select.where(_.contactTypeId eqs contactTypeId).one()
  }
  def findAll: Future[Seq[ContactType]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getContactType(contactTypeId: String): Future[Seq[ContactType]] = {
    select.where(_.contactTypeId eqs contactTypeId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(contactTypeId:String): Future[ResultSet] = {
    delete.where(_.contactTypeId eqs contactTypeId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:49,代码来源:ContactTypeRepository.scala


示例5: TrainingInstitutionRepository

//设置package包名称以及导入依赖的类
package repositories.training.institutions
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.training.institutions.TrainingInstitution

import scala.concurrent.Future

class TrainingInstitutionRepository  extends CassandraTable[TrainingInstitutionRepository,TrainingInstitution]{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object trainingInstitutionId extends StringColumn(this) with PrimaryKey[String]
  object name extends StringColumn(this)
  object email extends StringColumn(this)
  object status extends StringColumn(this)


  override def fromRow(r: Row): TrainingInstitution = {
    TrainingInstitution(organisationId(r), trainingInstitutionId(r),name(r), email(r),status(r))
  }
}

object TrainingInstitutionRepository extends TrainingInstitutionRepository with RootConnector {
  override lazy val tableName = "traininginstitution"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(trainingInstitution: TrainingInstitution): Future[ResultSet] = {
    insert
      .value(_.organisationId, trainingInstitution.organisationId)
      .value(_.trainingInstitutionId, trainingInstitution.trainingInstitutionId)
      .value(_.name, trainingInstitution.name)
      .value(_.email, trainingInstitution.email)
      .value(_.status, trainingInstitution.status)
      .future()
  }

  def findById(organisationId: String, trainingInstitutionId: String):Future[Option[TrainingInstitution]] = {
    select.where(_.organisationId eqs organisationId). and(_.trainingInstitutionId eqs trainingInstitutionId).one()
  }
  def findAll: Future[Seq[TrainingInstitution]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getTrainingInstitution(organisationId: String): Future[Seq[TrainingInstitution]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(organisationId:String, userId: String, trainingInstitutionId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId). and(_.trainingInstitutionId eqs trainingInstitutionId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:56,代码来源:TrainingInstitutionRepository.scala


示例6: TrainingInstructorRepository

//设置package包名称以及导入依赖的类
package repositories.training.institutions
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.training.institutions.TrainingInstructor

import scala.concurrent.Future

class TrainingInstructorRepository  extends CassandraTable[TrainingInstructorRepository,TrainingInstructor]{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object TrainingInstructorId extends StringColumn(this) with PrimaryKey[String]
  object title extends StringColumn(this)
  object firstName extends StringColumn(this)
  object lastName extends StringColumn(this)
  object qualification extends StringColumn(this)
  object areasOfExpertise extends StringColumn(this)


  override def fromRow(r: Row): TrainingInstructor = {
    TrainingInstructor(organisationId(r), TrainingInstructorId(r),title(r), firstName(r),lastName(r), qualification(r), areasOfExpertise(r))
  }
}

object TrainingInstructorRepository extends TrainingInstructorRepository with RootConnector {
  override lazy val tableName = "traininginstructor"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(trainingInstructor: TrainingInstructor): Future[ResultSet] = {
    insert
      .value(_.organisationId, trainingInstructor.organisationId)
      .value(_.TrainingInstructorId, trainingInstructor.TrainingInstructorId)
      .value(_.title, trainingInstructor.title)
      .value(_.firstName, trainingInstructor.firstName)
      .value(_.lastName, trainingInstructor.lastName)
      .value(_.qualification, trainingInstructor.qualification)
      .value(_.areasOfExpertise, trainingInstructor.areasOfExpertise)
      .future()
  }

  def findById(organisationId: String, TrainingInstructorId: String):Future[Option[TrainingInstructor]] = {
    select.where(_.organisationId eqs organisationId). and(_.TrainingInstructorId eqs TrainingInstructorId).one()
  }
  def findAll: Future[Seq[TrainingInstructor]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getTrainingInstructor(organisationId: String): Future[Seq[TrainingInstructor]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(organisationId:String, userId: String, TrainingInstructorId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId). and(_.TrainingInstructorId eqs TrainingInstructorId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:60,代码来源:TrainingInstructorRepository.scala


示例7: TraningInstitutionContactsRepository

//设置package包名称以及导入依赖的类
package repositories.training.institutions
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.training.institutions.TraningInstitutionContacts

import scala.concurrent.Future

class TraningInstitutionContactsRepository extends CassandraTable[TraningInstitutionContactsRepository,TraningInstitutionContacts]{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object traningInstitutionContactsId extends StringColumn(this) with PrimaryKey[String]
  object contactTypeId extends StringColumn(this)
  object details extends MapColumn[TraningInstitutionContactsRepository, TraningInstitutionContacts, String, String](this)

  override def fromRow(r: Row): TraningInstitutionContacts = {
    TraningInstitutionContacts(organisationId(r),traningInstitutionContactsId(r),contactTypeId(r), details(r))
  }
}

object TraningInstitutionContactsRepository extends TraningInstitutionContactsRepository with RootConnector {
  override lazy val tableName = "traninginstitutioncontacts"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(traningInstitutionContacts: TraningInstitutionContacts): Future[ResultSet] = {
    insert
      .value(_.organisationId, traningInstitutionContacts.organisationId)
      .value(_.traningInstitutionContactsId, traningInstitutionContacts.traningInstitutionContactsId)
      .value(_.contactTypeId, traningInstitutionContacts.contactTypeId)
      .value(_.details, traningInstitutionContacts.details)
      .future()
  }

  def findById(organisationId: String, traningInstitutionContactsId: String):Future[Option[TraningInstitutionContacts]] = {
    select.where(_.organisationId eqs organisationId). and(_.traningInstitutionContactsId eqs traningInstitutionContactsId).one()
  }
  def findAll: Future[Seq[TraningInstitutionContacts]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getTraningInstitutionContacts(organisationId: String): Future[Seq[TraningInstitutionContacts]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(organisationId:String, traningInstitutionContactsId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId). and(_.traningInstitutionContactsId eqs traningInstitutionContactsId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:53,代码来源:TraningInstitutionContactsRepository.scala


示例8: TrainingInstitutionAddressRepository

//设置package包名称以及导入依赖的类
package repositories.training.institutions
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.training.institutions.TrainingInstitutionAddress

import scala.concurrent.Future

class TrainingInstitutionAddressRepository extends CassandraTable[TrainingInstitutionAddressRepository,TrainingInstitutionAddress]{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object TrainingInstitutionAddressId extends StringColumn(this) with PrimaryKey[String]
  object trainingInstitutionLocationId extends StringColumn(this) with PrimaryKey[String]
  object addressTypeId extends StringColumn(this)
  object details extends MapColumn[TrainingInstitutionAddressRepository,TrainingInstitutionAddress, String, String](this)

  override def fromRow(r: Row): TrainingInstitutionAddress = {
    TrainingInstitutionAddress(organisationId(r),TrainingInstitutionAddressId(r),trainingInstitutionLocationId(r), addressTypeId(r), details(r))
  }
}

object TrainingInstitutionAddressRepository extends TrainingInstitutionAddressRepository with RootConnector {
  override lazy val tableName = "traininginstitutionaddress"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(trainingInstitutionAddress: TrainingInstitutionAddress): Future[ResultSet] = {
    insert
      .value(_.organisationId, trainingInstitutionAddress.organisationId)
      .value(_.TrainingInstitutionAddressId, trainingInstitutionAddress.TrainingInstitutionAddressId)
      .value(_.trainingInstitutionLocationId, trainingInstitutionAddress.trainingInstitutionLocationId)
      .value(_.addressTypeId, trainingInstitutionAddress.addressTypeId)
      .value(_.details, trainingInstitutionAddress.details)
      .future()
  }

  def findById(organisationId: String, TrainingInstitutionAddressId: String, trainingInstitutionLocationId: String):Future[Option[TrainingInstitutionAddress]] = {
    select.where(_.organisationId eqs organisationId). and(_.TrainingInstitutionAddressId eqs TrainingInstitutionAddressId). and (_.trainingInstitutionLocationId eqs trainingInstitutionLocationId).one()
  }
  def findAll: Future[Seq[TrainingInstitutionAddress]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getTrainingInstitutionAddress(organisationId: String): Future[Seq[TrainingInstitutionAddress]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(organisationId:String, TrainingInstitutionAddressId: String, trainingInstitutionLocationId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId). and(_.TrainingInstitutionAddressId eqs TrainingInstitutionAddressId). and (_.trainingInstitutionLocationId eqs trainingInstitutionLocationId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:55,代码来源:TrainingInstitutionAddressRepository.scala


示例9: CompetencyRepository

//设置package包名称以及导入依赖的类
package repositories.training.competencies
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.training.competencies.Competency

import scala.concurrent.Future

class CompetencyRepository  extends CassandraTable[CompetencyRepository,Competency]{
  object compencyId extends StringColumn(this) with PartitionKey[String]
  object name extends StringColumn(this)
  object competencyTypeId extends StringColumn(this)

  override def fromRow(r: Row): Competency = {
    Competency(compencyId(r),name(r),competencyTypeId(r))
  }
}

object CompetencyRepository extends CompetencyRepository with RootConnector {
  override lazy val tableName = "competency"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(competency: Competency): Future[ResultSet] = {
    insert
      .value(_.compencyId, competency.compencyId)
      .value(_.name, competency.name)
      .value(_.competencyTypeId, competency.competencyTypeId)
      .future()
  }

  def findById(compencyId: String):Future[Option[Competency]] = {
    select.where(_.compencyId eqs compencyId).one()
  }
  def findAll: Future[Seq[Competency]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getCompetency(compencyId:String): Future[Seq[Competency]] = {
    select.where(_.compencyId eqs compencyId)fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(compencyId:String): Future[ResultSet] = {
    delete.where(_.compencyId eqs compencyId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:51,代码来源:CompetencyRepository.scala


示例10: CourseCompetenciesRepository

//设置package包名称以及导入依赖的类
package repositories.training.courses
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.training.courses.CourseCompetencies

import scala.concurrent.Future

class CourseCompetenciesRepository extends CassandraTable[CourseCompetenciesRepository,CourseCompetencies]{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object courseId extends StringColumn(this) with PrimaryKey[String]
  object compentencyId extends StringColumn(this)

  override def fromRow(r: Row): CourseCompetencies = {
    CourseCompetencies(organisationId(r),courseId(r),compentencyId(r))
  }
}

object CourseCompetenciesRepository extends CourseCompetenciesRepository with RootConnector {
  override lazy val tableName = "coursecompetencies"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(courseCompetencies: CourseCompetencies): Future[ResultSet] = {
    insert
      .value(_.organisationId, courseCompetencies.organisationId)
      .value(_.courseId, courseCompetencies.courseId)
      .value(_.compentencyId, courseCompetencies.compentencyId)
      .future()
  }

  def findById(organisationId: String, courseId: String):Future[Option[CourseCompetencies]] = {
    select.where(_.organisationId eqs organisationId). and (_.courseId eqs courseId).one()
  }
  def findAll: Future[Seq[CourseCompetencies]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getCourseCompetencies(organisationId: String): Future[Seq[CourseCompetencies]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }
  def deleteById(organisationId:String, courseId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId). and (_.courseId eqs courseId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:50,代码来源:CourseCompetenciesRepository.scala


示例11: CourseSubjectsRepository

//设置package包名称以及导入依赖的类
package repositories.training.courses
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.training.courses.CourseSubjects

import scala.concurrent.Future

class CourseSubjectsRepository extends CassandraTable[CourseSubjectsRepository,CourseSubjects]{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object courseId extends StringColumn(this) with PrimaryKey[String]
  object subjectId extends StringColumn(this) with PrimaryKey[String]

  override def fromRow(r: Row): CourseSubjects = {
    CourseSubjects(organisationId(r),courseId(r),subjectId(r))
  }
}

object CourseSubjectsRepository extends CourseSubjectsRepository with RootConnector {
  override lazy val tableName = "coursesubjects"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(courseSubjects: CourseSubjects): Future[ResultSet] = {
    insert
      .value(_.organisationId, courseSubjects.organisationId)
      .value(_.courseId, courseSubjects.courseId)
      .value(_.subjectId, courseSubjects.subjectId)
      .future()
  }

  def findById(organisationId: String, courseId: String, subjectId: String):Future[Option[CourseSubjects]] = {
    select.where(_.organisationId eqs organisationId). and (_.courseId eqs courseId). and (_.subjectId eqs subjectId).one()
  }
  def findAll: Future[Seq[CourseSubjects]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getCourseSubjects(organisationId: String): Future[Seq[CourseSubjects]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }
  def deleteById(organisationId:String, courseId: String, subjectId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId). and (_.courseId eqs courseId). and (_.subjectId eqs subjectId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:50,代码来源:CourseSubjectsRepository.scala


示例12: CourseCategoryRepository

//设置package包名称以及导入依赖的类
package repositories.training.courses
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.training.courses.CourseCategory

import scala.concurrent.Future

class CourseCategoryRepository  extends CassandraTable[CourseCategoryRepository,CourseCategory]{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object courseCategoryId extends StringColumn(this) with PrimaryKey[String]
  object name extends StringColumn(this)

  override def fromRow(r: Row): CourseCategory = {
    CourseCategory(organisationId(r),courseCategoryId(r),name(r))
  }
}

object CourseCategoryRepository extends CourseCategoryRepository with RootConnector {
  override lazy val tableName = "coursecategory"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(courseCategory: CourseCategory): Future[ResultSet] = {
    insert
      .value(_.organisationId, courseCategory.organisationId)
      .value(_.courseCategoryId, courseCategory.courseCategoryId)
      .value(_.name, courseCategory.name)
      .future()
  }

  def findById(organisationId: String, courseCategoryId: String):Future[Option[CourseCategory]] = {
    select.where(_.organisationId eqs organisationId). and (_.courseCategoryId eqs courseCategoryId).one()
  }
  def findAll: Future[Seq[CourseCategory]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getCourseCategory(organisationId: String): Future[Seq[CourseCategory]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }
  def deleteById(organisationId:String, courseCategoryId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId). and (_.courseCategoryId eqs courseCategoryId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:50,代码来源:CourseCategoryRepository.scala


示例13: CourseTypeRepository

//设置package包名称以及导入依赖的类
package repositories.training.courses
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.training.courses.CourseType

import scala.concurrent.Future

class CourseTypeRepository extends CassandraTable[CourseTypeRepository,CourseType]{
  object courseTypeId extends StringColumn(this) with PartitionKey[String]
  object name extends StringColumn(this)

  override def fromRow(r: Row): CourseType = {
    CourseType(courseTypeId(r),name(r))
  }
}

object CourseTypeRepository extends CourseTypeRepository with RootConnector {
  override lazy val tableName = "coursetype"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(courseType: CourseType): Future[ResultSet] = {
    insert
      .value(_.courseTypeId, courseType.courseTypeId)
      .value(_.name, courseType.name)
      .future()
  }

  def findById(courseTypeId: String):Future[Option[CourseType]] = {
    select.where(_.courseTypeId eqs courseTypeId).one()
  }
  def findAll: Future[Seq[CourseType]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getCourseType(courseTypeId: String): Future[Seq[CourseType]] = {
    select.where(_.courseTypeId eqs courseTypeId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(courseTypeId:String): Future[ResultSet] = {
    delete.where(_.courseTypeId eqs courseTypeId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:49,代码来源:CourseTypeRepository.scala


示例14: SubjectRepository

//设置package包名称以及导入依赖的类
package repositories.training.courses
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.training.courses.Subject

import scala.concurrent.Future

class SubjectRepository extends CassandraTable[SubjectRepository,Subject]{
  object subjectId extends StringColumn(this) with PartitionKey[String]
  object topic extends StringColumn(this)
  object subjectCode extends StringColumn(this)
  object description extends StringColumn(this)
  object credit extends IntColumn(this)


  override def fromRow(r: Row): Subject = {
    Subject(subjectId(r), subjectCode(r),subjectCode(r), description(r),credit(r))
  }
}

object SubjectRepository extends SubjectRepository with RootConnector {
  override lazy val tableName = "subject"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(subject: Subject): Future[ResultSet] = {
    insert
      .value(_.subjectId, subject.subjectId)
      .value(_.topic, subject.topic)
      .value(_.subjectCode, subject.subjectCode)
      .value(_.description, subject.description)
      .value(_.credit, subject.credit)
      .future()
  }

  def findById(subjectId: String):Future[Option[Subject]] = {
    select.where(_.subjectId eqs subjectId).one()
  }
  def findAll: Future[Seq[Subject]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getSubject(subjectId: String): Future[Seq[Subject]] = {
    select.where(_.subjectId eqs subjectId).fetchEnumerator() run Iteratee.collect()
  }


  def deleteById(subjectId:String): Future[ResultSet] = {
    delete.where(_.subjectId eqs subjectId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:57,代码来源:SubjectRepository.scala


示例15: CourseFundingRepository

//设置package包名称以及导入依赖的类
package repositories.training.schedules
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.training.schedules.CourseFunding

import scala.concurrent.Future

class CourseFundingRepository extends CassandraTable[CourseFundingRepository,CourseFunding]{
  object scheduledCourseId extends StringColumn(this) with PartitionKey[String]
  object fundingSourcesId extends StringColumn(this)  with PrimaryKey[String]
  object amount extends BigDecimalColumn(this)
  object currencyId extends StringColumn(this)

  override def fromRow(r: Row): CourseFunding = {
    CourseFunding(scheduledCourseId(r),fundingSourcesId(r),amount(r), currencyId(r))
  }
}

object CourseFundingRepository extends CourseFundingRepository with RootConnector {
  override lazy val tableName = "coursefunding"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(courseFunding: CourseFunding): Future[ResultSet] = {
    insert
      .value(_.scheduledCourseId, courseFunding.scheduledCourseId)
      .value(_.fundingSourcesId, courseFunding.fundingSourcesId)
      .value(_.amount, courseFunding.amount)
      .value(_.currencyId, courseFunding.currencyId)
      .future()
  }

  def findById(scheduledCourseId: String, fundingSourcesId: String):Future[Option[CourseFunding]] = {
    select.where(_.scheduledCourseId eqs scheduledCourseId). and(_.fundingSourcesId eqs fundingSourcesId).one()
  }
  def findAll: Future[Seq[CourseFunding]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getCourseFunding(scheduledCourseId: String): Future[Seq[CourseFunding]] = {
    select.where(_.scheduledCourseId eqs scheduledCourseId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(scheduledCourseId:String,fundingSourcesId: String): Future[ResultSet] = {
    delete.where(_.scheduledCourseId eqs scheduledCourseId). and(_.fundingSourcesId eqs fundingSourcesId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:53,代码来源:CourseFundingRepository.scala


示例16: FileMetaRepository

//设置package包名称以及导入依赖的类
package repositories.storage


import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.storage.FileMeta

import scala.concurrent.Future


class FileMetaRepository extends CassandraTable[FileMetaRepository, FileMeta]
{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object fileName extends StringColumn(this)
  object contentType extends StringColumn(this)

  override def fromRow(r: Row): FileMeta=
  {
    FileMeta(
      organisationId(r),
      fileName(r),
      contentType(r)
    )
  }
}
object FileMetaRepository extends FileMetaRepository with RootConnector
{
  override lazy val tableName = "filemeta"
  override implicit def space: KeySpace = DataConnection.keySpace
  override implicit def session: Session = DataConnection.session

  def save(fileResults: FileMeta): Future[ResultSet] =
  {
    insert
      .value(_.organisationId, fileResults.organisationId)
      .value(_.fileName, fileResults.fileName)
      .value(_.contentType, fileResults.contentType)
      .future()
  }

  def getFileResultById(organisationId: String): Future[Option[FileMeta]] = {
    select.where(_.organisationId eqs organisationId).one()
  }

  def findAll: Future[Seq[FileMeta]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getFileMeta(organisationId: String): Future[Seq[FileMeta]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(organisationId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:60,代码来源:FileMetaRepository.scala


示例17: FileResultsRepository

//设置package包名称以及导入依赖的类
package repositories.storage


import domain.storage.FileResults
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import scala.concurrent.Future


class FileResultsRepository extends CassandraTable[FileResultsRepository, FileResults]
{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object fileResultsId extends StringColumn(this)  with PrimaryKey[String]
  object url extends StringColumn(this)
  object size extends OptionalStringColumn(this)

  override def fromRow(r: Row): FileResults=
  {
    FileResults(
      fileResultsId(r),
      fileResultsId(r),
      url(r),
      size(r)
    )
  }
}
object FileResultsRepository extends FileResultsRepository with RootConnector
{
  override lazy val tableName = "fileresults"
  override implicit def space: KeySpace = DataConnection.keySpace
  override implicit def session: Session = DataConnection.session

  def save(fileResults: FileResults): Future[ResultSet] =
  {
    insert
      .value(_.organisationId, fileResults.organisationId)
      .value(_.fileResultsId, fileResults.fileResultsId)
      .value(_.url, fileResults.url)
      .value(_.size, fileResults.size)
      .future()
  }

  def getFileResultById(organisationId: String, fileResultsId: String): Future[Option[FileResults]] = {
    select.where(_.organisationId eqs organisationId).and (_.fileResultsId eqs fileResultsId).one()
  }

  def findAll: Future[Seq[FileResults]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getFileResults(organisationId: String): Future[Seq[FileResults]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(organisationId: String, fileResultsId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId).and (_.fileResultsId eqs fileResultsId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:62,代码来源:FileResultsRepository.scala


示例18: UserContactRepository

//设置package包名称以及导入依赖的类
package repositories.users
import com.datastax.driver.core.Row
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.dsl._
import com.websudos.phantom.keys.PartitionKey
import com.websudos.phantom.reactivestreams._
import conf.connection.DataConnection
import domain.users.UserContact

import scala.concurrent.Future

class UserContactRepository extends CassandraTable[UserContactRepository,UserContact]{
  object organisationId extends StringColumn(this) with PartitionKey[String]
  object userId extends StringColumn(this)with PrimaryKey[String]
  object userContactId extends StringColumn(this) with PrimaryKey[String]
  object contactTypeId extends StringColumn(this)
  object details extends MapColumn[UserAddressRepository,UserContact, String, String](this)
  object date extends DateTimeColumn(this)
  object state extends StringColumn(this)

  override def fromRow(r: Row): UserContact = {
    UserContact(organisationId(r), userId(r), userContactId(r), contactTypeId(r), details(r), date(r), state(r))
  }
}

object UserContactRepository extends UserContactRepository with RootConnector {
  override lazy val tableName = "usercontact"

  override implicit def space: KeySpace = DataConnection.keySpace

  override implicit def session: Session = DataConnection.session

  def save(userContact: UserContact): Future[ResultSet] = {
    insert
      .value(_.organisationId, userContact.organisationId)
      .value(_.userId, userContact.userId)
      .value(_.userContactId, userContact.userContactId)
      .value(_.contactTypeId, userContact.contactTypeId)
      .value(_.details, userContact.details)
      .value(_.date, userContact.date)
      .value(_.state, userContact.state)
      .future()
  }

  def findById(organisationId: String, userId: String, userContactId: String):Future[Option[UserContact]] = {
    select.where(_.organisationId eqs organisationId). and(_.userId eqs userId). and (_.userContactId eqs userContactId).one()
  }
  def findAll: Future[Seq[UserContact]] = {
    select.fetchEnumerator() run Iteratee.collect()
  }
  def getUserContact(organisationId: String): Future[Seq[UserContact]] = {
    select.where(_.organisationId eqs organisationId).fetchEnumerator() run Iteratee.collect()
  }

  def deleteById(organisationId:String, userId: String, userContactId: String): Future[ResultSet] = {
    delete.where(_.organisationId eqs organisationId). and(_.userId eqs userId). and (_.userContactId eqs userContactId).future()
  }
} 
开发者ID:Masebeni,项目名称:hwork,代码行数:59,代码来

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Scala read类代码示例发布时间:2022-05-23
下一篇:
Scala Right类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap