From afbc8228825062c69d888fe47298a7b11d33674d Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 6 Sep 2023 16:48:10 +0200 Subject: [PATCH] add air config --- .air.toml | 43 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + internal/database/sql/post.go | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .air.toml diff --git a/.air.toml b/.air.toml new file mode 100644 index 0000000..1efae49 --- /dev/null +++ b/.air.toml @@ -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 diff --git a/.gitignore b/.gitignore index 310cb56..d58e311 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ config.toml +tmp logs *.log pnpm-debug.log* diff --git a/internal/database/sql/post.go b/internal/database/sql/post.go index 9d7d9d7..75cded3 100644 --- a/internal/database/sql/post.go +++ b/internal/database/sql/post.go @@ -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) { - 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) if err != nil {