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

This reverts commit cdf2107cf8.
This commit is contained in:
Ariel Mashraki
2020-10-28 18:12:11 +02:00
committed by GitHub
parent cdf2107cf8
commit 2e6c066323
27 changed files with 28 additions and 28 deletions

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -237,7 +237,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 := range c.hooks {
for i := len(c.hooks) - 1; i >= 0; i-- {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -354,7 +354,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 := range c.hooks {
for i := len(c.hooks) - 1; i >= 0; i-- {
mutator = c.hooks[i](mutator)
}
return mutator

View File

@@ -354,7 +354,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 := range c.hooks {
for i := len(c.hooks) - 1; i >= 0; i-- {
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 := range c.hooks {
for i := len(c.hooks) - 1; i >= 0; i-- {
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 := range c.hooks {
for i := len(c.hooks) - 1; i >= 0; i-- {
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 := range c.hooks {
for i := len(c.hooks) - 1; i >= 0; i-- {
mutator = c.hooks[i](mutator)
}
return mutator

View File

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

View File

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