Skip to content

Commit 7dcf646

Browse files
feat: added mongodb as nosql database for rest server in golang
1 parent d22ef4f commit 7dcf646

File tree

14 files changed

+530
-156
lines changed

14 files changed

+530
-156
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
}

0 commit comments

Comments
 (0)