-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Callbacks for the new struct conversion: BeforeConvert{To,From}Callba…
…ck, AfterConvert{To,From}Callback (#11) * Callbacks for the new struct conversion: BeforeConvert{To,From}Callback, AfterConvert{To,From}Callback * remove callback count
- Loading branch information
Showing
3 changed files
with
136 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,41 @@ | ||
package henge | ||
|
||
// BeforeCallback is a callback that is executed before the conversion from a struct to the struct. | ||
// Deprecated: Use BeforeConvertFromCallback instead. | ||
type BeforeCallback interface { | ||
BeforeConvert(src interface{}, store InstanceStore) error | ||
} | ||
|
||
// AfterCallback is a callback that is executed after the conversion from a struct to the struct. | ||
// Deprecated: Use AfterConvertFromCallback instead. | ||
type AfterCallback interface { | ||
AfterConvert(src interface{}, store InstanceStore) error | ||
} | ||
|
||
// BeforeConvertFromCallback is a callback that is executed before the conversion from a struct to the struct. | ||
// To define structures across packages, you need to define them in the package's struct that imports other packages. | ||
// Within structures of the same package, you must use BeforeConvertFromCallback. It cannot be used simultaneously with BeforeConvertToCallback. | ||
type BeforeConvertFromCallback interface { | ||
BeforeConvertFrom(src interface{}, store InstanceStore) error | ||
} | ||
|
||
// AfterConvertFromCallback is a callback that is executed after the conversion from a struct to the struct. | ||
// To define structures across packages, you need to define them in the package's struct that imports other packages. | ||
// Within structures of the same package, you must use AfterConvertFromCallback. It cannot be used simultaneously with AfterConvertToCallback. | ||
type AfterConvertFromCallback interface { | ||
AfterConvertFrom(src interface{}, store InstanceStore) error | ||
} | ||
|
||
// BeforeConvertToCallback is a callback that is executed before the conversion from the struct to a struct. | ||
// To define structures across packages, you need to define them in the package's struct that imports other packages. | ||
// Within structures of the same package, you must use BeforeConvertFromCallback. It cannot be used simultaneously with BeforeConvertToCallback. | ||
type BeforeConvertToCallback interface { | ||
BeforeConvertTo(dst interface{}, store InstanceStore) error | ||
} | ||
|
||
// AfterConvertToCallback is a callback that is executed after the conversion from the struct to a struct. | ||
// To define structures across packages, you need to define them in the package's struct that imports other packages. | ||
// Within structures of the same package, you must use AfterConvertFromCallback. It cannot be used simultaneously with AfterConvertToCallback. | ||
type AfterConvertToCallback interface { | ||
AfterConvertTo(dst interface{}, store InstanceStore) error | ||
} |
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