Releases: longevityframework/longevity
Replace Custom Test Data Generation with ScalaCheck Shapeless
[0.27.0] - 2018.07.01 - Replace Custom Test Data Generation with ScalaCheck Shapeless
This is the first baby step in replacing custom reflection-based code with
shapeless.
- 2017.10.26 -
longevity.model.PType[M, P]now has an abstract member with type
longevity.model.PEv[M, P]. This is filled in by the@longevity.model.annotations.persistent
family of annotations, so it is not a concern to you if you are using these annotations to
construct yourPTypes. If not, you might consider using the new
@longevity.model.annotations.pEvannotation to create thePEvfor you. - 2017.10.26 - Traits for polymorphic persistent and component types - typically declared via
annotations@longevity.model.annotations.polyPersistentand
@longevity.model.annotations.polyComponent- now need to be sealed. This will require moving
subtypes into the same file. - 2017.10.26 - The
longevity.test.TestDataGeneratorAPI has been simplified. If you were using
this class in a way for which the new version is no longer sufficient, please let us know, and we
will see what we can do to help you out. - 2018.06.07 - Classes
longevity.test.CustomGeneratorandlongevity.test.CustomGeneratorPool
have been removed. Custom test generation to account for constraints enforced within your domain
model can now be accomplished using ScalaCheck'sArbitraryand
Gen, See the user manual page on enforcing
constraints for more information.
Initial Version of Migration Framework
0.26.0 create tag 0.26.0
Fix for issue #39 - Controlled vocabularies not working
Small Improvements
- 2016.07.12 - Add some specialized "implicit not found" error messages for implicit types in
longevity.model. - 2016.07.12 - Reverse order of implicits for
Repo.retrieveandRepo.retrieveOnemethods. This
way, we get "implicit not found" compiler errors for thePEvbefore theKey. This will give
more relevant error messages when the retrieve methods are called without explicating thePtype
parameter. - 2016.07.12 - Rename
PState.maptoPState.modify. This follows more standard lense-type
terminology, and removes the incorrect impression that this is a monadic method. - 2016.07.24 - Add
PState.modifyF, which acts likemodify, except for functions that return an
effectful result.
Generic Effects with Finally Tagless
- 2017.06.14 - Rename config flag
autocreateSchematoautoCreateSchema. - 2017.06.14 - Add config flag
autoOpenConnection. - 2017.06.15 - Add API method
Repo.openConnection. - 2017.06.15 - Rename API method
Repo.closeSessiontoRepo.closeConnection. - 2017.06.16 - Add config flag
cassandra.autoCreateKeyspace. - 2017.06.19 - Rename
longevity.config.LongevityConfig.apply(com.typesafe.config.Config)to
LongevityConfig.fromTypesafeConfig. This was necessary to prevent the library we use to parse
the Typesafe config from infinite looping on a configuration error. - 2017.06.29 - Remove
longevity.persistent.FOPStateand variants. Now that we have generalized
effects, these classes are special case. And they already take up a lot of space in API. - 2017.06.29 - Remove method
longevity.persistent.Repo.createManyand related
longevity.persistent.PWithEv. These provided very little value added at the expense of
cluttering the API with confusing stuff. - 2017.07.06 - Replace hardcoded
Futureeffect with generic effectFin
longevity.context.LongevityContextandlongevity.persistence.Repo.
Use Type Classes to Improve Type Safety of Persistent API
The changes in this release are many, and the overall picture is hard to grasp by looking through a
bullet list of the changes. For this reason, we present a quick migration guide here to get you from
0.22 to 0.23. Making the changes in the migration guide will probably get you 95-100% of the way there.
Quick Migration Guide
-
Replace this:
@domainModel object MyModelwith this:
@domainModel trait MyModel -
Replace
@persistentwith@persistent[MyModel],@componentwith@component[MyModel], and
@keyVal[P]with@keyVal[MyModel, P] -
Remove the
keySet = Set(key(props.a), key(props.b))as an argument to the@persistentannotation. Put the following lines in the companion object for your persistent class instead:implicit val aKey = key(props.a)
implicit val bKey = key(props.b) -
Replace this:
val context = LongevityContext(MyModel)with this:
val context = LongevityContext[MyModel]() -
Replace references to
Repo[P]withRepo[MyModel] -
Replace calls like this:
context.repoPool[P]with this:
context.repo -
For repository methods
createSchemaandcloseSession, replace calls like this:context.repoPool.createSchema()with call chains like this:
context.repo.createSchema()
Changes
-
Merge
longevity.persistence.Repoandlongevity.persistence.RepoPoolAPIs. There is now single repository, and the create/retrieve/update/delete/query methods now all take the persisten type as a type parameter. To migrate, code that used to look like this:longevityContext.repoPool[User].create(user)now looks like this:
longevityContext.repo.create[User](user)In most cases, you can leave off type parameter, as the compiler can easily infer it:
longevityContext.repo.create(user) -
Replace
longevity.model.DomainModelwith alongevity.model.ModelTypetype-class. Everything that used to live inDomainModelnow lives inModelType.
longevity.model.annotations.domainModelnow annotates a marker class or trait, instead of the object that was to become the oldDomainModel. This annotation macro adds animplicit object modelTypeinto the companion object of the annotated class.ModelTypenow takes a type parameterMthat refers to the phantom class annotated withdomainModel.longevity.context.LongevityContextnow takes a type parameterMfor the model class. In place of the explicitDomainModelargument, it now takes an implicitModelType[M], which can easily be found in the companion object ofM, as built by the annotation macro.longevity.context.Repoalso now takes a type parameterM. -
Add
longevity.model.ModelEvtype-class. ("Ev" is short for "evidence" here.) Thelongevity.model.annotations.domainModelannotation macro now adds animplicit object modelEvinto the companion object of the annotated class. This evidence class is private to the package that the domain model is found in.longevity.model.PTypenow has a type parameterMfor the model, and an implicitModelEv[M]is required to initialize aPType[M, P]. Because the generated model evidence is private to the model package, persistent types outside of the model package will not find the evidence, and will fail to compile. This prevents the user from accidentally creating a persistent type that falls outside the model. -
Add
longevity.model.PEvtype-class. ("Ev" is short for "evidence" here.) Thelongevity.model.PTypenow includes animplicit val ev: PEv[M, P]. Because the companion object of a persistent class is normally the correspondingPType, this evidence should be available where needed.longevity.persistence.Repomethods that used to take an implicitTypeKey[P]argument, now take an implicitPEv[M, P]argument. As users will not be able to find an implicitPEv[M, P]available without the typePactually being part of the model, (excepting the case where the user goes to extended lengths to subvert our type system), it will now be a compile-time error to call these repository methods with a non-persistent object. This is a great improvement over the old situation, since aTypeKey[P]is available for any typePfor which there is aTypeTag[P]available. -
Replace
longevity.model.KeyVal[P]withlongevity.model.KVType[M, P, V], which includes an implicit vallongevity.model.KVEv[M, P, V].@longevity.model.annotations.keyValnow takes a type parameterMalong with the type parameterP. The@keyValannotation now creates or augments the companion object as aKVType[M, P, V]. -
Methods
PType.keyandPType.primaryKeynow take implicitKVEvarguments, to make sure the key value type provided matches aKVTypethat is provided to theModelType. -
The old constructors and factory methods for creating a
longevity.model.ModelTypehave been replaced with a single constructor that takes lists oflongevity.model.PTypes,longevity.model.CTypes, andlongevity.model.KVTypes. The runtime package scanning constructor has been replaced by a compile-time package scanning. The new scanner,longevity.model.annotations.packscanToList, is used bylongevity.model.annotations.domainModel, but you can use it yourself if you like. If you have been using the@domainModelannotation, these changes should not affect you. -
longevity.model.PTypePoolandlongevity.model.CTypePoolhave been removed. -
Instead of passing in a
keySetto the@persistentannotation, users should now specify their keys themselves, directly in the body of the companion object, as implicit values. ThePType.keySethas been made private, and is populated by reflecting on the members of the companion object. -
Methods
longevity.persistence.Repo.retrieveandlongevity.persistence.Repo.retrieveOnenow take an implicitKey[M, P, V]instead of an implicitTypeKey[V]. This will typically be found by implicit resolution in the companion object ofP. -
Remove method
longevity.model.PType.prop. You can extendlongevity.model.ptype.Propinstead, but note that we advise you to use thelongevity.model.annotations.persistentannotation to generate properties.
Stream Queries to Multiple Streaming Libraries
[0.22.0] - 2017.03.25 - Stream Queries to Multiple Streaming Libraries
- 2017.03.24 - Rename
Repo.retrieveByQuerytoRepo.queryToFutureVec. The return type of this
method has also been adjusted fromFuture[Seq[PState[P]]]toFuture[Vector[PState[P]]]. - 2017.03.24 - Add method
Repo.queryToItereator. - 2017.03.24 - Rename
Repo.streamByQuerytoRepo.queryToAkkaStream. - 2017.03.24 - Add method
Repo.queryToFS2. - 2017.03.24 - Add method
Repo.queryToIterateeIo. - 2017.03.24 - Add method
Repo.queryToPlay.
JDBC Back End and Timestamps
[0.21.0] - 2017.03.04 - JDBC Back End and Timestamps
- 2017.02.08 - Add new
JDBCback end. - 2017.02.06 - Rename
longevity.config.SQLiteConfigto
JdbcConfig. Renamelongevity.config.LongevityConfig.sqliteto
jdbc. Renamelongevity.config.TestConfig.sqlitetojdbc. - 2017.02.15 - Add configuration flag
longevity.writeTimestamps.
SQLite Back End
[0.20.0] - 2017.01.16 - SQLite Back End
- 2017.01.12 - Rename dependency bundle artifact from
longevity-mongo-depstolongevity-mongodb-deps. - 2017.01.12 - Rename
longevity.config.Mongoto
longevity.config.MongoDB. Renamelongevity.config.MongoConfigto
longevity.config.MongoBDConfig. - 2017.01.14 - Add SQLite back end. See
longevity.config.SQLiteand
longevity.config.SQLiteConfig. - 2017.01.14 - Rename
longevity.model.PType.partitionKeyto
primaryKey.
Rename Subdomain to Domain Model
[0.19.0] - 2016.12.09 - Rename Subdomain to Domain Model
- 2016.12.09 - Rename package
longevity.subdomainto
longevity.model. Alsolongevity.exceptions.subdomainto
longevity.exceptions.model. - 2016.12.09 - Rename
longevity.model.Subdomainto
DomainModel. - 2016.12.09 - Rename annotation
longevity.model.annotations.subdomaintodomainModel. - 2016.12.09 - Move config classes
LongevityConfig,BackEnd,
MongoConfig,CassandraConfig,TestConfig, and
PersistenceConfigfrom packagelongevity.contextto new package
longevity.config.