wails-template/README.md

66 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2025-02-03 16:09:45 +01:00
2025-02-07 17:19:03 +01:00
# README
2025-02-03 16:09:45 +01:00
2025-02-05 09:34:16 +01:00
## Links
2025-02-03 16:09:45 +01:00
2025-02-05 09:34:16 +01:00
- [gorm](https://gorm.io/docs/)
2025-02-10 13:00:41 +01:00
- [SQLite ERD](https://www.convertcsv.com/sqlite-online.htm)
- [Svelte5](https://svelte.dev/docs/svelte/what-are-runes)
- [SvelteRouting](https://github.com/EmilTholin/svelte-routing)
2025-02-05 09:34:16 +01:00
- [Flowbyte UI lib](https://flowbite-svelte.com/docs/pages/introduction)
- [Tailwind](https://tailwindcss.com/docs/flex-basis)
2025-02-10 09:42:27 +01:00
## Fixes
2025-02-05 09:34:16 +01:00
2025-02-10 11:38:45 +01:00
## X-Compilation
for [Windows](https://github.com/wailsapp/wails/issues/1292):
```sh
sudo pacman -S mingw-w64-gcc
2025-02-19 15:07:42 +01:00
wails dev # to generate bindings
2025-02-10 11:38:45 +01:00
env GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CGO_CXXFLAGS="-IC:\msys64\mingw64\include" wails build -ldflags '-extldflags "-static"' -skipbindings
```
2025-02-05 09:34:16 +01:00
## Branches:
- main: in memory
- gorm-sqlite: gorm with SQLite and one to many association.
2025-02-07 17:19:03 +01:00
## Live Development
2025-02-03 16:09:45 +01:00
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
## Building
To build a redistributable, production mode package, use `wails build`.
2025-02-07 17:19:03 +01:00
2025-02-24 11:53:47 +01:00
## Tricks:
2025-02-24 12:55:12 +01:00
### Notifications:
```go
err := beeep.Notify("Title", "Content", "path/to/icon.png")
if err != nil {
// handle error
}
```
2025-02-24 11:53:47 +01:00
### Inputs for date objects
```svelte
<div class="m-5">
<Label>Start</Label>
<Input
type="datetime-local"
value={session.Start.toISOString().slice(0, 16)}
onchange={(e) => {
// @ts-ignore
session.Start = new Date(e.target.value);
}}
required
/>
```