Skip to content

Document key validation and comparison key_def module functions #4111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TarantoolBot opened this issue Mar 27, 2024 · 0 comments · Fixed by #5131
Closed

Document key validation and comparison key_def module functions #4111

TarantoolBot opened this issue Mar 27, 2024 · 0 comments · Fixed by #5131
Assignees
Labels
3.1 reference [location] Tarantool manual, Reference part

Comments

@TarantoolBot
Copy link
Collaborator

TarantoolBot commented Mar 27, 2024

Related dev. issue(s): tarantool/tarantool#9863

Product: Tarantool
Since: 3.1
Root document: https://www.tarantool.io/en/doc/latest/reference/reference_lua/key_def/
SME: @ locker

Details

The following new functions were introduced to the key_def Lua module:

  • key_def:validate_key(key): validates a key against a key definition
    object. Raises an exception if the key doesn't match. Returns nothing
    on success. See also box_key_def_validate_key C API function.

  • key_def:validate_full_key(key): validates a full key against a key
    definition object. Raises an exception if the key doesn't match.
    Returns nothing on success. See also box_key_def_validate_full_key
    C API function.

  • key_def:validate_tuple(tuple): validates a tuple against a key
    definition object. Raises an exception if the tuple doesn't match.
    Returns nothing on success. See also box_key_def_validate_tuple
    C API function.

  • key_def:compare_keys(key_a, key_b): compares two keys according to
    a key definition object. Raises an exception if any of the given key
    doesn't match the key definition. On success, returns a value <0 if
    key_a parts are less than key_b parts, 0 if equal, >0 if greater.
    Requested by @ locker in tarantool/tarantool@7e5881e.

@andreyaksenov andreyaksenov self-assigned this Apr 4, 2024
@andreyaksenov andreyaksenov added 3.1 reference [location] Tarantool manual, Reference part labels Apr 4, 2024
@andreyaksenov andreyaksenov removed their assignment Apr 5, 2024
AArdeev added a commit that referenced this issue May 26, 2025
…t the ```key_def``` object rules

Since 3.1.0, new functions are added to ```key_def``` module.
```validate_key(key)``` - validates input key against the rules
```validate_full_key(key)``` - validates input key's all fields against the rules
```compare_keys(key_a, key_b)``` - Compares two keys against each other and the rules
```validate_tuple(tuple)``` - validates the tuple against the rules
Fixes #4111
AArdeev added a commit that referenced this issue May 27, 2025
* Adds description of new ```key_def``` functions comparing data against the ```key_def``` object rules
* Since 3.1.0, new functions are added to ```key_def``` module.
   * ```validate_key(key)``` - validates input key against the rules
   * ```validate_full_key(key)``` - validates input key's all fields against the rules
   * ```compare_keys(key_a, key_b)``` - Compares two keys against each other and the rules
   * ```validate_tuple(tuple)``` - validates the tuple against the rules
* Fixes #4111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.1 reference [location] Tarantool manual, Reference part
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants