parser

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Column   string
	Operator string
	Value    interface{}
}

Condition represents WHERE clause

type GroupInfo

type GroupInfo struct {
	Column        string
	AggregateFunc string
	AggregateCol  string
}

GroupInfo represents GROUP BY with aggregate

type JoinInfo

type JoinInfo struct {
	Tangki1   string
	Tangki2   string
	NewTangki string
	OnColumn1 string
	OnColumn2 string
}

JoinInfo represents JOIN operation

type Lexer

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

func NewLexer

func NewLexer(input string) *Lexer

func (*Lexer) GetAllTokens

func (l *Lexer) GetAllTokens() []Token

func (*Lexer) NextToken

func (l *Lexer) NextToken() Token

type OrderInfo

type OrderInfo struct {
	Column    string
	Ascending bool
}

OrderInfo represents ORDER BY

type Parser

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

func NewParser

func NewParser(input string) *Parser

func (*Parser) Parse

func (p *Parser) Parse() (*Query, error)

Parse parses the FQL query

type Query

type Query struct {
	Type      string
	Tangki    string
	Columns   []string
	Values    []interface{}
	Condition *Condition
	JoinInfo  *JoinInfo
	OrderInfo *OrderInfo
	GroupInfo *GroupInfo
	UnionInfo *UnionInfo
}

Query represents parsed FQL query

type Token

type Token struct {
	Type  TokenType
	Value string
	Pos   int
}

Token represents a lexical token

type TokenType

type TokenType int

TokenType represents FQL token types

const (
	// Commands
	TOKEN_BUAT TokenType = iota
	TOKEN_TANGKI
	TOKEN_ISI
	TOKEN_NILAI
	TOKEN_PILIH
	TOKEN_DARI
	TOKEN_DIMANA
	TOKEN_ATUR
	TOKEN_SET
	TOKEN_BAKAR
	TOKEN_GABUNG
	TOKEN_DAN
	TOKEN_KE
	TOKEN_MENJADI
	TOKEN_CAMPUR
	TOKEN_SATUKAN
	TOKEN_URUTKAN
	TOKEN_BERDASARKAN
	TOKEN_GRUPKAN
	TOKEN_MENAIK
	TOKEN_MENURUN

	// Data Types
	TOKEN_INT
	TOKEN_FLOAT
	TOKEN_TEKS

	// Operators
	TOKEN_EQUALS
	TOKEN_GT
	TOKEN_LT
	TOKEN_GTE
	TOKEN_LTE
	TOKEN_NEQ
	TOKEN_PLUS
	TOKEN_MINUS
	TOKEN_MULTIPLY
	TOKEN_DIVIDE

	// Aggregates
	TOKEN_SUM
	TOKEN_AVG
	TOKEN_COUNT
	TOKEN_MAX
	TOKEN_MIN

	// Literals
	TOKEN_IDENTIFIER
	TOKEN_NUMBER
	TOKEN_STRING
	TOKEN_ASTERISK

	// Punctuation
	TOKEN_LPAREN
	TOKEN_RPAREN
	TOKEN_COMMA
	TOKEN_DOT
	TOKEN_EOF
	TOKEN_UNKNOWN
)

type UnionInfo

type UnionInfo struct {
	Tangkis   []string
	NewTangki string
}

UnionInfo represents UNION operation

Jump to

Keyboard shortcuts

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