entc/gen: invoke chain hook in order to registration (#898)

This commit is contained in:
Alex Snast
2020-10-28 18:05:20 +02:00
committed by GitHub
parent f63ba65bd7
commit cdf2107cf8
27 changed files with 28 additions and 28 deletions

View File

@@ -198,7 +198,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -185,7 +185,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -198,7 +198,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -185,7 +185,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -185,7 +185,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -198,7 +198,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -185,7 +185,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -198,7 +198,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -185,7 +185,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -185,7 +185,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -185,7 +185,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -211,7 +211,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -211,7 +211,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -211,7 +211,7 @@ func NewChain(hooks ...ent.Hook) Chain {
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
for i := range c.hooks {
mutator = c.hooks[i](mutator)
}
return mutator