本文整理汇总了Scala中com.datastax.driver.core.Row类的典型用法代码示例。如果您正苦于以下问题:Scala Row类的具体用法?Scala Row怎么用?Scala Row使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Row类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}
示例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()
}
}