Skip to content

Commit

Permalink
rename database.IndexReader as database.IndexDatabaseWithReader
Browse files Browse the repository at this point in the history
  • Loading branch information
sfomuseumbot committed Nov 4, 2023
1 parent cdaef77 commit e7e41d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion database/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func IndexDatabaseWithFS(ctx context.Context, db SpatialDatabase, index_fs fs.FS

defer r.Close()

return IndexReader(ctx, db, r)
return IndexDatabaseWithReader(ctx, db, r)
}

return fs.WalkDir(index_fs, ".", walk_func)
Expand Down
2 changes: 1 addition & 1 deletion database/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func IndexDatabaseWithIterator(ctx context.Context, db SpatialDatabase, iterator
// pass
}

return IndexReader(ctx, db, r)
return IndexDatabaseWithReader(ctx, db, r)
}

iter, err := iterator.NewIterator(ctx, iterator_uri, iter_cb)
Expand Down
6 changes: 3 additions & 3 deletions database/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/whosonfirst/go-whosonfirst-feature/geometry"
)

func IndexReader(ctx context.Context, db SpatialDatabase, r io.Reader) error {
func IndexDatabaseWithReader(ctx context.Context, db SpatialDatabase, r io.Reader) error {

index_func := func(ctx context.Context, body []byte, geom_type string) error {

Expand All @@ -35,15 +35,15 @@ func IndexReader(ctx context.Context, db SpatialDatabase, r io.Reader) error {
}

// Check to see if this is a FeatureCollection

t_rsp := gjson.GetBytes(body, "type")

if !t_rsp.Exists() || t_rsp.String() != "FeatureCollection" {
return fmt.Errorf("Failed to derive geometry type for record, %w", err)
}

// If it is process each file

fc, err := geojson.UnmarshalFeatureCollection(body)

if err != nil {
Expand Down

0 comments on commit e7e41d4

Please sign in to comment.