parser

package
v0.0.0-...-4746da5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding struct {
	Name        string
	Placeholder string
}

Binding represents the Ruby Binding struct.

func NewBinding

func NewBinding(name, placeholder string) *Binding

NewBinding is a constructor function for Binding.

func (*Binding) ArgName

func (b *Binding) ArgName() string

ArgName returns the arg name, similar to the arg_name method in Ruby.

func (*Binding) ArgType

func (b *Binding) ArgType() string

ArgType returns the argument type based on the arg name.

type ParsedQueries

type ParsedQueries []*ParsedQuery

func Load

func Load(glob string) (ParsedQueries, error)

func NewParsedQueries

func NewParsedQueries(queries []*ParsedQuery) ParsedQueries

func (ParsedQueries) Range

func (pqs ParsedQueries) Range(f func(pq *ParsedQuery))

Range allows you to iterate over each of the parsed queries.

func (ParsedQueries) Validate

func (pqs ParsedQueries) Validate() error

Validate checks if any query name appears more than once and raises an error if it does.

type ParsedQuery

type ParsedQuery struct {
	Name     string
	Type     string
	SQL      string
	Filename string
	Line     int
}

func NewParsedQuery

func NewParsedQuery(name, queryType, sql, filename string, line int) *ParsedQuery

func (*ParsedQuery) Bindings

func (pq *ParsedQuery) Bindings() []*Binding

func (*ParsedQuery) Prepared

func (pq *ParsedQuery) Prepared() bool

Jump to

Keyboard shortcuts

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