.requirements/PSNeo4j/0.0.31/Public/ConvertTo-Neo4jNodeStatement.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
function ConvertTo-Neo4jNodeStatement { <# .SYNOPSIS Generate a Neo4j statement to create a node .DESCRIPTION Generate a Neo4j statement to create a node Uses the following syntax: https://neo4j.com/docs/rest-docs/3.2/#rest-api-create-a-node .EXAMPLE ConvertTo-Neo4jNodeStatements -Label Server -Props @{ ComputerName = 'dc01' } .PARAMETER Label Label for the nodes to create If more than one label is provided, create node with multiple labels Warning: susceptible to query injection .PARAMETER Props Create node with these properties/values .PARAMETER Passthru Whether to return node upon creation .FUNCTIONALITY Neo4j #> [cmdletbinding()] param( [string[]]$Label, [object]$Props, [switch]$Passthru ) $LabelString = $Label -join ':' $Query = "CREATE (node:$LabelString { props } )" if($Passthru) {$Query = "$Query RETURN node"} [pscustomobject]@{ statement = $Query parameters = @{ props = $Props } } } |