block

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package block handles the parsing of SQL query blocks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Path        string
	Name        string
	Command     Command
	SQL         string
	Doc         string
	Line        int
	Column      int
	StartOffset int
	EndOffset   int
	Suffix      string
	ParamTypes  []ParamTypeOverride // Explicit type overrides from @param comments
}

Block represents a parsed SQL query block.

func Slice

func Slice(path string, src []byte) ([]Block, error)

Slice extracts query blocks from a SQL file.

type Command

type Command int

Command represents the type of query (one, many, exec, etc.).

const (
	// CommandUnknown indicates an unrecognized command.
	CommandUnknown Command = iota
	// CommandOne indicates a query returning a single row.
	CommandOne
	// CommandMany indicates a query returning multiple rows.
	CommandMany
	// CommandExec indicates a query that executes without returning rows.
	CommandExec
	// CommandExecResult indicates a query that returns execution result (rows affected, etc.).
	CommandExecResult
)

func ParseCommand

func ParseCommand(tag string) (Command, bool)

ParseCommand parses a command tag (e.g., ":one") into a Command.

func (Command) String

func (c Command) String() string

type ParamTypeOverride added in v0.5.0

type ParamTypeOverride struct {
	ParamName string
	GoType    string
}

ParamTypeOverride represents an explicit type override for a parameter.

Jump to

Keyboard shortcuts

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