Skip to content

Commit

Permalink
chore: Import defradb/errors for Join (#3343)
Browse files Browse the repository at this point in the history
## Relevant issue(s)

Resolves #3334 

## Description

In many locations in the code base, we were importing the `"errors"`
package in order to utilize the `Join` function. However, we now have
this functionality as part of our own errors package. So throughout the
codebase import statements, `"errors"` has been changed to
`"github.com/sourcenetwork/defradb/errors"`

## Tasks

- [x] I made sure the code is well commented, particularly
hard-to-understand areas.
- [x] I made sure the repository-held documentation is changed
accordingly.
- [x] I made sure the pull request title adheres to the conventional
commit style (the subset used in the project can be found in
[tools/configs/chglog/config.yml](tools/configs/chglog/config.yml)).
- [ ] I made sure to discuss its limitations such as threats to
validity, vulnerability to mistake and misuse, robustness to
invalidation of assumptions, resource requirements, ...

## How has this been tested?

Specify the platform(s) on which this was tested:
- Windows
  • Loading branch information
ChrisBQu authored Jan 1, 2025
1 parent 65fa135 commit 84b0660
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion client/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ package client

import (
"context"
"errors"
"fmt"
"strings"

"github.com/sourcenetwork/immutable"

"github.com/sourcenetwork/defradb/client/request"
"github.com/sourcenetwork/defradb/datastore"
"github.com/sourcenetwork/defradb/errors"
)

// CollectionDefinition contains the metadata defining what a Collection is.
Expand Down
2 changes: 1 addition & 1 deletion client/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package client

import (
"encoding/json"
"errors"
"regexp"
"strings"
"sync"
Expand All @@ -24,6 +23,7 @@ import (
"github.com/valyala/fastjson"

"github.com/sourcenetwork/defradb/client/request"
"github.com/sourcenetwork/defradb/errors"
ccid "github.com/sourcenetwork/defradb/internal/core/cid"
)

Expand Down
3 changes: 2 additions & 1 deletion datastore/prefix_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ package datastore
import (
"context"
"encoding/json"
"errors"

ds "github.com/ipfs/go-datastore"

"github.com/ipfs/go-datastore/query"

"github.com/sourcenetwork/defradb/errors"
)

// DeserializePrefix deserializes all elements with the given prefix from the given storage.
Expand Down
3 changes: 2 additions & 1 deletion http/client_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"net/http"
"net/url"
"strings"

"github.com/sourcenetwork/immutable"
sse "github.com/vito/go-sse/sse"

"github.com/sourcenetwork/defradb/errors"

"github.com/sourcenetwork/defradb/client"
"github.com/sourcenetwork/defradb/internal/encryption"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/db/description/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ package description
import (
"context"
"encoding/json"
"errors"
"sort"

ds "github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/query"

"github.com/sourcenetwork/defradb/client"
"github.com/sourcenetwork/defradb/datastore"
"github.com/sourcenetwork/defradb/errors"
"github.com/sourcenetwork/defradb/internal/keys"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/db/fetcher/indexer_iterators.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ package fetcher
import (
"cmp"
"context"
"errors"
"strings"
"time"

ds "github.com/ipfs/go-datastore"

"github.com/sourcenetwork/defradb/client"
"github.com/sourcenetwork/defradb/datastore"
"github.com/sourcenetwork/defradb/errors"
"github.com/sourcenetwork/defradb/internal/connor"
"github.com/sourcenetwork/defradb/internal/keys"
"github.com/sourcenetwork/defradb/internal/planner/mapper"
Expand Down
4 changes: 2 additions & 2 deletions internal/db/fetcher/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
package fetcher

import (
"errors"

"github.com/sourcenetwork/immutable"

"github.com/sourcenetwork/defradb/errors"
)

// multiFetcher is a fetcher that orchastrates the fetching of documents via multiple child fetchers.
Expand Down
2 changes: 1 addition & 1 deletion internal/db/indexed_docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package db
import (
"context"
"encoding/json"
"errors"
"testing"

ipfsDatastore "github.com/ipfs/go-datastore"
Expand All @@ -28,6 +27,7 @@ import (
"github.com/sourcenetwork/defradb/client"
"github.com/sourcenetwork/defradb/datastore"
"github.com/sourcenetwork/defradb/datastore/mocks"
"github.com/sourcenetwork/defradb/errors"
"github.com/sourcenetwork/defradb/internal/core"
"github.com/sourcenetwork/defradb/internal/db/fetcher"
fetcherMocks "github.com/sourcenetwork/defradb/internal/db/fetcher/mocks"
Expand Down
2 changes: 1 addition & 1 deletion internal/db/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package db

import (
"context"
"errors"
"fmt"

ds "github.com/ipfs/go-datastore"
Expand All @@ -23,6 +22,7 @@ import (
"github.com/sourcenetwork/defradb/acp/identity"
"github.com/sourcenetwork/defradb/client"
"github.com/sourcenetwork/defradb/client/request"
"github.com/sourcenetwork/defradb/errors"
"github.com/sourcenetwork/defradb/internal/core"
"github.com/sourcenetwork/defradb/internal/db/description"
"github.com/sourcenetwork/defradb/internal/keys"
Expand Down
3 changes: 1 addition & 2 deletions internal/request/graphql/schema/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
package schema

import (
"errors"

"github.com/sourcenetwork/defradb/client"
"github.com/sourcenetwork/defradb/errors"

gql "github.com/sourcenetwork/graphql-go"
gqlp "github.com/sourcenetwork/graphql-go/language/parser"
Expand Down
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ package node

import (
"context"
"errors"
"fmt"
gohttp "net/http"

"github.com/sourcenetwork/corelog"
"github.com/sourcenetwork/immutable"

"github.com/sourcenetwork/defradb/client"
"github.com/sourcenetwork/defradb/errors"
"github.com/sourcenetwork/defradb/http"
"github.com/sourcenetwork/defradb/internal/db"
"github.com/sourcenetwork/defradb/internal/kms"
Expand Down

0 comments on commit 84b0660

Please sign in to comment.