-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add neo4j support in modus (#636)
- Loading branch information
Showing
38 changed files
with
4,670 additions
and
49 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,7 @@ | |
"mydgraph", | ||
"nanos", | ||
"Nanotime", | ||
"neo4jclient", | ||
"nobuild", | ||
"noescape", | ||
"nolint", | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright 2024 Hypermode Inc. | ||
* Licensed under the terms of the Apache License, Version 2.0 | ||
* See the LICENSE file that accompanied this code for further details. | ||
* | ||
* SPDX-FileCopyrightText: 2024 Hypermode Inc. <[email protected]> | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package manifest | ||
|
||
const ConnectionTypeNeo4j ConnectionType = "neo4j" | ||
|
||
type Neo4jConnectionInfo struct { | ||
Name string `json:"-"` | ||
Type ConnectionType `json:"type"` | ||
DbUri string `json:"dbUri"` | ||
Username string `json:"username"` | ||
Password string `json:"password"` | ||
} | ||
|
||
func (info Neo4jConnectionInfo) ConnectionName() string { | ||
return info.Name | ||
} | ||
|
||
func (info Neo4jConnectionInfo) ConnectionType() ConnectionType { | ||
return info.Type | ||
} | ||
|
||
func (info Neo4jConnectionInfo) Hash() string { | ||
return computeHash(info.Name, info.Type, info.DbUri) | ||
} | ||
|
||
func (info Neo4jConnectionInfo) Variables() []string { | ||
return append(extractVariables(info.Username), extractVariables(info.Password)...) | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2024 Hypermode Inc. | ||
* Licensed under the terms of the Apache License, Version 2.0 | ||
* See the LICENSE file that accompanied this code for further details. | ||
* | ||
* SPDX-FileCopyrightText: 2024 Hypermode Inc. <[email protected]> | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package hostfunctions | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hypermodeinc/modus/runtime/neo4jclient" | ||
) | ||
|
||
func init() { | ||
const module_name = "modus_neo4j_client" | ||
|
||
registerHostFunction(module_name, "executeQuery", neo4jclient.ExecuteQuery, | ||
withStartingMessage("Executing Neo4j query."), | ||
withCompletedMessage("Completed Neo4j query."), | ||
withCancelledMessage("Cancelled Neo4j query."), | ||
withErrorMessage("Error executing Neo4j query."), | ||
withMessageDetail(func(hostName, dbName, query string) string { | ||
return fmt.Sprintf("Host: %s Database: %s Query: %s", hostName, dbName, query) | ||
})) | ||
} |
Oops, something went wrong.