-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
45 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
package dev.qixils.quasicord.db | ||
|
||
// TODO: unique | ||
|
||
/** | ||
* Defines an index for a collection. | ||
* You may define multiple indexes. | ||
*/ | ||
@Repeatable | ||
annotation class Index(vararg val value: IndexKey) | ||
annotation class Index( | ||
/** | ||
* Whether this index is unique, meaning no two objects can share the same key values. | ||
*/ | ||
val unique: Boolean = false, | ||
/** | ||
* The keys to index against. | ||
*/ | ||
vararg val value: IndexKey, | ||
) |
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 |
---|---|---|
@@ -1,5 +1,30 @@ | ||
package dev.qixils.quasicord.db | ||
|
||
enum class IndexKeyOrder{ ASCENDING, DESCENDING } | ||
/** | ||
* The order in which to sort the values of a key. | ||
*/ | ||
enum class IndexKeyOrder { | ||
/** | ||
* Sorts in ascending order. | ||
*/ | ||
ASCENDING, | ||
/** | ||
* Sorts in descending order. | ||
*/ | ||
DESCENDING, | ||
} | ||
|
||
annotation class IndexKey(val value: String, val order: IndexKeyOrder = IndexKeyOrder.ASCENDING) | ||
/** | ||
* A key by which to index. | ||
*/ | ||
annotation class IndexKey( | ||
/** | ||
* The field to index. For a parameter `snowflake`, this would be `snowflake`. | ||
* For a parameter `id` within a parameter `where`, this would be `where.id`. | ||
*/ | ||
val value: String, | ||
/** | ||
* The order in which to sort the values. | ||
*/ | ||
val order: IndexKeyOrder = IndexKeyOrder.ASCENDING, | ||
) |
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