forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Table-Store (aka ORM) package - Index and Iterator (cosmos#…
…10451) <!-- The default pull request template is for types feat, fix, or refactor. For other templates, add one of the following parameters to the url: - template=docs.md - template=other.md --> ## Description ref: cosmos#9237, cosmos#9156 This PR is a follow-up of cosmos#10415 and cosmos#9751. It adds multi-key secondary indexes, iterator and pagination support. There will be one last follow-up PR for adding import/export genesis features. --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [x] included comments for [documenting Go code](https://blog.golang.org/godoc) - [x] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
- Loading branch information
Showing
30 changed files
with
3,231 additions
and
154 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package errors | ||
|
||
import "github.com/cosmos/cosmos-sdk/types/errors" | ||
|
||
// mathCodespace is the codespace for all errors defined in math package | ||
const mathCodespace = "math" | ||
|
||
// ErrInvalidDecString defines an error for an invalid decimal string | ||
var ErrInvalidDecString = errors.Register(mathCodespace, 10, "invalid decimal string") |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package errors | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/types/errors" | ||
) | ||
|
||
// mathCodespace is the codespace for all errors defined in orm package | ||
const ormCodespace = "orm" | ||
|
||
var ( | ||
// ErrORMIteratorDone defines an error when an iterator is done | ||
ErrORMIteratorDone = errors.Register(ormCodespace, 11, "iterator done") | ||
|
||
// ErrORMInvalidIterator defines an error for an invalid iterator | ||
ErrORMInvalidIterator = errors.Register(ormCodespace, 12, "invalid iterator") | ||
|
||
// ErrORMUniqueConstraint defines an error when a value already exists at a given key | ||
ErrORMUniqueConstraint = errors.Register(ormCodespace, 13, "unique constraint violation") | ||
|
||
// ErrORMInvalidArgument defines an error when an invalid argument is provided as part of ORM functions | ||
ErrORMInvalidArgument = errors.Register(ormCodespace, 14, "invalid argument") | ||
|
||
// ErrORMKeyMaxLength defines an error when a key exceeds max length | ||
ErrORMKeyMaxLength = errors.Register(ormCodespace, 15, "key exceeds max length") | ||
|
||
// ErrORMEmptyKey defines an error for an empty key | ||
ErrORMEmptyKey = errors.Register(ormCodespace, 47, "cannot use empty key") | ||
) |
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.