Skip to content

Commit

Permalink
New PK naming for ArtifactId
Browse files Browse the repository at this point in the history
  • Loading branch information
emacsway committed Nov 20, 2023
1 parent 324573f commit 16f1bdb
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions grade/internal/domain/artifact/values/internal_artifact_id.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package values

import (
"github.com/emacsway/grade/grade/internal/domain/seedwork/identity"
)

func NewInternalArtifactId(value uint) (InternalArtifactId, error) {
id, err := identity.NewIntIdentity(value)
if err != nil {
return InternalArtifactId{}, err
}
return InternalArtifactId{id}, nil
}

type InternalArtifactId struct {
identity.IntIdentity
}
17 changes: 17 additions & 0 deletions grade/internal/domain/artifact/values/internal_artifact_id_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package values

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestInternalArtifactIdConstructor(t *testing.T) {
val := uint(3)
id, err := NewInternalArtifactId(val)
if err != nil {
t.Error(err)
t.FailNow()
}
assert.Equal(t, val, id.Value())
}

0 comments on commit 16f1bdb

Please sign in to comment.