interpreter

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 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 Column

type Column struct {
	Name       string         `json:"name"`
	Type       ColumnType     `json:"type"`
	Token      TokenRange     `json:"token"`
	InlineRefs []interface{}  `json:"inline_refs"`
	PK         bool           `json:"pk"`
	Increment  *bool          `json:"increment,omitempty"`
	Unique     bool           `json:"unique"`
	NotNull    *bool          `json:"not_null,omitempty"`
	Note       *Note          `json:"note,omitempty"`
	DBDefault  *Default       `json:"dbdefault,omitempty"`
	Checks     *[]interface{} `json:"checks,omitempty"`
}

type ColumnType

type ColumnType struct {
	SchemaName *string     `json:"schemaName"`
	TypeName   string      `json:"type_name"`
	Args       interface{} `json:"args"`
}

type Database

type Database struct {
	Schemas       []interface{} `json:"schemas"`
	Tables        []Table       `json:"tables"`
	Notes         []interface{} `json:"notes"`
	Refs          []Ref         `json:"refs"`
	Enums         []Enum        `json:"enums"`
	TableGroups   []TableGroup  `json:"tableGroups"`
	Aliases       []interface{} `json:"aliases"`
	Project       interface{}   `json:"project"`
	TablePartials []interface{} `json:"tablePartials"`
	Records       []interface{} `json:"records"`
}

type Default

type Default struct {
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

type Enum

type Enum struct {
	Name       string      `json:"name"`
	SchemaName *string     `json:"schemaName"`
	Values     []EnumValue `json:"values"`
	Token      TokenRange  `json:"token"`
}

type EnumValue

type EnumValue struct {
	Name string `json:"name"`
	Note *Note  `json:"note,omitempty"`
}

type Error

type Error struct {
	Message  string
	Position lexer.Position
}

func (Error) Error

func (e Error) Error() string

type Interpreter

type Interpreter struct {
	Errors []Error
}

func New

func New() *Interpreter

func (*Interpreter) Interpret

func (interp *Interpreter) Interpret(prog *parser.ProgramNode) *Database

type Note

type Note struct {
	Value string     `json:"value"`
	Token TokenRange `json:"token"`
}

type Ref

type Ref struct {
	Token      TokenRange    `json:"token"`
	Name       *string       `json:"name"`
	SchemaName *string       `json:"schemaName"`
	Endpoints  []RefEndpoint `json:"endpoints"`
}

type RefEndpoint

type RefEndpoint struct {
	FieldNames []string   `json:"fieldNames"`
	TableName  string     `json:"tableName"`
	SchemaName *string    `json:"schemaName"`
	Relation   string     `json:"relation"`
	Token      TokenRange `json:"token"`
}

type Table

type Table struct {
	Name       string        `json:"name"`
	SchemaName *string       `json:"schemaName"`
	Alias      *string       `json:"alias"`
	Fields     []Column      `json:"fields"`
	Token      TokenRange    `json:"token"`
	Indexes    []interface{} `json:"indexes"`
	Partials   []interface{} `json:"partials"`
	Checks     []interface{} `json:"checks"`
	Note       *Note         `json:"note,omitempty"`
	Records    *TableRecords `json:"records,omitempty"`
}

type TableGroup

type TableGroup struct {
	Name   string     `json:"name"`
	Tables []string   `json:"tables"`
	Token  TokenRange `json:"token"`
}

type TableRecords

type TableRecords struct {
	Columns []string   `json:"columns"`
	Rows    [][]string `json:"rows"`
}

TableRecords holds parsed records data for a table.

type TokenPos

type TokenPos struct {
	Offset int `json:"offset"`
	Line   int `json:"line"`
	Column int `json:"column"`
}

type TokenRange

type TokenRange struct {
	Start TokenPos `json:"start"`
	End   TokenPos `json:"end"`
}

Jump to

Keyboard shortcuts

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