jorgerojas26 / lazysql Goto Github PK
View Code? Open in Web Editor NEWA cross-platform TUI database management tool written in Go.
License: MIT License
A cross-platform TUI database management tool written in Go.
License: MIT License
Hello,
I like the idea of this tool a lot,
I'm recently using Turso(libsql), and would like to use it from this tool,
Thanks.
Good cli app concept.
SQlite support would be good as well as future development.
Hi, Looks like there is no support for null
.
for example:
email_verified_at
is nullable. and user id 1 has is set to null. there are 2 issues with this:
attaching a image to show what happens to a datetime when trying to set a empty value. this is maybe fine as an emtpy value is actually not null. it fails correctly i think.
however you can't set it to "null" as it is still a string.
I think the cleanest way to solve this is to have a keybind i cell edit mode (maybe Ctrl + N) that will set the column to null. What do you guys think?
Press F2
I get:
But when I try to save using F1
, I get:
What's wrong with this?
Originally posted by @hf-xz in #28 (comment)
Using build 0.1.8 in Debian Bookworm under WLS2
I noticed this connected to two similarly configured MySQL servers.
I do not know if it is a MySQL specific problem or not.
I can see all the databases in the table panel.
I can open ones with letters in their names, even if they start with a number.
All-numeric databases do not open. I can select them but nothing happens when I press enter.
I hope this is helpful, thanks!
❯ go install github.com/jorgerojas26/lazysql@latest
go: downloading github.com/jorgerojas26/lazysql v0.1.2
go: downloading golang.design/x/clipboard v0.7.0
go: downloading github.com/rivo/tview v0.0.0-20240101144852-b3bd1aa5e9f2
go: downloading github.com/google/uuid v1.5.0
go: downloading github.com/xo/dburl v0.20.2
go: downloading github.com/gdamore/tcell/v2 v2.7.0
go: downloading github.com/pelletier/go-toml/v2 v2.1.1
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
go: downloading golang.org/x/sys v0.15.0
go: downloading golang.org/x/term v0.15.0
go: downloading github.com/gdamore/encoding v1.0.0
go: downloading github.com/mattn/go-runewidth v0.0.15
go: downloading github.com/rivo/uniseg v0.4.3
# golang.design/x/clipboard
clipboard_linux.c:15:10: fatal error: X11/Xlib.h: No such file or directory
15 | #include <X11/Xlib.h>
compilation terminated.
System executed the command:
Win11 with WSL2 Ubuntu 22.04.3 LTS
So, i'm not sure on which end this issue is, but i'm not getting the same color output as your screenshots do
Especially the unfocused treeview is using a Blue no matter which colorscheme i use. This is in Windows Terminal, tested with 3 colorschemes.
Additionally i feel like the contrast on the selected cell is pretty low. A darker foreground color for that would help readability.
The lazysql show colors different from the normal terminal, would be great if the lazysql match the same colors like the terminal, something that happen in lazy-like TUIs like lazygit and lazydocker:
What is expected (the image bellow is photoshopped):
I haven't figured what I can change in the code to get this
I'm trying to connect to a postgresql server using lazysql and when the password has a special character like sharp (#) in it, after pressing F2 to test connection, lazysql crashes.
Not able to connect with special characters or replacing special characters in the password field with their %
representation.
I like to download my tools with go install, but this project is not set up for this.
The error code:
go install github.com/jorgerojas26/lazysql@latest
go: downloading github.com/jorgerojas26/lazysql v0.1.0
go: github.com/jorgerojas26/lazysql@latest: version constraints conflict:
github.com/jorgerojas26/[email protected]: parsing go.mod:
module declares its path as: lazysql
but was required as: github.com/jorgerojas26/lazysql
I can make a PR that fixes this if this is something you'd like.
Would be awesome to have this feature builtin. I am pretty busy this week but maybe next week I can take a look at that
When put a string for postgres like:
postgres://root:1234@localhost:5432/db_name?sslmode=disable
and try to save the connection it cut the string to:
postgres://root:1234@localhost:5432/?sslmode=disable
and doesn't connect
I'm on NixOS 23.11, using sway on wayland. When trying to build this via Go, ran into this error. I'm curious if this is due to being on wayland?
Steps to reproduce:
On NixOS, running the Sway wm.
It will result in:
# golang.design/x/clipboard
clipboard_linux.c:15:10: fatal error: X11/Xlib.h: No such file or directory
15 | #include <X11/Xlib.h>
| ^~~~~~~~~~~~
compilation terminated.
Hey, I find great interest in your project, and I hope it will make it as far as lazygit did.
I created a PKGBUILD for this project, so that users of archlinux can install this package.
It's available here: https://aur.archlinux.org/packages/lazysql
Maybe you can update the readme to include it.
Just write something along the lines:
Archlinux users can install it from here: https://aur.archlinux.org/packages/lazysql
via paru -S lazysql
or yay -S lazysql
or by downloading the PKGBUILD file and running makepkg -si
This looks like a simple bug, i downloaded lazysql to try it via go install, and added my local sqlite db to try it.
I added it with a relative path for url on the connection and the "test connection" show it was correct.
I saved and returned to the home screen and selected the db and lazysql panicked.
I tried setting the URL as "./data.db" instead and it works that way.
Already took a look at the code on the line shown in the error and i figured it really expects to have at least on '/', this is the line:
Line 14 in d6ba3d2
I figure it should at least just use the whole string if there are no slashes to be found in the path.
I may go and submit a PR with it myself later, but I thought I should at least create an issue even if just documenting the problem in case I forget to go and fix it myself.
Hello,
I've seen your project from ChrisCool discord which looks promising.
I love TUI app!
I also know this company is making amazing software for developing apps in Go.
https://github.com/charmbracelet
This is the framework to develop TUI app.
https://github.com/charmbracelet/bubbletea
And they also have other stuff to make forms, cli apps etc.. You should look into it.
The program will frozen when open a no record table, and then press arrow key.
As a user of lazygit, this would be perfect for me, if only it had MSSQL support.
In addition, it will be nice if there was some message "Table Empty" instead of error
Full panic error:
panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/rivo/tview.(*Application).Run.func1()
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/application.go:251 +0x4d
panic({0x782400, 0xc0006a6c78})
/usr/local/go/src/runtime/panic.go:884 +0x213
github.com/jorgerojas26/lazysql/components.(*ResultsTable).tableInputCapture(0xc000266d80, 0xc0006ddc60)
/Users/jorgerojas/projects/lazysql/components/ResultsTable.go:448 +0x1468
github.com/rivo/tview.(*Box).WrapInputHandler.func1(0xc000270720?, 0xc0005c7b08?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/box.go:164 +0x3a
github.com/rivo/tview.(*Flex).InputHandler.func1(0xc0005c7b48?, 0x54e0bf?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/flex.go:255 +0xd9
github.com/rivo/tview.(*Box).WrapInputHandler.func1(0xc0002701e0?, 0xc0005c7b88?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x53
github.com/rivo/tview.(*Pages).InputHandler.func1(0xc0005c7bc8?, 0x558dbf?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/pages.go:311 +0xa7
github.com/rivo/tview.(*Box).WrapInputHandler.func1(0xc000270240?, 0xc0005c7c08?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x53
github.com/rivo/tview.(*Pages).InputHandler.func1(0xc0005c7c48?, 0x558dbf?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/pages.go:311 +0xa7
github.com/rivo/tview.(*Box).WrapInputHandler.func1(0xc0000fe5d0?, 0xc0005c7c88?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x53
github.com/rivo/tview.(*Flex).InputHandler.func1(0xc0005c7cc8?, 0x54e0bf?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/flex.go:255 +0xd9
github.com/rivo/tview.(*Box).WrapInputHandler.func1(0xc0000fe630?, 0x76d6e0?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x53
github.com/rivo/tview.(*Flex).InputHandler.func1(0xc0006ef7e0?, 0xc0005c7d48?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/flex.go:255 +0xd9
github.com/rivo/tview.(*Box).WrapInputHandler.func1(0xc00007f2f0?, 0x7620e0?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x53
github.com/rivo/tview.(*Pages).InputHandler.func1(0x40d507?, 0x10?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/pages.go:311 +0xa7
github.com/rivo/tview.(*Box).WrapInputHandler.func1(0xc00007f110?, 0xc0005c7e40?)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x53
github.com/rivo/tview.(*Application).Run(0xc00017e000)
/Users/jorgerojas/.go/pkg/mod/github.com/rivo/[email protected]/application.go:344 +0x57d
main.main()
/Users/jorgerojas/projects/lazysql/main.go:16 +0x10a
The module path in your go.mod file isn't the full path, preventing building and installing your application
I usually connect to postgres database with psql
like this:
psql postgresql://postgres:mysecretpassword@localhost:5432/postgres
Using lazysql
I can't manage to create a connection though. I get two kinds of error messages when pressing F2 to test the connection.
If I set URL:
postgresql://postgres:mysecretpassword@localhost:5432/postgres
I get error message:
sql: unknown driver "postgres" (forgotten import?)
If I set URL:
localhost:5432/postgres
I get error message
unknown database scheme
Is it just that lazysql doesn't support postgres or am I doing something wrong?
Awesome that you're building lazysql, I use lazygit and lazydocker daily at work. Keep it up!! :)
Hi,
The project seems really cool, great job!
Wanted to suggest to also support homebrew
as a way of installing the project (it works both on Mac and Linux)
it would be a peace of mind if one know that he/she is in safe mode and he can not mess with the database,
could you please add a readonly
mode toggle in the application?
My input for the url mysql://root:password@localhost:33061/database
It prints out the following error when trying to test it:
dial tcp: lookup localhost:33061:33061: no such host
and this error when pressing enter to connect to it
parse "mysql://root:password@localhost:33061%2Fdata": invalid port ":
I did some inspecting in the code and found that it probably has something to do with the EscapeConnectionString
function in utils.go
The reason I came to that conclusion is that when replacing this:
connectionString := helpers.EscapeConnectionString(form.GetFormItem(1).(*tview.InputField).GetText())
parsed, err := helpers.ParseConnectionString(connectionString)
with:
parsed, err := helpers.ParseConnectionString(form.GetFormItem(1).(*tview.InputField).GetText())
It seemed to work for my end, however there will be no sanitization done. I don't know enough about the code to change this so I thought I would make just make the issue. Let me know if you need more information from my end.
Bug: program perminately blocked when operate a empty table
firstly: enter into a empty table
secondly: press up or down key will block the total program forever, and it can not receive keyboard event anymore, even I press ctrl+c . the program still blocked in somewhere
I'm big fan of TUI like lazygit and lazydocker, and rice terminals, would be nice if lazyqsl had support to icons like others TUIs mentioned here
I'm trying to connect to a postgresql server using lazysql and I get this error
pq: SSL is not enabled on the server
even when I appned ?sslmode=disable
to the url.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.