generated frommaragudk/template
- Notifications
You must be signed in to change notification settings - Fork0
An HTTP handler for database browsing.
License
NotificationsYou must be signed in to change notification settings
maragudk/dblens
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
An HTTP handler for database browsing.
BEWARE:dblens.Handler
accepts ALL queries, including destructive ones. Don't expose the handler to the wide public.
go get -u github.com/maragudk/dblens
package mainimport ("database/sql""errors""log""net/http""os"_"github.com/mattn/go-sqlite3""github.com/maragudk/dblens")funcmain() {os.Exit(start())}funcstart()int {log:=log.New(os.Stderr,"",log.Ldate|log.Ltime|log.Lshortfile|log.LUTC)db,err:=sql.Open("sqlite3","app.db?_journal=WAL&_timeout=5000&_fk=true")iferr!=nil {log.Println("Error opening database:",err)return1}log.Println("Starting on http://localhost:8080")iferr:=http.ListenAndServe("localhost:8080",dblens.Handler(db,"sqlite3"));err!=nil&&!errors.Is(err,http.ErrServerClosed) {log.Println("Error:",err)return1}return0}
Made in 🇩🇰 bymaragu, maker ofonline Go courses.
About
An HTTP handler for database browsing.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.