-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jacodb-core] Make RAM benchmarks depending on the downloadAndUnzipIdeaCommunity task [jacodb-core] In RegisteredLocation.lazySources, never return sources with loaded bytecode [jacodb-api] Add typed ERS API for range queries [jacodb-core] On closing persistence, close symbol interner, don't setup [jacodb-core] Fix HierarchyExtensionERS to not returning EntityIterable accessible outside a transaction [jacodb-core] Fix JCDBSymbolsInternerImpl.setup() atop of KVEntityRelationshipStorage [jacodb-core] In ErsPersistenceImpl.read(), use optimistic transactions only for RAMEntityRelationshipStorage [jacodb-core] Fix HierarchyExtension working with ERS API persistence without installed InMemoryHierarchy feature The "inherits" relation is being saved using property name. The "implements" relation is being saved using two-way entity links with dedicate entity of type "Interface". [jacodb-core] Avoid duplicates in output of HierarchyExtension.findOverrides() implemented with ERS API [jacodb-core] Add RestoredXodusDBTest [jacodb-core] Fix and optimize JcClasspath.allClassesExceptObject() in noSqlAction [jacodb-core] Fix InMemoryHierarchy's BeforeIndexing noSqlAction
- Loading branch information
Showing
13 changed files
with
182 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ Inside the entity type, you can declare which properties and links it has: | |
object UserType : ErsType { | ||
val login by property(String::class) | ||
val password by property(String::class) | ||
val age by property(Int::class) | ||
val avatar by property(ByteArray::class, searchability = ErsSearchability.NonSearchable) | ||
val profile by link(UserProfileType) | ||
} | ||
|
@@ -70,7 +71,18 @@ Next, you can: | |
|
||
Currently, there are two basic queries available on the instance of `Transaction`: | ||
|
||
There are the following basic queries available on the instance of `Transaction`: | ||
|
||
- `Transaction.all()` gets all entities of specified type; | ||
- `Transaction.find()` gets entities with specified property equal to specified value; | ||
- `Transaction.findLt()` gets entities with specified property less than specified value; | ||
- `Transaction.findEqOrLt()` gets entities with specified property equal to or less than specified | ||
value; | ||
- `Transaction.findGt()` gets entities with specified property greater than specified value; | ||
- `Transaction.findEqOrGt()` gets entities with specified property equal to or greater than specified | ||
value. | ||
|
||
Simple examples: | ||
1. Enumerate all users: | ||
```kotlin | ||
txn.all(UserType).forEach { user -> | ||
|
@@ -83,3 +95,29 @@ Currently, there are two basic queries available on the instance of `Transaction | |
// ... | ||
} | ||
``` | ||
3. Enumerate all users having age equal to or less than 42: | ||
```kotlin | ||
txn.findEqOrLt(UserType.age, 42).forEach { user -> | ||
// ... | ||
} | ||
``` | ||
|
||
Queries return instances of `TypedEntityIterable<ENTITY_TYPE>`. `TypedEntityIterable<ENTITY_TYPE>` is | ||
`Iterable<TypedEntity<ENTITY_TYPE>>`. In addition, there are tree binary operations on instances of `EntityIterable`: | ||
_intersect_, _union_ (`+`) and _minus_ (`-`). | ||
|
||
**NOTE:** some ERS implementations can use two consecutive queries to implement these operations. | ||
|
||
Query combination examples: | ||
1. To get users with age `42` _and_ having login `[email protected]`: | ||
```kotlin | ||
val users = txn.find(UserType.age, 42).intersect(txn.find(UserType.login, "[email protected]")) | ||
``` | ||
2. To get users with age equal to or greater than `42` _or_ having login `[email protected]`: | ||
```kotlin | ||
val users = txn.findEqOrGt(UserType.age, 42) + txn.find(UserType.login, "[email protected]") | ||
``` | ||
3. To get users with age greater than `42` _not_ having login `[email protected]`: | ||
```kotlin | ||
val users = txn.findGt(UserType.age, 42) - txn.find(UserType.login, "[email protected]") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.