token

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: MIT Imports: 0 Imported by: 0

README ¶

Token

Part of Entiqon / Database


🎯 Purpose

The token module provides low-level primitives that represent SQL fragments in a dialect-agnostic way.
These tokens are consumed by higher-level builders (e.g. SelectBuilder) to assemble safe, expressive, and auditable SQL statements.


📦 Sub-packages

Package Purpose
field Represents a column, identifier, or computed expression (with aliasing, raw expressions, validation).
table Represents a SQL source (table or view) used in FROM / JOIN clauses with aliasing and validation.
join Represents JOIN clauses (INNER, LEFT, RIGHT, FULL, CROSS, NATURAL) using join.Type for strict validation and safe construction.
condition Represents SQL conditions (predicates) for WHERE clauses. Provides Token interface, constructors (New, NewAnd, NewOr), operator/value validation, and contract compliance.
types Groups type enums (identifier, join, condition) that classify SQL expressions, joins, and conditions for consistent validation and rendering.
helpers Provides reusable validation utilities for identifiers, aliases, trailing aliases, reserved keywords, wildcards, deterministic alias generation, and expression classification.

🚧 Roadmap

Planned tokens:

  • functions (aggregates, JSON, custom expressions)

Contracts will progressively enforce stricter auditability across all tokens.


📄 License

MIT — © Entiqon Project

Documentation ¶

Overview ¶

Package token provides low-level primitives to represent SQL query fragments in a dialect-agnostic way.

Overview ¶

The token package defines atomic building blocks such as Field, Table, and Join. These tokens are consumed by higher-level builders (e.g. SelectBuilder) to assemble safe, expressive, and auditable SQL statements.

Contracts ¶

All tokens implement a shared set of contracts:

  • BaseToken — identity (input, expression, alias, validity)
  • Errorable — explicit error state, never panic
  • Clonable — safe duplication with preserved state
  • Rawable — SQL-generic rendering (expr, alias, owner)
  • Renderable — dialect-agnostic String() output
  • Stringable — concise diagnostic/logging string
  • Ownerable — ownership binding (HasOwner, Owner, SetOwner)

Subpackages ¶

  • field: represents a column, identifier, or computed expression with aliasing, validation, and diagnostics.

  • table: represents a SQL source (table or view) used in FROM / JOIN clauses with aliasing and validation support.

  • join: represents JOIN clauses (INNER, LEFT, etc.) with validation of join kind and conditions.

Supporting modules ¶

  • resolver: centralizes input type validation and expression resolution (expr, alias, kind) with strict rules and subquery detection.

  • expression_kind: classifies raw expressions into categories (Identifier, Computed, Literal, Subquery, Function, Aggregate) and validates identifier aliases, including reserved keyword checks.

Roadmap ¶

Future tokens will include:

  • conditions (WHERE / HAVING)
  • functions (aggregates, JSON, custom expressions)

Contracts will progressively enforce stricter auditability across all tokens.

Directories ¶

Path Synopsis
Package condition defines SQL condition tokens used by the Entiqon SQL builder.
Package condition defines SQL condition tokens used by the Entiqon SQL builder.
Package field defines the token.Field type, a low-level primitive used by the SQL builder.
Package field defines the token.Field type, a low-level primitive used by the SQL builder.
Package helpers provides classification and resolution utilities for SQL token parsing.
Package helpers provides classification and resolution utilities for SQL token parsing.
Package token provides primitives to represent SQL JOIN clauses in a dialect-agnostic way.
Package token provides primitives to represent SQL JOIN clauses in a dialect-agnostic way.
Package table defines the token.Table type, which represents a SQL table or subquery source with optional alias.
Package table defines the token.Table type, which represents a SQL table or subquery source with optional alias.
Package types defines low-level, dependency-free classifications used by SQL tokens.
Package types defines low-level, dependency-free classifications used by SQL tokens.
condition
Package condition provides primitives to represent SQL conditional expressions (WHERE, HAVING, ON).
Package condition provides primitives to represent SQL conditional expressions (WHERE, HAVING, ON).
identifier
Package identifier provides the classification of SQL expressions into broad syntactic categories such as subqueries, functions, aggregates, literals, and plain identifiers.
Package identifier provides the classification of SQL expressions into broad syntactic categories such as subqueries, functions, aggregates, literals, and plain identifiers.
join
Package join provides low-level primitives to represent SQL JOIN clauses in a dialect-agnostic way.
Package join provides low-level primitives to represent SQL JOIN clauses in a dialect-agnostic way.
operator
Package operator provides the set of SQL comparison and predicate operators supported by Entiqon condition tokens (WHERE, ON, HAVING).
Package operator provides the set of SQL comparison and predicate operators supported by Entiqon condition tokens (WHERE, ON, HAVING).

Jump to

Keyboard shortcuts

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