-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(integration): allow to run begin and endblocker easily (#15732)
- Loading branch information
1 parent
0a70647
commit 9a5413d
Showing
4 changed files
with
115 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package integration | ||
|
||
// Config is the configuration for the integration app. | ||
type Config struct { | ||
AutomaticBeginEndBlock bool | ||
AutomaticCommit bool | ||
} | ||
|
||
// Option is a function that can be used to configure the integration app. | ||
type Option func(*Config) | ||
|
||
// WithAutomaticBlockCreation enables begin/end block calls. | ||
func WithAutomaticBeginEndBlock() Option { | ||
return func(cfg *Config) { | ||
cfg.AutomaticBeginEndBlock = true | ||
} | ||
} | ||
|
||
// WithAutomaticCommit enables automatic commit. | ||
// This means that the integration app will automatically commit the state after each msgs. | ||
func WithAutomaticCommit() Option { | ||
return func(cfg *Config) { | ||
cfg.AutomaticCommit = true | ||
} | ||
} |
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