forked from dolthub/go-mysql-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcatalog_map.go
150 lines (122 loc) · 3.82 KB
/
catalog_map.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package sql
import (
"fmt"
)
type MapCatalog struct {
Tables map[string]Table
Funcs map[string]Function
tabFuncs map[string]TableFunction
Databases map[string]Database
}
var _ Catalog = MapCatalog{}
func (t MapCatalog) WithTableFunctions(fns ...TableFunction) (TableFunctionProvider, error) {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) Function(ctx *Context, name string) (Function, error) {
if f, ok := t.Funcs[name]; ok {
return f, nil
}
return nil, fmt.Errorf("func not found")
}
func (t MapCatalog) TableFunction(ctx *Context, name string) (TableFunction, error) {
if f, ok := t.tabFuncs[name]; ok {
return f, nil
}
return nil, fmt.Errorf("table func not found")
}
func (t MapCatalog) ExternalStoredProcedure(ctx *Context, name string, numOfParams int) (*ExternalStoredProcedureDetails, error) {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) ExternalStoredProcedures(ctx *Context, name string) ([]ExternalStoredProcedureDetails, error) {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) AllDatabases(ctx *Context) []Database {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) HasDatabase(ctx *Context, name string) bool {
_, ok := t.Databases[name]
return ok
}
func (t MapCatalog) Database(ctx *Context, name string) (Database, error) {
if f, ok := t.Databases[name]; ok {
return f, nil
}
return nil, fmt.Errorf("database not found")
}
func (t MapCatalog) CreateDatabase(ctx *Context, dbName string, collation CollationID) error {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) RemoveDatabase(ctx *Context, dbName string) error {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) Table(ctx *Context, dbName, tableName string) (Table, Database, error) {
if db, ok := t.Databases[dbName]; ok {
if t, ok, err := db.GetTableInsensitive(ctx, tableName); ok {
return t, db, nil
} else {
return nil, nil, err
}
}
return nil, nil, fmt.Errorf("table not found")
}
func (t MapCatalog) TableAsOf(ctx *Context, dbName, tableName string, asOf interface{}) (Table, Database, error) {
return t.Table(ctx, dbName, tableName)
}
func (t MapCatalog) DatabaseTable(ctx *Context, db Database, tableName string) (Table, Database, error) {
if t, ok, err := db.GetTableInsensitive(ctx, tableName); ok {
return t, db, nil
} else {
return nil, nil, err
}
}
func (t MapCatalog) DatabaseTableAsOf(ctx *Context, db Database, tableName string, asOf interface{}) (Table, Database, error) {
return t.DatabaseTable(ctx, db, tableName)
}
func (t MapCatalog) RegisterFunction(ctx *Context, fns ...Function) {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) LockTable(ctx *Context, table string) {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) UnlockTables(ctx *Context, id uint32) error {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) GetTableStats(ctx *Context, db, table string) ([]Statistic, error) {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) RefreshTableStats(ctx *Context, table Table, db string) error {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) SetStats(ctx *Context, stats Statistic) error {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) GetStats(ctx *Context, qual StatQualifier, cols []string) (Statistic, bool) {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) DropStats(ctx *Context, qual StatQualifier, cols []string) error {
//TODO implement me
panic("implement me")
}
func (t MapCatalog) RowCount(ctx *Context, db, table string) (uint64, error) {
return 1, nil
}
func (t MapCatalog) DataLength(ctx *Context, db, table string) (uint64, error) {
return 1, nil
}
func (t MapCatalog) DropDbStats(ctx *Context, db string, flush bool) error {
//TODO implement me
panic("implement me")
}