This repository has been archived by the owner on Sep 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
[master < E-util-docs] Write docs for util module #1012
Open
mpintaric55334
wants to merge
7
commits into
master
Choose a base branch
from
E-mage-add-util-functions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ab30229
Write docs for util module
mpintaric55334 711da31
Add link
mpintaric55334 880ecad
Apply suggestions from code review
vpavicic 94c2e71
Update util_module.md
mpintaric55334 fb5af10
Minor fixes
mpintaric55334 a53e099
Minor fixes
mpintaric55334 af083b0
change-to-utli
vpavicic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
id: util_module | ||
title: util_module | ||
sidebar_label: util_module | ||
--- | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
import RunOnSubgraph from '../../templates/_run_on_subgraph.mdx'; | ||
|
||
export const Highlight = ({children, color}) => ( | ||
<span | ||
style={{ | ||
backgroundColor: color, | ||
borderRadius: '2px', | ||
color: '#fff', | ||
padding: '0.2rem', | ||
}}> | ||
{children} | ||
</span> | ||
); | ||
|
||
The util module provides a set of handy functions for tasks like validation and generating cryptographic hash values. It's a valuable toolkit for simplifying various database-related operations. | ||
|
||
[![docs-source](https://img.shields.io/badge/source-util_module-FB6E00?logo=github&style=for-the-badge)](https://github.com/memgraph/mage/tree/main/cpp/util_module) | ||
|
||
| Trait | Value | | ||
| ------------------- | ----------------------------------------------------- | | ||
| **Module type** | <Highlight color="#FB6E00">**algorithm**</Highlight> | | ||
| **Implementation** | <Highlight color="#FB6E00">**C++**</Highlight> | | ||
| **Graph direction** | <Highlight color="#FB6E00">**directed**</Highlight>/<Highlight color="#FB6E00">**undirected**</Highlight> | | ||
| **Edge weights** | <Highlight color="#FB6E00">**weighted**</Highlight>/<Highlight color="#FB6E00">**unweighted**</Highlight> | | ||
| **Parallelism** | <Highlight color="#FB6E00">**sequential**</Highlight> | | ||
|
||
### Procedures | ||
|
||
|
||
### `md5(values)` | ||
|
||
Gets the string representation of every element in the input list, concatenates it into a single string, and returns the md5 hash of that string. | ||
NOTE: The format of string representations can be seen by checking ToString in CPP API documentation([cpp-api](/memgraph/reference-guide/query-modules/api/cpp-api)) for desired type or Value. | ||
vpavicic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#### Input: | ||
vpavicic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- `values: List[Any]` ➡ input list containing elements which can be any of Memgraph's data types. | ||
|
||
|
||
vpavicic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### Output: | ||
|
||
- `result: string` ➡ resulting md5 hash returned as string. | ||
|
||
#### Usage: | ||
|
||
NOTE: Hash provided in this documentation will be different from user's hash for same input, unless the node has the same ID, because `Node.ToString()` uses node's id in string formation, so different ID's equal different strings, hence, different hashes. | ||
vpavicic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```cypher | ||
CREATE (d:Dog); | ||
MATCH (d:Dog) | ||
CALL util_module.md5([d, "string", 50]) YIELD result RETURN result; | ||
``` | ||
|
||
```plaintext | ||
+-----------------------------------+ | ||
| result | | ||
+-----------------------------------+ | ||
| 47e656a5f446fc21316e97df90e8ae33 | | ||
+-----------------------------------+ | ||
``` |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it would be worthy to give an example of when this is valuable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly have no idea for what purpose the people who requested the function use it, could be password hashing, hash tables etc., so I will rephrase it differently