Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
163
Issues
163
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
47aa6cf9
Commit
47aa6cf9
authored
Jun 05, 2025
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better UniqParameter instance for Node and friends
parent
09d3152e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
Insert.hs
src/Gargantext/Database/Query/Table/Node/Document/Insert.hs
+9
-5
No files found.
src/Gargantext/Database/Query/Table/Node/Document/Insert.hs
View file @
47aa6cf9
...
@@ -72,7 +72,7 @@ import Gargantext.Database.Prelude
...
@@ -72,7 +72,7 @@ import Gargantext.Database.Prelude
import
Gargantext.Database.Schema.Node
(
NodePoly
(
..
))
import
Gargantext.Database.Schema.Node
(
NodePoly
(
..
))
import
Gargantext.Defaults
qualified
as
Defaults
import
Gargantext.Defaults
qualified
as
Defaults
import
Gargantext.Prelude
hiding
(
hash
,
toLower
)
import
Gargantext.Prelude
hiding
(
hash
,
toLower
)
import
Gargantext.Prelude.Crypto.Hash
(
hash
)
import
Gargantext.Prelude.Crypto.Hash
(
hash
,
Hash
)
{-| To Print result query
{-| To Print result query
import Data.ByteString.Internal (ByteString)
import Data.ByteString.Internal (ByteString)
...
@@ -221,9 +221,9 @@ instance UniqParameters HyperdataContact
...
@@ -221,9 +221,9 @@ instance UniqParameters HyperdataContact
where
where
uniqParameters
_
=
""
uniqParameters
_
=
""
instance
UniqParameters
(
Node
a
)
instance
UniqParameters
a
=>
UniqParameters
(
Node
a
)
where
where
uniqParameters
_
=
undefined
uniqParameters
=
uniqParameters
.
_node_hyperdata
filterText
::
Text
->
Text
filterText
::
Text
->
Text
...
@@ -232,9 +232,13 @@ filterText = DT.toLower . DT.filter isAlphaNum
...
@@ -232,9 +232,13 @@ filterText = DT.toLower . DT.filter isAlphaNum
instance
(
UniqParameters
a
,
ToJSON
a
,
HasDBid
NodeType
)
=>
AddUniqId
(
Node
a
)
instance
(
UniqParameters
a
,
ToJSON
a
,
HasDBid
NodeType
)
=>
AddUniqId
(
Node
a
)
where
where
addUniqId
(
Node
nid
_
t
u
p
n
d
h
)
=
Node
nid
(
Just
newHash
)
t
u
p
n
d
h
addUniqId
node
=
node
{
_node_hash_id
=
Just
$
newUniqIdHash
node
}
where
where
newHash
=
"
\\
x"
<>
hash
(
uniqParameters
h
)
-- | Returns a new unique ID computed by hashing the uniq parameters of the input
-- and prefixing everything with '\\x'.
newUniqIdHash
::
UniqParameters
a
=>
a
->
Hash
newUniqIdHash
a
=
"
\\
x"
<>
hash
(
uniqParameters
a
)
---------------------------------------------------------------------------
---------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment