40 lines
633 B
Go
40 lines
633 B
Go
package engine
|
|
|
|
type Table struct {
|
|
Name string
|
|
Columns []Column
|
|
Rows []Row
|
|
}
|
|
|
|
type ColumnFlag uint32
|
|
|
|
const (
|
|
PRIMARY_KEY ColumnFlag = 1 << iota
|
|
FOREIGN_KEY
|
|
NOT_NULL
|
|
|
|
NONE ColumnFlag = 0
|
|
)
|
|
|
|
func (v ColumnFlag) Has(flag ColumnFlag) bool {
|
|
return v&flag == flag
|
|
}
|
|
|
|
type Column struct {
|
|
Type string
|
|
Name string
|
|
Reference *Column
|
|
Flags ColumnFlag
|
|
}
|
|
|
|
|
|
// For testing purposes its string right now
|
|
// type Value interface {
|
|
// Representation() string
|
|
// }
|
|
|
|
type Row struct {
|
|
// This should be map but to Column so its always the right Column but for testing this is a slice now
|
|
Values []string
|
|
}
|