Skip to content

Commit

Permalink
satellite/satellitedb: remove duplicate NullUUID
Browse files Browse the repository at this point in the history
Change-Id: I0fa583140ab14448c26c602838aa035d8372b965
  • Loading branch information
egonelbre committed Jun 13, 2023
1 parent d394249 commit 00d233b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
4 changes: 2 additions & 2 deletions satellite/satellitedb/projectmembers.go
Expand Up @@ -241,11 +241,11 @@ func (pm *projectMembers) GetPagedWithInvitationsByProjectID(ctx context.Context

for rows.Next() {
var (
memberID NullUUID
memberID uuid.NullUUID
projectID uuid.UUID
createdAt time.Time
email string
inviterID NullUUID
inviterID uuid.NullUUID
)

err = rows.Scan(
Expand Down
24 changes: 0 additions & 24 deletions satellite/satellitedb/util.go
Expand Up @@ -6,7 +6,6 @@ package satellitedb
import (
"github.com/zeebo/errs"

"storj.io/common/uuid"
"storj.io/private/tagsql"
)

Expand Down Expand Up @@ -61,26 +60,3 @@ func convertSliceWithErrors[In, Out any](xs []In, fn func(In) (Out, error)) ([]O
}
return rs, errs
}

// NullUUID represents a nullable uuid.UUID that can be used as an SQL scan destination.
type NullUUID struct {
UUID uuid.UUID
Valid bool
}

// Scan implements the sql.Scanner interface.
// It scans a value from the database into the NullUUID.
func (nu *NullUUID) Scan(value interface{}) error {
if value == nil {
nu.UUID = uuid.UUID{}
nu.Valid = false
return nil
}
valueBytes, ok := value.([]byte)
if !ok {
return errs.New("invalid UUID type")
}
copy(nu.UUID[:], valueBytes)
nu.Valid = true
return nil
}

0 comments on commit 00d233b

Please sign in to comment.