pelican/internal/board/identity.go
Dan Anglin 73547c49c6
All checks were successful
/ test (pull_request) Successful in 32s
/ lint (pull_request) Successful in 36s
refactor: add the Identity type
Add a new Identity type with the required methods so that now the board
types (Card, Status and soon Tag) can automatically satisfy the BoltItem
interface.
2024-01-23 19:42:35 +00:00

26 lines
380 B
Go

package board
type Identity struct {
ID int
}
// SetID updates the ID value with a valid ID value
// only if the ID is unset (i.e. < 1).
func (i *Identity) SetID(id int) error {
if id < 1 {
return InvalidIDError{id}
}
if i.ID > 0 {
return IDAlreadySetError{}
}
i.ID = id
return nil
}
// GetID returns the ID value.
func (i *Identity) GetID() int {
return i.ID
}