engine

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package engine executes logic operations on sequences.

Index

Constants

View Source
const (
	IntType = iota
	StringType
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name   string
	Type   token.Token
	Values []ValueInterface
}

Column - part of the Table containing name of Column and values in it

type DbEngine

type DbEngine struct {
	Tables map[string]*Table
}

func New

func New() *DbEngine

New Return new DbEngine struct

func (*DbEngine) CreateTable

func (engine *DbEngine) CreateTable(command *ast.CreateCommand)

CreateTable - initialize new table in engine with specified name

func (*DbEngine) DeleteFromTable added in v0.0.2

func (engine *DbEngine) DeleteFromTable(deleteCommand *ast.DeleteCommand, whereCommand *ast.WhereCommand)

DeleteFromTable - Delete all rows of data from table that match given condition

func (*DbEngine) InsertIntoTable

func (engine *DbEngine) InsertIntoTable(command *ast.InsertCommand)

InsertIntoTable - Insert row of values into the table

func (*DbEngine) SelectFromTable

func (engine *DbEngine) SelectFromTable(command *ast.SelectCommand) *Table

SelectFromTable - Return Table containing all values requested by SelectCommand

func (*DbEngine) SelectFromTableWithOrderBy added in v0.0.2

func (engine *DbEngine) SelectFromTableWithOrderBy(selectCommand *ast.SelectCommand, orderByCommand *ast.OrderByCommand) *Table

SelectFromTableWithOrderBy - Return Table containing all values requested by SelectCommand and sorted by OrderByCommand

func (*DbEngine) SelectFromTableWithWhere added in v0.0.2

func (engine *DbEngine) SelectFromTableWithWhere(selectCommand *ast.SelectCommand, whereCommand *ast.WhereCommand) *Table

SelectFromTableWithWhere - Return Table containing all values requested by SelectCommand and filtered by WhereCommand

func (*DbEngine) SelectFromTableWithWhereAndOrderBy added in v0.0.2

func (engine *DbEngine) SelectFromTableWithWhereAndOrderBy(selectCommand *ast.SelectCommand, whereCommand *ast.WhereCommand, orderByCommand *ast.OrderByCommand) *Table

SelectFromTableWithWhereAndOrderBy - Return Table containing all values requested by SelectCommand, filtered by WhereCommand and sorted by OrderByCommand

type IntegerValue added in v0.0.2

type IntegerValue struct {
	Value int
}

IntegerValue - Implementation of ValueInterface that is containing integer values

func (IntegerValue) GetType added in v0.0.2

func (value IntegerValue) GetType() SupportedTypes

GetType implementations

func (IntegerValue) IsEqual added in v0.0.2

func (value IntegerValue) IsEqual(valueInterface ValueInterface) bool

IsEqual implementations

func (IntegerValue) ToString added in v0.0.2

func (value IntegerValue) ToString() string

ToString implementations

type StringValue added in v0.0.2

type StringValue struct {
	Value string
}

StringValue - Implementation of ValueInterface that is containing string values

func (StringValue) GetType added in v0.0.2

func (value StringValue) GetType() SupportedTypes

func (StringValue) IsEqual added in v0.0.2

func (value StringValue) IsEqual(valueInterface ValueInterface) bool

func (StringValue) ToString added in v0.0.2

func (value StringValue) ToString() string

type SupportedTypes added in v0.0.2

type SupportedTypes int

type Table added in v0.0.2

type Table struct {
	Columns []*Column
}

Table - Contain Columns that store values in engine

func (*Table) ToString added in v0.0.2

func (table *Table) ToString() string

ToString - Return string contain all values and Column names in Table

type ValueInterface added in v0.0.2

type ValueInterface interface {
	ToString() string
	GetType() SupportedTypes
	IsEqual(valueInterface ValueInterface) bool
	// contains filtered or unexported methods
}

ValueInterface - Represent all supported types of data that can be inserted into Table

Jump to

Keyboard shortcuts

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