rules

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package rules provides opt-in PostgreSQL-aware validation rules for use with sqlguard.

The package includes policies that require WHERE clauses on UPDATE and DELETE, require explicit INSERT target columns, and deny TRUNCATE, DROP TABLE, or ALTER TABLE operations. No policy is enabled automatically. Each returned rule implements sqlguard.Rule and can be registered alongside application rules in the same deterministic order.

Rules inspect parsed statement structure. Keywords in comments, identifiers, and literals do not create matching operations or satisfy required clauses. WHERE TRUE is syntactically a WHERE clause; the package does not perform tautology analysis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDeleteRequiresWhere

func NewDeleteRequiresWhere() sqlguard.Rule

NewDeleteRequiresWhere returns a rule that requires DELETE statements to contain a syntactic WHERE clause.

func NewDenyAlterTable

func NewDenyAlterTable() sqlguard.Rule

NewDenyAlterTable returns a rule that rejects ALTER TABLE statements.

func NewDenyDropTable

func NewDenyDropTable() sqlguard.Rule

NewDenyDropTable returns a rule that rejects DROP TABLE statements.

func NewDenyTruncate

func NewDenyTruncate() sqlguard.Rule

NewDenyTruncate returns a rule that rejects TRUNCATE statements.

func NewInsertRequiresColumns

func NewInsertRequiresColumns() sqlguard.Rule

NewInsertRequiresColumns returns a rule that requires INSERT statements to contain an explicit target-column list.

func NewUpdateRequiresWhere

func NewUpdateRequiresWhere() sqlguard.Rule

NewUpdateRequiresWhere returns a rule that requires UPDATE statements to contain a syntactic WHERE clause.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL