35 lines
481 B
Go
35 lines
481 B
Go
package engine
|
|
|
|
type Table struct {
|
|
Name string
|
|
TableValues []TableValue
|
|
Rows []Row
|
|
}
|
|
|
|
type ValueFlags uint32
|
|
|
|
const (
|
|
PRIMARY_KEY ValueFlags = 1 << iota
|
|
FOREIGN_KEY
|
|
NOT_NULL
|
|
)
|
|
|
|
func (v ValueFlags) Has(flag ValueFlags) bool {
|
|
return v&flag == flag
|
|
}
|
|
|
|
type TableValue struct {
|
|
Type string
|
|
Name string
|
|
Reference *TableValue
|
|
Flags ValueFlags
|
|
}
|
|
|
|
type Value interface {
|
|
Representation() string
|
|
}
|
|
|
|
type Row struct {
|
|
Values map[TableValue]Value
|
|
}
|