Skip to content

Commit 392f133

Browse files
committed
Merge branch 'main' of github.com:clidey/whodb into hk/feature/elasticsearch
2 parents afedf68 + 2fd45f1 commit 392f133

39 files changed

+474
-201
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,19 @@ services:
3030

3131
Go to http://localhost:8080 and get started!
3232

33-
Or try here: https://whodb.clidey.com/login?host=quick-container-491288b0-3138-48fa-93b4-1e730296c0b7.hello.svc.cluster.local&username=user&password=password&database=Adventureworks
33+
Or try here: https://whodb.clidey.com/demo/login?host=quick-container-491288b0-3138-48fa-93b4-1e730296c0b7.hello.svc.cluster.local&username=user&password=password&database=Adventureworks
3434

3535
- This is currently populated with fake database from [postgresDBSamples](https://github.com/morenoh149/postgresDBSamples/) and the URL should automatically put the credentials
3636

37-
Or checkout our Demo Video: [![Demo Video](/docs/images/demo-thumbnail.png)](https://youtu.be/w3tOjRt8jGU)
37+
Or checkout our Demo Video: [![Demo Video](/docs/images/demo-thumbnail.png)](https://youtu.be/hnAQcYYzcLo)
3838

3939
## Features
40-
- **Better UX:** Intuitive and easy-to-use interface.
41-
- **Faster Performance:** Built with GoLang for exceptional speed and table virtualization in Frontend.
42-
- **Schema Visualization:** Interactive graphs to visualize your entire database schema.
40+
- **Better UX:** Intuitive and easy-to-use interface
41+
- **Faster Performance:** Built with GoLang for exceptional speed and table virtualization in Frontend
42+
- **Schema Visualization:** Interactive graphs to visualize your entire database schema
4343
- **Inline Editing & Preview:** Easily preview cell or edit inline
4444
- **Current Support:** PostgreSQL, MySQL, SQLite3, MongoDB, & Redis
45+
- **Scratchpad:** Perform database queries in a jupyter notebook like experience
4546

4647
## Documentation
4748

@@ -85,7 +86,7 @@ A: WhoDB supports lazy loading to efficiently manage and display large query res
8586

8687
**Q: What makes WhoDB different from DBeaver?**
8788

88-
A: While DBeaver is a highly advanced tool written in Java, it can be resource-intensive. WhoDB, on the other hand, is designed to be lightweight and runs with minimal resources, making it accessible to a wider range of users and devices. You can run WhoDB with as little as 50m core and 100Mi RAM. WhoDB is also only ~20Mi compressed size.
89+
A: While DBeaver is a highly advanced tool written in Java, it can be resource-intensive. WhoDB, on the other hand, is designed to be lightweight and runs with minimal resources, making it accessible to a wider range of users and devices. You can run WhoDB with as little as 50m core and 100Mb RAM. WhoDB is also only ~25Mb compressed size.
8990

9091
**Q: Can I use WhoDB with any type of database?**
9192

@@ -110,4 +111,4 @@ For any inquiries or support, please reach out to [support@clidey.com](mailto:su
110111

111112
<div style="width:100%;border-bottom:0.5px solid white;margin:50px 0px;"></div>
112113

113-
*WhoDB - Making your database management disappear like magic!*
114+
*WhoDB - Making your database management disappear like magic!*

core/Dockerfile

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
1-
FROM node:18.12.1-alpine as build-stage
2-
1+
FROM node:18.12.1-alpine AS build-stage
32
RUN npm i -g pnpm
4-
53
WORKDIR /app
64
COPY ./frontend/package.json ./frontend/pnpm-lock.yaml ./
75
RUN pnpm install
86
COPY ./frontend/ ./
97
RUN pnpm run build
108

11-
12-
FROM golang:1.22.1-alpine3.19 as backend-stage
13-
9+
FROM golang:1.22.1-alpine3.19 AS backend-stage
1410
RUN apk update && apk add --no-cache gcc musl-dev
15-
1611
WORKDIR /app
1712
COPY ./core/go.mod ./core/go.sum ./
1813
RUN go mod download
1914
COPY ./core/ ./
15+
COPY --from=build-stage /app/build/ ./build/
2016
RUN CGO_ENABLED=1 GOOS=linux go build -o /core
2117

2218
FROM alpine:3.19
23-
2419
RUN apk update && apk add --no-cache ca-certificates
25-
2620
WORKDIR /app
2721
COPY --from=backend-stage /core /core
28-
COPY --from=build-stage /app/build/ ./build/
2922

30-
CMD ["/core"]
23+
CMD ["/core"]

core/graph/generated.go

Lines changed: 35 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/graph/model/models_gen.go

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/graph/schema.graphqls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ input LoginCredentials {
6161
Username: String!
6262
Password: String!
6363
Database: String!
64+
Advanced: [RecordInput!]
6465
}
6566

6667
type StatusResponse {
@@ -78,7 +79,7 @@ type Query {
7879
}
7980

8081
type Mutation {
81-
Login(credentails: LoginCredentials!): StatusResponse!
82+
Login(credentials: LoginCredentials!): StatusResponse!
8283
Logout: StatusResponse!
8384

8485
UpdateStorageUnit(type: DatabaseType!, schema: String!, storageUnit: String!, values: [RecordInput!]!): StatusResponse!

core/graph/schema.resolvers.go

Lines changed: 15 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/server.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
package main
22

33
import (
4+
"embed"
5+
46
"github.com/clidey/whodb/core/src"
57
"github.com/clidey/whodb/core/src/router"
68
)
79

10+
//go:embed build/*
11+
var staticFiles embed.FS
12+
813
func main() {
914
src.InitializeEngine()
10-
router.InitializeRouter()
15+
router.InitializeRouter(staticFiles)
1116
}

core/src/common/utils.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package common
22

3+
import "github.com/clidey/whodb/core/src/engine"
4+
35
func ContainsString(slice []string, element string) bool {
46
for _, item := range slice {
57
if item == element {
@@ -8,3 +10,12 @@ func ContainsString(slice []string, element string) bool {
810
}
911
return false
1012
}
13+
14+
func GetRecordValueOrDefault(records []engine.Record, key string, defaultValue string) string {
15+
for _, record := range records {
16+
if record.Key == key && len(record.Value) > 0 {
17+
return record.Value
18+
}
19+
}
20+
return defaultValue
21+
}

core/src/engine/plugin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ type Credentials struct {
55
Username string
66
Password string
77
Database string
8+
Advanced []Record
89
}
910

1011
type PluginConfig struct {

core/src/plugins/mongodb/db.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,33 @@ import (
44
"context"
55
"fmt"
66

7+
"github.com/clidey/whodb/core/src/common"
78
"github.com/clidey/whodb/core/src/engine"
89
"go.mongodb.org/mongo-driver/mongo"
910
"go.mongodb.org/mongo-driver/mongo/options"
1011
)
1112

1213
func DB(config *engine.PluginConfig) (*mongo.Client, error) {
1314
ctx := context.Background()
15+
port := common.GetRecordValueOrDefault(config.Credentials.Advanced, "Port", "27017")
16+
queryParams := common.GetRecordValueOrDefault(config.Credentials.Advanced, "Query Params", "")
1417
var connectionString string
1518
// TODO: add TLS enabled logic to work instead of hard coded domains
1619
if config.Credentials.Hostname == "localhost" || config.Credentials.Hostname == "host.docker.internal" {
17-
connectionString = fmt.Sprintf("mongodb://%s:%s@%s:%d/%s",
20+
connectionString = fmt.Sprintf("mongodb://%s:%s@%s:%s/%s%s",
1821
config.Credentials.Username,
1922
config.Credentials.Password,
2023
config.Credentials.Hostname,
21-
27017,
22-
config.Credentials.Database)
24+
port,
25+
config.Credentials.Database,
26+
queryParams)
2327
} else {
24-
connectionString = fmt.Sprintf("mongodb+srv://%s:%s@%s/%s",
28+
connectionString = fmt.Sprintf("mongodb+srv://%s:%s@%s/%s%s",
2529
config.Credentials.Username,
2630
config.Credentials.Password,
2731
config.Credentials.Hostname,
28-
config.Credentials.Database)
32+
config.Credentials.Database,
33+
queryParams)
2934
}
3035

3136
clientOptions := options.Client().ApplyURI(connectionString)

0 commit comments

Comments
 (0)