FetchSchema fetchs the schema of given table name
(tableName string)
| 180 | |
| 181 | // FetchSchema fetchs the schema of given table name |
| 182 | func (cf *CachedSchemaHandler) FetchSchema(tableName string) (*TableSchema, error) { |
| 183 | cf.RLock() |
| 184 | schema, exist := cf.schemas[tableName] |
| 185 | cf.RUnlock() |
| 186 | if exist { |
| 187 | return schema, nil |
| 188 | } |
| 189 | table, err := cf.schemaFetcher.FetchSchema(tableName) |
| 190 | if err != nil { |
| 191 | return nil, err |
| 192 | } |
| 193 | schema = cf.setTable(table) |
| 194 | err = cf.fetchAndSetEnumCases(table) |
| 195 | return schema, err |
| 196 | } |
| 197 | |
| 198 | // PrepareEnumCases prepares enum cases |
| 199 | func (cf *CachedSchemaHandler) PrepareEnumCases(tableName, columnName string, enumCases []string) error { |
no test coverage detected