Documentation
¶
Overview ¶
Package sqlid validates SQL identifiers (table names) before they are interpolated into DDL/DML, guarding against SQL identifier injection. It composes on database/identifier: each dot-separated part is judged by that package's Oracle grammar, the union alphabet (letters, digits, underscore, $, #) every vendor the framework supports accepts, so the grammar has one home and cannot drift from the renderers'.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IndexBaseName ¶
IndexBaseName returns the unqualified last dot-separated segment of name, used to derive index (and similar) identifier names. An index name cannot be schema-qualified, so a schema-qualified table like "myschema.events" must base its index names on "events" while the index still targets the qualified table.
func LeaderTableName ¶ added in v0.61.0
LeaderTableName returns the companion leader-table name for a table, preserving any schema prefix ("myschema.outbox" -> "myschema.outbox_leader"). The input has already passed ValidateTableName.
func ValidateTableName ¶
ValidateTableName checks that name is a safe SQL identifier. Supports optional schema-qualified names (e.g., "myschema.table"). Returns a descriptive error when name is empty, contains dangerous SQL fragments, has more than two dot-separated parts, or any part is not a valid identifier or exceeds identifier.MaxOracleBytes. The error message has no package prefix; callers wrap it with their own prefix (e.g. fmt.Errorf("outbox: %w", err)).
Types ¶
This section is empty.