Rename Object to FileUpload; use native Postgres $n placeholders.

This commit is contained in:
2026-08-21 23:53:00 -07:00
parent a36bc723cc
commit a249965fc1
6 changed files with 41 additions and 71 deletions
-22
View File
@@ -4,34 +4,12 @@ import (
"database/sql"
"fmt"
"net/url"
"strconv"
"strings"
"time"
_ "github.com/jackc/pgx/v5/stdlib"
)
// rebind converts ? placeholders to Postgres $1, $2, ... form.
func rebind(query string) string {
n := 0
var b strings.Builder
for i := 0; i < len(query); i++ {
if query[i] == '?' {
n++
b.WriteByte('$')
b.WriteString(strconv.Itoa(n))
continue
}
b.WriteByte(query[i])
}
return b.String()
}
// q rebinds SQL placeholders for Postgres.
func (s *Store) q(query string) string {
return rebind(query)
}
// applySchema runs semicolon-separated DDL statements, skipping PRAGMA lines.
func applySchema(db *sql.DB, schema string) error {
for _, stmt := range strings.Split(schema, ";") {