-
-
Save vitiko/c139c746505573c43be7244bb1036cc7 to your computer and use it in GitHub Desktop.
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
type CPaperImpl struct { | |
} | |
func (cc *CPaperImpl) state(ctx router.Context) m.MappedState { | |
return m.WrapState(ctx.State(), m.StateMappings{}. | |
// Create mapping for Commercial Paper entity | |
Add(&schema.CommercialPaper{}, | |
m.PKeySchema(&schema.CommercialPaperId{}), // Key namespace will be <"CommercialPaper", Issuer, PaperNumber> | |
m.List(&schema.CommercialPaperList{}), // Structure of result for List method | |
m.UniqKey("ExternalId"), // External Id is unique | |
)) | |
} | |
func (cc *CPaperImpl) event(ctx router.Context) state.Event { | |
return m.WrapEvent(ctx.Event(), m.EventMappings{}. | |
// Event name will be "IssueCommercialPaper", payload - same as issue payload | |
Add(&schema.IssueCommercialPaper{}). | |
// Event name will be "BuyCommercialPaper" | |
Add(&schema.BuyCommercialPaper{}). | |
// Event name will be "RedeemCommercialPaper" | |
Add(&schema.RedeemCommercialPaper{})) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment