Initial giu version, not very good looking, maybe prefer CharmBracelet Tea
This commit is contained in:
31
table.go
31
table.go
@@ -1,34 +1,39 @@
|
||||
package engine
|
||||
|
||||
type Table struct {
|
||||
Name string
|
||||
TableValues []TableValue
|
||||
Rows []Row
|
||||
Name string
|
||||
Columns []Column
|
||||
Rows []Row
|
||||
}
|
||||
|
||||
type ValueFlags uint32
|
||||
type ColumnFlag uint32
|
||||
|
||||
const (
|
||||
PRIMARY_KEY ValueFlags = 1 << iota
|
||||
PRIMARY_KEY ColumnFlag = 1 << iota
|
||||
FOREIGN_KEY
|
||||
NOT_NULL
|
||||
|
||||
NONE ColumnFlag = 0
|
||||
)
|
||||
|
||||
func (v ValueFlags) Has(flag ValueFlags) bool {
|
||||
func (v ColumnFlag) Has(flag ColumnFlag) bool {
|
||||
return v&flag == flag
|
||||
}
|
||||
|
||||
type TableValue struct {
|
||||
type Column struct {
|
||||
Type string
|
||||
Name string
|
||||
Reference *TableValue
|
||||
Flags ValueFlags
|
||||
Reference *Column
|
||||
Flags ColumnFlag
|
||||
}
|
||||
|
||||
type Value interface {
|
||||
Representation() string
|
||||
}
|
||||
|
||||
// For testing purposes its string right now
|
||||
// type Value interface {
|
||||
// Representation() string
|
||||
// }
|
||||
|
||||
type Row struct {
|
||||
Values map[TableValue]Value
|
||||
// This should be map but to Column so its always the right Column but for testing this is a slice now
|
||||
Values []string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user