Skip to content

Commit

Permalink
Merge pull request #33 from arturo-lang/make-put-work-with-strings
Browse files Browse the repository at this point in the history
Make `put` work with strings
  • Loading branch information
drkameleon authored Nov 2, 2023
2 parents 842a0e6 + 1d50ca2 commit d4859ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<p align="center"><img width="90%" align="center" src="https://raw.githubusercontent.com/arturo-lang/grafito/master/ui-screenshot.png"/></p>

---

<!--ts-->

* [At A Glance](#at-a-glance)
Expand Down
14 changes: 11 additions & 3 deletions grafito.art
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ graph: function [

put: function [
name :literal :string
attributes :block :dictionary
attributes :string :block :dictionary
][
;; description: « insert new node(s) to graph with given name and attributes
;; options: [
Expand All @@ -503,7 +503,11 @@ graph: function [
loop attributes 'nd [
lastId: lastId + 1
att: nd
if not? dictionary? att -> att: # att
(block? att)? -> att: # att [
(string? att)? -> att: #[
name: att
] []
]
'queries ++ createNodeSQL
'vals ++ @[name, write.compact.json ø att]
'result ++ #[
Expand All @@ -518,7 +522,11 @@ graph: function [
printDebug ~{created |size attributes| nodes}
] [
att: attributes
if not? dictionary? att -> att: # att
(block? att)? -> att: # att [
(string? att)? -> att: #[
name: att
] []
]
nodeId: performQuery.id 'put createNodeSQL @[name, write.compact.json ø att]
result: #[
id: nodeId
Expand Down

0 comments on commit d4859ec

Please sign in to comment.