-
-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1102 from dolthub/andy/table-refactor
go/libraries/doltcore/{doltdb,table}: remove row access methods from doltdb.Table This refactor is in preparation for keyless tables. Keyless tables have different row storage semantics than keyed tables, and row access must account for this.
- Loading branch information
Showing
18 changed files
with
297 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2020 Dolthub, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package doltdb | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/dolthub/dolt/go/libraries/doltcore/row" | ||
"github.com/dolthub/dolt/go/libraries/doltcore/schema" | ||
"github.com/dolthub/dolt/go/store/types" | ||
) | ||
|
||
func DocTblKeyFromName(fmt *types.NomsBinFormat, name string) (types.Tuple, error) { | ||
return types.NewTuple(fmt, types.Uint(DocNameTag), types.String(name)) | ||
} | ||
|
||
func getDocRow(ctx context.Context, docTbl *Table, sch schema.Schema, key types.Tuple) (r row.Row, ok bool, err error) { | ||
rowMap, err := docTbl.GetRowData(ctx) | ||
if err != nil { | ||
return nil, false, err | ||
} | ||
|
||
var fields types.Value | ||
fields, ok, err = rowMap.MaybeGet(ctx, key) | ||
if err != nil || !ok { | ||
return nil, ok, err | ||
} | ||
|
||
r, err = row.FromNoms(sch, key, fields.(types.Tuple)) | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.