gsqlutils

package module
v0.0.0-...-b8882df Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 8 Imported by: 1

README

gsqlutils

gsqlutils is a GoogleSQL tools using memefish.

It is mainly targetting Spanner's GoogleSQL dialect.

Roadmap

  • Extending to support other GoogleSQL implementations.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstNonHintToken

func FirstNonHintToken(filepath, s string) (token.Token, error)

FirstNonHintToken returns the first non-hint token. filepath can be empty, it is only used in error message. Note: Currently, this function doesn't take care about nested curly brace in a hint.

func LexerSeq

func LexerSeq(lexer *memefish.Lexer) iter.Seq2[token.Token, error]

LexerSeq converts memefish.Lexer to iter.Seq2 with error. If it reaches to EOF, it stops without error.

func NewLexerSeq

func NewLexerSeq(filename, s string) iter.Seq2[token.Token, error]

func SimpleSkipHints

func SimpleSkipHints(filepath, s string) (string, error)

SimpleSkipHints strips hints in an input string without parsing. It don't preserve any hints and comments and whitespaces. All tokens are separated with a single whitespace. filepath can be empty, it is only used in error message.

func SimpleSkipHintsSeq

func SimpleSkipHintsSeq(seq iter.Seq2[token.Token, error]) iter.Seq2[token.Token, error]

func SimpleStripComments

func SimpleStripComments(filepath, s string) (string, error)

SimpleStripComments strips comments in an input string without parsing. It don't preserve whitespaces. All tokens are separated with a single whitespace. filepath can be empty, it is only used in error message.

func StripComments

func StripComments(filepath, s string) (string, error)

StripComments strips comments in an input string without parsing but preserving whitespaces. This function won't panic but return error if lexer become error state. filepath can be empty, it is only used in error message.

Types

type ErrLexerStatus

type ErrLexerStatus struct {
	WaitingString string
}

func (*ErrLexerStatus) Error

func (e *ErrLexerStatus) Error() string

type RawStatement

type RawStatement struct {
	Pos, End   token.Pos
	Statement  string
	Terminator string
}

func SeparateInputPreserveCommentsWithStatus

func SeparateInputPreserveCommentsWithStatus(filepath, s string) ([]RawStatement, error)

func (*RawStatement) StripComments

func (stmt *RawStatement) StripComments() (RawStatement, error)

Directories

Path Synopsis
tools

Jump to

Keyboard shortcuts

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