Skip to content

Commit 9b0c526

Browse files
Merge pull request #155 from intelops/add-mongodb-integration
Add mongodb integration
2 parents d22ef4f + f0835fd commit 9b0c526

File tree

15 files changed

+866
-249
lines changed

15 files changed

+866
-249
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
/core/coverage.out
1111
/app/coverage
1212
openapitools.json
13-
/core/openapitools.json
13+
/core/openapitools.json
14+
/ui/.env.kind.cluster

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[submodule "core/templates/compage-template-go"]
22
path = core/templates/compage-template-go
33
url = https://github.com/intelops/compage-template-go.git
4-
branch = template-v8
4+
branch = add-mongodb-integration
55
[submodule "core/templates/compage-template-java"]
66
path = core/templates/compage-template-java
77
url = https://github.com/intelops/compage-template-java.git

app/src/routes/models.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export interface RestConfig {
1414
framework: string;
1515
server: {
1616
port: string;
17-
sqlDb: string;
17+
sqlDB: string;
18+
noSQLDB: string;
1819
resources?: Resource[];
1920
openApiFileYamlContent?: string;
2021
};
@@ -32,7 +33,8 @@ export interface GrpcConfig {
3233
framework: string;
3334
server?: {
3435
port?: string;
35-
sqlDb?: string;
36+
sqlDB: string;
37+
noSQLDB: string;
3638
resources?: Resource[];
3739
protoFileContent?: string;
3840
};
@@ -50,6 +52,8 @@ export interface WsConfig {
5052
framework: string;
5153
server?: {
5254
port?: string;
55+
sqlDB: string;
56+
noSQLDB: string;
5357
resources?: Resource[];
5458
};
5559
clients?: WsClient[];

core/internal/core/node/node.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ type ConsumerData struct {
2727

2828
type RestServer struct {
2929
Port string `json:"port"`
30-
SQLDB string `json:"sqlDb"`
30+
SQLDB string `json:"sqlDB"`
31+
NoSQLDB string `json:"noSQLDB"`
3132
Resources []*Resource `json:"resources"`
3233
// OpenAPIFileYamlContent holds openAPIFileYamlContent
3334
OpenAPIFileYamlContent string `json:"openAPIFileYamlContent,omitempty"`
@@ -51,7 +52,8 @@ type RestConfig struct {
5152

5253
type GrpcServer struct {
5354
Port string `json:"port"`
54-
SQLDB string `json:"sqlDb"`
55+
SQLDB string `json:"sqlDB"`
56+
NoSQLDB string `json:"noSQLDB"`
5557
Resources []*Resource `json:"resources"`
5658
// ProtoFileContent holds protoFileContent
5759
ProtoFileContent string `json:"protoFileContent,omitempty"`

core/internal/languages/executor/executor.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import (
1010
var tmpl = template.New("").Option("missingkey=error")
1111
var ghActionsTmpl = template.New("").Option("missingkey=error").Delims("[[", "]]")
1212

13-
func ExecuteWithFuncs(filePaths []string, data map[string]interface{}, funcMap template.FuncMap) error {
13+
func ExecuteWithFuncs(filePaths []*string, data map[string]interface{}, funcMap template.FuncMap) error {
1414
for _, filePathName := range filePaths {
1515
// template code
16-
parsedTemplates := template.Must(tmpl.ParseFiles(filePathName)).Funcs(funcMap)
16+
parsedTemplates := template.Must(tmpl.ParseFiles(*filePathName)).Funcs(funcMap)
1717
// generate go code now
18-
fileName := filePathName[strings.LastIndex(filePathName, utils.SubstrString)+1:]
19-
createdFile, err := os.Create(strings.TrimSuffix(filePathName, utils.TemplateExtension))
18+
fileName := (*filePathName)[strings.LastIndex(*filePathName, utils.SubstrString)+1:]
19+
createdFile, err := os.Create(strings.TrimSuffix(*filePathName, utils.TemplateExtension))
2020
if err != nil {
2121
return err
2222
}
@@ -27,8 +27,8 @@ func ExecuteWithFuncs(filePaths []string, data map[string]interface{}, funcMap t
2727

2828
// delete the template files
2929
for _, filePathName := range filePaths {
30-
if strings.HasSuffix(filePathName, ".tmpl") {
31-
if err := os.Remove(filePathName); err != nil {
30+
if strings.HasSuffix(*filePathName, ".tmpl") {
31+
if err := os.Remove(*filePathName); err != nil {
3232
return err
3333
}
3434
}

core/internal/languages/golang/frameworks/common-files/copier.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type clientData struct {
5757
SourceNodeID string
5858
}
5959

60-
func NewCopier(userName, repositoryName, nodeName, nodeDirectoryName, templatesRootPath string, isRestServer bool, restServerPort string, isGrpcServer bool, grpcServerPort string, isRestSQLDB bool, restSQLDB string, isGrpcSQLDB bool, grpcSQLDB string, restResources []*corenode.Resource, grpcResources []*corenode.Resource, restClients []*corenode.RestClient, grpcClients []*corenode.GrpcClient) *Copier {
60+
func NewCopier(userName, repositoryName, nodeName, nodeDirectoryName, templatesRootPath string, isRestServer bool, restServerPort string, isGrpcServer bool, grpcServerPort string, isRestSQLDB bool, restSQLDB string, isGrpcSQLDB bool, grpcSQLDB string, isRestNoSQLDB bool, restNoSQLDB string, isGrpcNoSQLDB bool, grpcNoSQLDB string, restResources []*corenode.Resource, grpcResources []*corenode.Resource, restClients []*corenode.RestClient, grpcClients []*corenode.GrpcClient) *Copier {
6161

6262
pluralizeClient := pluralize.NewClient()
6363

@@ -121,6 +121,16 @@ func NewCopier(userName, repositoryName, nodeName, nodeDirectoryName, templatesR
121121
data["GrpcSQLDB"] = grpcSQLDB
122122
}
123123

124+
data["IsRestNoSQLDB"] = isRestNoSQLDB
125+
if isRestNoSQLDB {
126+
data["RestNoSQLDB"] = restNoSQLDB
127+
}
128+
129+
data["IsGrpcNoSQLDB"] = isGrpcNoSQLDB
130+
if isGrpcNoSQLDB {
131+
data["GrpcNoSQLDB"] = grpcNoSQLDB
132+
}
133+
124134
return &Copier{
125135
TemplatesRootPath: templatesRootPath,
126136
NodeDirectoryName: nodeDirectoryName,

0 commit comments

Comments
 (0)