Files
sqv-engine/sql/ast.go

38 lines
704 B
Go

package sql
import "fmt"
type Statement interface {
isEnumValue()
}
type CreateTableStatement struct {
TableName string
Columns []Column
}
func (c *CreateTableStatement) Print() {
fmt.Printf("Name: %v\nColumns:\n", c.TableName)
for _, column := range c.Columns {
fmt.Printf("- Name: %v\n Type: %v\n Extras:\n", column.Name, column.Type)
for _, extra := range column.Extra {
fmt.Printf(" - %v\n", extra)
}
}
}
type Column struct {
Name string
Type string
Extra []string
}
// Unused, just for example sake for now
type SelectStatement struct {
From string
Fields []string
}
func (_ *CreateTableStatement) isEnumValue() {}
func (_ *SelectStatement) isEnumValue() {}