Files
pgson/query.go
2025-11-06 00:54:41 +01:00

42 lines
997 B
Go

package pgson
import (
"git.secnex.io/secnex/pgson/build"
"git.secnex.io/secnex/pgson/schema"
)
func Create(s *schema.Table) (string, error) {
if err := s.Validate(); err != nil {
return "", err
}
return build.CreateSQL(s)
}
func Drop(s *schema.Table) (string, error) {
return build.DropSQL(s)
}
func InsertMany(s *schema.Table, data []map[string]any) (string, error) {
return build.InsertManySQL(s, data)
}
func Insert(s *schema.Table, data map[string]any) (string, error) {
return build.InsertSQL(s, data)
}
func Update(s *schema.Table, data map[string]any, where string) (string, error) {
return build.UpdateSQL(s, data, where)
}
func Delete(s *schema.Table, where string) (string, error) {
return build.DeleteSQL(s, where)
}
func HardDelete(s *schema.Table, where string) (string, error) {
return build.HardDeleteSQL(s, where)
}
func Truncate(s *schema.Table, cascade bool, restartIdentity bool) (string, error) {
return build.TruncateSQL(s, cascade, restartIdentity)
}