Skip to content

Commit 60854e7

Browse files
committed
update sqldef and show version
1 parent 7adb9fc commit 60854e7

File tree

7 files changed

+54
-9
lines changed

7 files changed

+54
-9
lines changed

app.mjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { sqldef } from "./sqldef_browser.mjs";
1+
import { sqldef, getVersion } from "./sqldef_browser.mjs";
22

33
const dbType = document.getElementById("dbType");
44
const inputA = document.getElementById("inputA");
@@ -103,3 +103,12 @@ inputB.addEventListener("input", runDiff);
103103

104104
// Run diff on initial load
105105
runDiff();
106+
107+
// Display version info
108+
(async () => {
109+
const version = await getVersion();
110+
const versionEl = document.getElementById("version");
111+
if (versionEl) {
112+
versionEl.textContent = `powered by sqldef v${version}`;
113+
}
114+
})();

go.mod

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ go 1.25
44

55
toolchain go1.25.5
66

7-
require github.com/sqldef/sqldef/v3 v3.7.6
7+
require github.com/sqldef/sqldef/v3 v3.7.9
88

99
require (
1010
github.com/goccy/go-yaml v1.19.0 // indirect
11-
golang.org/x/sync v0.18.0 // indirect
11+
github.com/k0kubun/pp/v3 v3.5.0 // indirect
12+
github.com/mattn/go-colorable v0.1.14 // indirect
13+
github.com/mattn/go-isatty v0.0.20 // indirect
14+
golang.org/x/sync v0.19.0 // indirect
15+
golang.org/x/sys v0.38.0 // indirect
16+
golang.org/x/text v0.31.0 // indirect
1217
)

go.sum

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
22
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
33
github.com/goccy/go-yaml v1.19.0 h1:EmkZ9RIsX+Uq4DYFowegAuJo8+xdX3T/2dwNPXbxEYE=
44
github.com/goccy/go-yaml v1.19.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
5+
github.com/k0kubun/pp/v3 v3.5.0 h1:iYNlYA5HJAJvkD4ibuf9c8y6SHM0QFhaBuCqm1zHp0w=
6+
github.com/k0kubun/pp/v3 v3.5.0/go.mod h1:5lzno5ZZeEeTV/Ky6vs3g6d1U3WarDrH8k240vMtGro=
7+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
8+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
9+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
10+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
511
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
612
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7-
github.com/sqldef/sqldef/v3 v3.7.4 h1:BKxfzt1/OUG5Ke4U8bawUleKl9yo5ObhaJlgUa5mmq8=
8-
github.com/sqldef/sqldef/v3 v3.7.4/go.mod h1:yrTNAMDgx+NNL1Iu7X6eOVA3zxJ7vSt3apkdn1RDHAI=
9-
github.com/sqldef/sqldef/v3 v3.7.6 h1:E1DO1kBN6vaFNbHvHxylFuVSStfDNsVtYkg1K39kE20=
10-
github.com/sqldef/sqldef/v3 v3.7.6/go.mod h1:yrTNAMDgx+NNL1Iu7X6eOVA3zxJ7vSt3apkdn1RDHAI=
13+
github.com/sqldef/sqldef/v3 v3.7.9 h1:Bmf3153IvYx602wqaMfg9X/PYkLLKTgfxmM86VVRRTA=
14+
github.com/sqldef/sqldef/v3 v3.7.9/go.mod h1:yrTNAMDgx+NNL1Iu7X6eOVA3zxJ7vSt3apkdn1RDHAI=
1115
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
1216
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
13-
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
14-
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
17+
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
18+
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
19+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
20+
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
21+
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
22+
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
23+
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
1524
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
1625
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@
100100
margin-top: 100px;
101101
text-align: center;
102102
}
103+
104+
#version {
105+
color: #888;
106+
}
103107
</style>
104108
</head>
105109

@@ -154,6 +158,7 @@ <h4 class="schema-header">Desired schema</h4>
154158
</div>
155159

156160
<footer>
161+
<p id="version"></p>
157162
<p>
158163
<a href="https://github.com/sqldef/sqldef">https://github.com/sqldef/sqldef</a>
159164
</p>

sqldef-wasm.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99
"syscall/js"
1010

11+
"github.com/sqldef/sqldef/v3"
1112
"github.com/sqldef/sqldef/v3/database"
1213
"github.com/sqldef/sqldef/v3/parser"
1314
"github.com/sqldef/sqldef/v3/schema"
@@ -61,6 +62,12 @@ func main() {
6162

6263
exports := map[string]any{
6364
"diff": js.FuncOf(sqldefDiff),
65+
"getVersion": js.FuncOf(func(this js.Value, args []js.Value) any {
66+
return sqldef.GetVersion()
67+
}),
68+
"getRevision": js.FuncOf(func(this js.Value, args []js.Value) any {
69+
return sqldef.GetRevision()
70+
}),
6471
}
6572
js.Global().Set("_SQLDEF", js.ValueOf(exports))
6673

sqldef.wasm

328 KB
Binary file not shown.

sqldef_browser.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,13 @@ export async function sqldef(dbType, desiredDDLs, currentDDLs) {
3737
});
3838
});
3939
}
40+
41+
export async function getVersion() {
42+
const SQLDEF = await getInstance();
43+
return SQLDEF.getVersion();
44+
}
45+
46+
export async function getRevision() {
47+
const SQLDEF = await getInstance();
48+
return SQLDEF.getRevision();
49+
}

0 commit comments

Comments
 (0)