satellite/satellitedb: remove duplicate NullUUID
Change-Id: I0fa583140ab14448c26c602838aa035d8372b965
This commit is contained in:
parent
d39424993b
commit
00d233bca5
@ -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(
|
||||
|
@ -6,7 +6,6 @@ package satellitedb
|
||||
import (
|
||||
"github.com/zeebo/errs"
|
||||
|
||||
"storj.io/common/uuid"
|
||||
"storj.io/private/tagsql"
|
||||
)
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user