identsafe

package
v3.8.7 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package identsafe centralises the SQL identifier (field name) validation shared by every dialect.

Each dialect previously reimplemented the same validateFieldName skeleton — empty check, optional length cap, identifier-format regexp, reserved-keyword lookup — differing only in the per-dialect data (max length, keyword set). Sharing the skeleton keeps the validation logic in one place while each dialect retains its own identifier rules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateFieldName

func ValidateFieldName(name, dialectName string, maxLen int, nameRE *regexp.Regexp, reserved map[string]bool) error

ValidateFieldName checks that name is a safe unquoted SQL identifier for a dialect.

  • dialectName appears in the length-limit error message (e.g. "PostgreSQL").
  • maxLen is the maximum identifier length; pass 0 (or negative) to skip the length check for dialects that impose no practical limit.
  • nameRE is the dialect's identifier-format pattern.
  • reserved is the dialect's set of reserved keywords (lowercased keys).

Types

This section is empty.

Jump to

Keyboard shortcuts

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