-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
208 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,52 @@ | ||
package values | ||
|
||
import ( | ||
"github.com/emacsway/grade/grade/internal/domain/seedwork/identity" | ||
"github.com/emacsway/grade/grade/internal/domain/seedwork/specification" | ||
tenant "github.com/emacsway/grade/grade/internal/domain/tenant/values" | ||
) | ||
|
||
func NewCompetenceId(value uint) (CompetenceId, error) { | ||
id, err := identity.NewIntIdentity(value) | ||
func NewCompetenceId(tenantId, competenceId uint) (CompetenceId, error) { | ||
tId, err := tenant.NewTenantId(tenantId) | ||
if err != nil { | ||
return CompetenceId{}, err | ||
} | ||
return CompetenceId{&id}, nil | ||
mId, err := NewInternalCompetenceId(competenceId) | ||
if err != nil { | ||
return CompetenceId{}, err | ||
} | ||
return CompetenceId{ | ||
tenantId: tId, | ||
competenceId: mId, | ||
}, nil | ||
} | ||
|
||
type CompetenceId struct { | ||
*identity.IntIdentity | ||
tenantId tenant.TenantId | ||
competenceId InternalCompetenceId | ||
} | ||
|
||
func (cid CompetenceId) TenantId() tenant.TenantId { | ||
return cid.tenantId | ||
} | ||
|
||
func (cid CompetenceId) CompetenceId() InternalCompetenceId { | ||
return cid.competenceId | ||
} | ||
|
||
func (cid CompetenceId) Equal(other specification.EqualOperand) bool { | ||
otherTyped, ok := other.(CompetenceId) | ||
if !ok { | ||
return false | ||
} | ||
return cid.tenantId.Equal(otherTyped.TenantId()) && cid.competenceId.Equal(otherTyped.CompetenceId()) | ||
} | ||
|
||
func (cid CompetenceId) Export(ex CompetenceIdExporterSetter) { | ||
ex.SetTenantId(cid.tenantId) | ||
ex.SetCompetenceId(cid.competenceId) | ||
} | ||
|
||
type CompetenceIdExporterSetter interface { | ||
SetTenantId(tenant.TenantId) | ||
SetCompetenceId(InternalCompetenceId) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.