add air config

This commit is contained in:
sam 2023-09-06 16:48:10 +02:00
parent 9f052dc9ef
commit afbc822882
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
3 changed files with 45 additions and 1 deletions

43
.air.toml Normal file
View file

@ -0,0 +1,43 @@
root = "."
tmp_dir = "tmp"
[build]
args_bin = ["web"]
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ."
delay = 0
exclude_dir = ["node_modules", "frontend", "assets", "tmp", "vendor", "testdata", "web/frontend/assets", "web/templates"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
main_only = false
time = true
[misc]
clean_on_exit = false
[screen]
clear_on_rebuild = false
keep_scroll = true

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
config.toml config.toml
tmp
logs logs
*.log *.log
pnpm-debug.log* pnpm-debug.log*

View file

@ -47,7 +47,7 @@ func (s *PostStore) Create(ctx context.Context, blog database.Blog, content stri
} }
func (s *PostStore) LocalCount(ctx context.Context) (count int64, err error) { func (s *PostStore) LocalCount(ctx context.Context) (count int64, err error) {
q := sqlf.Sprintf("SELECT count(*) FROM posts WHERE remote = false") q := sqlf.Sprintf("SELECT count(*) FROM posts WHERE visibility = %s OR visibility = %s", database.PublicVisibility, database.UnlistedVisibility)
err = s.q.QueryRow(ctx, q.Query(sqlf.PostgresBindVar)).Scan(&count) err = s.q.QueryRow(ctx, q.Query(sqlf.PostgresBindVar)).Scan(&count)
if err != nil { if err != nil {