feat: Add delete, drop, insert, truncate, update

This commit is contained in:
Björn Benouarets
2025-11-06 00:54:41 +01:00
parent e884c77c31
commit cd757c80f5
17 changed files with 600 additions and 31 deletions

19
build/truncate.go Normal file
View File

@@ -0,0 +1,19 @@
package build
import (
"fmt"
"git.secnex.io/secnex/pgson/schema"
"git.secnex.io/secnex/pgson/utils"
)
func TruncateSQL(s *schema.Table, cascade bool, restartIdentity bool) (string, error) {
query := fmt.Sprintf("TRUNCATE TABLE %s", utils.SQLQuoteIdent(s.Name))
if cascade {
query += " CASCADE"
}
if restartIdentity {
query += " RESTART IDENTITY"
}
return query, nil
}