Skip to content

Commit

Permalink
GetByID found bool
Browse files Browse the repository at this point in the history
  • Loading branch information
latolukasz committed Jan 9, 2024
1 parent 95f9a0c commit 185da1f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions get_by_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ import (
"strconv"
)

func MustByID[E any](orm ORM, id uint64) *E {
entity, found := GetByID[E](orm, id)
if !found {
panic(fmt.Errorf("entity withd ID %d not found", id))
}
return entity
}

func GetByID[E any](orm ORM, id uint64) (entity *E, found bool) {
var e E
cE := orm.(*ormImplementation)
Expand Down

0 comments on commit 185da1f

Please sign in to comment.