Trait

com.sandinh.couchbase.access

WithCaoKey1

Related Doc: package access

Permalink

trait WithCaoKey1[T, A, U, D <: Document[U]] extends CaoTrait[T, A, U, D]

This trait has a similar interface as CaoBase but: + Has an additional abstract method def key(a: A): String + When interact (get/set/update/..) with couchbase server, instead of

get(docId: String): Future[T]
set(docId: String, t: T): Future[D]

as in CaoBase, we can:

get(a): Future[T]
set(a: A, t: T): Future[D]

So, instead of working with docId: String directly, we can create a Cao (Couchbase Access Object) for own type T (ex UserCao for T=case class User(uid: Long,...)) , and in UserCao, we define def key(uid: Long) = s"my_prefix$id" , then using set/get/.. with uid: Long instead of docId: String To able to do that, we need implement this class' abstract methods: reads(u: U): T and writes(t: T): U

T

type that will be encoded before upsert using writes(t: T): U, and decoded after get using reads(u: U): T

U

the Document's content type, ex JsValue, primitive types,.. See classes that implement com.couchbase.client.java.document.Document for all available type (of course you can implement your own)

D

the Document type

Linear Supertypes
CaoTrait[T, A, U, D], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WithCaoKey1
  2. CaoTrait
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final type DocumentCAS = (T, Long)

    Permalink
    Definition Classes
    CaoTrait

Abstract Value Members

  1. abstract def createDoc(id: String, expiry: Int, content: U, cas: Long = 0L): D

    Permalink
    Attributes
    protected
    Definition Classes
    CaoTrait
  2. abstract def key(a: A): String

    Permalink
    Attributes
    protected
  3. abstract def reads(u: U): T

    Permalink
    Attributes
    protected
    Definition Classes
    CaoTrait
  4. abstract def writes(t: T): U

    Permalink
    Attributes
    protected
    Definition Classes
    CaoTrait

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. final def change(a: A)(f: (Option[T]) ⇒ T): Future[D]

    Permalink
  6. final def changeBulk(aa: Seq[A])(f: (Option[T]) ⇒ T): Future[Seq[D]]

    Permalink
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def expiry(): Int

    Permalink
    Attributes
    protected
    Definition Classes
    CaoTrait
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def flatChange(a: A)(f: (Option[T]) ⇒ Future[T]): Future[D]

    Permalink
  13. final def flatChangeBulk(aa: Seq[A])(f: (Option[T]) ⇒ Future[T]): Future[Seq[D]]

    Permalink
  14. final def get(a: A): Future[T]

    Permalink
    Definition Classes
    WithCaoKey1 → CaoTrait
  15. final def getBulk(aa: Seq[A]): Future[Seq[T]]

    Permalink
  16. final def getBulkWithCAS(aa: Seq[A]): Future[Seq[DocumentCAS]]

    Permalink
  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def getOrElse(a: A)(default: ⇒ T): Future[T]

    Permalink
    Definition Classes
    WithCaoKey1 → CaoTrait
  19. final def getOrElseWithCAS(a: A)(default: ⇒ T): Future[DocumentCAS]

    Permalink
    Definition Classes
    WithCaoKey1 → CaoTrait
  20. final def getWithCAS(a: A): Future[(T, Long)]

    Permalink
    Definition Classes
    WithCaoKey1 → CaoTrait
  21. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  22. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  23. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  26. final def remove(a: A): Future[D]

    Permalink
    Definition Classes
    WithCaoKey1 → CaoTrait
  27. final def set(a: A, t: T): Future[D]

    Permalink
    Definition Classes
    WithCaoKey1 → CaoTrait
  28. final def setBulk(aa: Seq[A], tt: Seq[T]): Future[Seq[D]]

    Permalink
  29. final def setT(a: A, t: T): Future[T]

    Permalink

    convenient method.

    convenient method. = set(..).map(_ => t)

    Definition Classes
    WithCaoKey1 → CaoTrait
  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  31. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  32. final def update(a: A, t: T, cas: Long = 0): Future[D]

    Permalink
    Definition Classes
    WithCaoKey1 → CaoTrait
  33. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. final def updateWithCAS(a: A, t: T, cas: Long = 0): Future[D]

    Permalink

    Deprecated

    use update instead

Inherited from CaoTrait[T, A, U, D]

Inherited from AnyRef

Inherited from Any

Ungrouped