ResolveTableName implements the interface doltdb.RootValue.
(ctx context.Context, tName doltdb.TableName)
| 835 | |
| 836 | // ResolveTableName implements the interface doltdb.RootValue. |
| 837 | func (root *RootValue) ResolveTableName(ctx context.Context, tName doltdb.TableName) (string, bool, error) { |
| 838 | // Check the tables first |
| 839 | tableMap, err := root.getTableMap(ctx, tName.Schema) |
| 840 | if err != nil { |
| 841 | return "", false, err |
| 842 | } |
| 843 | a, err := tableMap.Get(ctx, tName.Name) |
| 844 | if err != nil { |
| 845 | return "", false, err |
| 846 | } |
| 847 | if !a.IsEmpty() { |
| 848 | return tName.Name, true, nil |
| 849 | } |
| 850 | found := false |
| 851 | resolvedName := tName.Name |
| 852 | err = tableMap.Iter(ctx, func(name string, addr hash.Hash) (bool, error) { |
| 853 | if !found && strings.EqualFold(tName.Name, name) { |
| 854 | resolvedName = name |
| 855 | found = true |
| 856 | } |
| 857 | return false, nil |
| 858 | }) |
| 859 | if err != nil { |
| 860 | return "", false, nil |
| 861 | } |
| 862 | if found { |
| 863 | return resolvedName, true, nil |
| 864 | } |
| 865 | // Then check the root objects |
| 866 | resolvedTableName, _, objID, err := rootobject.ResolveName(ctx, root, tName) |
| 867 | if err != nil { |
| 868 | return "", false, err |
| 869 | } |
| 870 | return resolvedTableName.Name, objID != objinterface.RootObjectID_None, nil |
| 871 | } |
| 872 | |
| 873 | // SetCollation implements the interface doltdb.RootValue. |
| 874 | func (root *RootValue) SetCollation(ctx context.Context, collation schema.Collation) (doltdb.RootValue, error) { |
nothing calls this directly
no test coverage detected