Skip to content

Commit 2879759

Browse files
authored
Merge pull request #41 from clidey/feature/mariadb_and_clickhouse
[Support] Add MariaDB (use MySQL details)
2 parents fbe6f4c + 4ae5312 commit 2879759

File tree

13 files changed

+59
-7
lines changed

13 files changed

+59
-7
lines changed

core/go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ go 1.22.1
44

55
require (
66
github.com/99designs/gqlgen v0.17.48
7-
github.com/elastic/go-elasticsearch v0.0.0
87
github.com/elastic/go-elasticsearch/v8 v8.14.0
98
github.com/go-chi/chi/v5 v5.0.12
109
github.com/go-chi/cors v1.2.1

core/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+
2424
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
2525
github.com/elastic/elastic-transport-go/v8 v8.6.0 h1:Y2S/FBjx1LlCv5m6pWAF2kDJAHoSjSRSJCApolgfthA=
2626
github.com/elastic/elastic-transport-go/v8 v8.6.0/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk=
27-
github.com/elastic/go-elasticsearch v0.0.0 h1:Pd5fqOuBxKxv83b0+xOAJDAkziWYwFinWnBO0y+TZaA=
28-
github.com/elastic/go-elasticsearch v0.0.0/go.mod h1:TkBSJBuTyFdBnrNqoPc54FN0vKf5c04IdM4zuStJ7xg=
2927
github.com/elastic/go-elasticsearch/v8 v8.14.0 h1:1ywU8WFReLLcxE1WJqii3hTtbPUE2hc38ZK/j4mMFow=
3028
github.com/elastic/go-elasticsearch/v8 v8.14.0/go.mod h1:WRvnlGkSuZyp83M2U8El/LGXpCjYLrvlkSgkAH4O5I4=
3129
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=

core/graph/model/models_gen.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/graph/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ enum DatabaseType {
99
MongoDB,
1010
Redis,
1111
ElasticSearch,
12+
MariaDB,
1213
}
1314

1415
type Column {

core/src/engine/engine.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type DatabaseType string
77
const (
88
DatabaseType_Postgres = "Postgres"
99
DatabaseType_MySQL = "MySQL"
10+
DatabaseType_MariaDB = "MariaDB"
1011
DatabaseType_Sqlite3 = "Sqlite3"
1112
DatabaseType_MongoDB = "MongoDB"
1213
DatabaseType_Redis = "Redis"

core/src/plugins/mysql/mysql.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,9 @@ func NewMySQLPlugin() *engine.Plugin {
223223
PluginFunctions: &MySQLPlugin{},
224224
}
225225
}
226+
func NewMyMariaDBPlugin() *engine.Plugin {
227+
return &engine.Plugin{
228+
Type: engine.DatabaseType_MariaDB,
229+
PluginFunctions: &MySQLPlugin{},
230+
}
231+
}

core/src/src.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ func InitializeEngine() *engine.Engine {
1616
MainEngine = &engine.Engine{}
1717
MainEngine.RegistryPlugin(postgres.NewPostgresPlugin())
1818
MainEngine.RegistryPlugin(mysql.NewMySQLPlugin())
19+
MainEngine.RegistryPlugin(mysql.NewMyMariaDBPlugin())
1920
MainEngine.RegistryPlugin(sqlite3.NewSqlite3Plugin())
2021
MainEngine.RegistryPlugin(mongodb.NewMongoDBPlugin())
2122
MainEngine.RegistryPlugin(redis.NewRedisPlugin())

dev/docker-compose.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,24 @@ services:
2222
MYSQL_DATABASE: mysql
2323
MYSQL_ROOT_PASSWORD: password
2424
volumes:
25-
- mysql:/data/postgres
25+
- mysql:/var/lib/mysql
2626
ports:
2727
- "3306:3306"
2828
networks:
2929
- db
30+
mariadb:
31+
image: mariadb
32+
environment:
33+
MARIADB_USER: user
34+
MARIADB_PASSWORD: password
35+
MARIADB_DATABASE: mariadb
36+
MARIADB_ROOT_PASSWORD: password
37+
volumes:
38+
- mariadb:/var/lib/mysql
39+
ports:
40+
- "3307:3306"
41+
networks:
42+
- db
3043
mongo:
3144
image: mongo
3245
environment:
@@ -83,6 +96,7 @@ networks:
8396
volumes:
8497
postgres:
8598
mysql:
99+
mariadb:
86100
mongo:
87101
redis:
88102
elasticsearch:

dev/sample-data/mysql/data.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
CREATE TABLE user (
2+
user_id INT PRIMARY KEY,
3+
username VARCHAR(50) NOT NULL,
4+
email VARCHAR(100) NOT NULL
5+
);
6+
7+
CREATE TABLE profile (
8+
profile_id INT PRIMARY KEY,
9+
user_id INT,
10+
first_name VARCHAR(50),
11+
last_name VARCHAR(50),
12+
bio TEXT,
13+
FOREIGN KEY (user_id) REFERENCES user(user_id)
14+
);
15+
16+
INSERT INTO user (user_id, username, email) VALUES
17+
(1, 'john_doe', 'john_doe@example.com'),
18+
(2, 'jane_smith', 'jane_smith@example.com');
19+
20+
INSERT INTO profile (profile_id, user_id, first_name, last_name, bio) VALUES
21+
(1, 1, 'John', 'Doe', 'Software Developer at XYZ Corp.'),
22+
(2, 2, 'Jane', 'Smith', 'Data Scientist at ABC Inc.');

frontend/src/components/icons.tsx

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)