printer

package
v0.0.0-...-7d4ee0b Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package printer implements AST → formatted Oracle SQL output.

The printer walks an AST and emits syntactically valid Oracle SQL with configurable formatting (keyword case, indentation). Primary entry point: Fprint(w, node) or Print(node).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fprint

func Fprint(w io.Writer, node ast.Node) error

Fprint prints a formatted representation of node to w using default config.

func FprintWithConfig

func FprintWithConfig(w io.Writer, node ast.Node, cfg Config) error

FprintWithConfig prints using the given config.

func Print

func Print(node ast.Node) string

Print returns the formatted SQL string for an AST node using default config.

func PrintWithConfig

func PrintWithConfig(node ast.Node, cfg Config) string

PrintWithConfig returns the formatted SQL string using the given config.

Types

type Config

type Config struct {
	KeywordCase KeywordCase // UpperCase (default) or LowerCase
	IndentMode  IndentMode  // IndentSpace (default) or IndentTab
	IndentSize  int         // chars per indent level; 0 defaults to 2
	LineWidth   int         // max chars per line; 0 = no limit
}

Config holds printer formatting options.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config with Oracle-conventional defaults.

type IndentMode

type IndentMode int

IndentMode controls the indentation character.

const (
	IndentSpace IndentMode = iota // indent with spaces (default)
	IndentTab                     // indent with tabs
)

type KeywordCase

type KeywordCase int

KeywordCase controls how SQL keywords are rendered.

const (
	UpperCase KeywordCase = iota
	LowerCase
)

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

Printer holds the internal state for printing an AST.

Source Files

  • create_type.go
  • expr.go
  • match_recognize.go
  • plsql.go
  • printer.go
  • sqlplus.go
  • stmt.go
  • types.go

Jump to

Keyboard shortcuts

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