putTable provides an inner implementation that is called from multiple other functions.
(ctx context.Context, tName doltdb.TableName, ref types.Ref)
| 924 | |
| 925 | // putTable provides an inner implementation that is called from multiple other functions. |
| 926 | func (root *RootValue) putTable(ctx context.Context, tName doltdb.TableName, ref types.Ref) (doltdb.RootValue, error) { |
| 927 | if !doltdb.IsValidTableName(tName.Name) { |
| 928 | panic("Don't attempt to put a table with a name that fails the IsValidTableName check") |
| 929 | } |
| 930 | |
| 931 | newStorage, err := root.st.EditTablesMap(ctx, root.VRW(), root.NodeStore(), []storage.TableEdit{{Name: tName, Ref: &ref}}) |
| 932 | if err != nil { |
| 933 | return nil, err |
| 934 | } |
| 935 | |
| 936 | return root.withStorage(newStorage), nil |
| 937 | } |
| 938 | |
| 939 | // withStorage returns a new root value with the given storage. |
| 940 | func (root *RootValue) withStorage(st storage.RootStorage) *RootValue { |
no test coverage detected