sqlclass

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package sqlclass classifies SQL strings into a leading verb and a best-effort primary table name. It is deliberately small: a hand-rolled scanner, no dependency on a full SQL parser. Output drives the Op.Name field used by the adapter/sql and adapter/pgx chaos adapters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Classification

type Classification struct {
	Verb  string
	Table string
}

Classification carries the verb and table extracted from a SQL string. Both fields are uppercased ASCII for the verb and case-preserved for the table identifier (with surrounding quotes/brackets stripped and a schema prefix removed).

func Classify

func Classify(sql string) Classification

Classify returns a Classification for sql. Unrecognized input yields the leading token as Verb (uppercased) and an empty Table. Empty input yields the zero Classification.

Jump to

Keyboard shortcuts

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