Compare commits
3 Commits
60fd016b5f
...
bafd839637
Author | SHA1 | Date | |
---|---|---|---|
bafd839637 | |||
b4d3a41459 | |||
4705d17e0e |
@ -166,7 +166,7 @@ func SetHasMany[T, V any, K comparable](assignmentFn func(*T, *[]V), pIdFn func(
|
|||||||
|
|
||||||
// RelationHasOne
|
// RelationHasOne
|
||||||
// eg: post has a user. fId is post's userId, pId is user's id
|
// eg: post has a user. fId is post's userId, pId is user's id
|
||||||
func RelationHasOne[M, P any, I constraints.Integer | uint64](fId func(*M) I, pId func(*P) I, setVal func(*M, *P), r Relationship) RelationFn {
|
func RelationHasOne[M, P any, I constraints.Integer | constraints.Unsigned](fId func(*M) I, pId func(*P) I, setVal func(*M, *P), r Relationship) RelationFn {
|
||||||
idFn := GetWithID(fId)
|
idFn := GetWithID(fId)
|
||||||
setFn := SetHasOne(setVal, fId, pId)
|
setFn := SetHasOne(setVal, fId, pId)
|
||||||
return func() (func(any) []any, func(any, any), any, any, Relationship) {
|
return func() (func(any) []any, func(any, any), any, any, Relationship) {
|
||||||
@ -177,8 +177,8 @@ func RelationHasOne[M, P any, I constraints.Integer | uint64](fId func(*M) I, pI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RelationHasMany
|
// RelationHasMany
|
||||||
// eg: post has many comments,mId is comment's postId, pId is post's id
|
// eg: post has many comments,mId is post's id, pId is comment's postId
|
||||||
func RelationHasMany[M, P any, I constraints.Integer | uint64](mId func(*M) I, pId func(*P) I, setVal func(*M, *[]P), r Relationship) RelationFn {
|
func RelationHasMany[M, P any, I constraints.Integer | constraints.Unsigned](mId func(*M) I, pId func(*P) I, setVal func(*M, *[]P), r Relationship) RelationFn {
|
||||||
idFn := GetWithID(mId)
|
idFn := GetWithID(mId)
|
||||||
setFn := SetHasMany(setVal, mId, pId)
|
setFn := SetHasMany(setVal, mId, pId)
|
||||||
return func() (func(any) []any, func(any, any), any, any, Relationship) {
|
return func() (func(any) []any, func(any, any), any, any, Relationship) {
|
||||||
|
Loading…
Reference in New Issue
Block a user