本文整理匯總了Golang中github.com/paulfchristiano/dwimmer/dynamics.Dwimmer.Save方法的典型用法代碼示例。如果您正苦於以下問題:Golang Dwimmer.Save方法的具體用法?Golang Dwimmer.Save怎麽用?Golang Dwimmer.Save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/paulfchristiano/dwimmer/dynamics.Dwimmer
的用法示例。
在下文中一共展示了Dwimmer.Save方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: fallThrough
func fallThrough(d dynamics.Dwimmer, s *term.SettingT, quotedSetting term.T) term.T {
settingT, err := represent.ToSettingT(d, quotedSetting)
if err != nil {
return term.Make("asked to decide what to do in setting [], "+
"but while converting to a setting received []").T(quotedSetting, err)
}
transition := ElicitAction(d, s, settingT.Setting)
if shouldSave(transition) {
d.Save(settingT.Setting, transition)
}
return TakeTransition.T(represent.Transition(transition))
}
示例2: findAction
func findAction(d dynamics.Dwimmer, s *term.SettingT, quotedSetting term.T) term.T {
setting, err := represent.ToSetting(d, quotedSetting)
if err != nil {
return term.Make("asked to decide what to do in setting [], "+
"but while converting to a setting received []").T(quotedSetting, err)
}
transition, ok := d.Get(setting)
if !ok {
transition := ElicitAction(d, s, setting)
d.Save(setting, transition)
}
return core.Answer.T(represent.Transition(transition))
}
示例3: setTransition
func setTransition(d dynamics.Dwimmer, s *term.SettingT, quotedTransition, quotedSetting term.T) term.T {
transition, err := represent.ToTransition(d, quotedTransition)
if err != nil {
return term.Make("asked to set a setting to transition [], "+
"but while converting to a transition received []").T(quotedTransition, err)
}
setting, err := represent.ToSetting(d, quotedSetting)
if err != nil {
return term.Make("asked to set a transition in setting [], "+
"but while converting to a setting received []").T(quotedSetting, err)
}
d.Save(setting, transition)
return core.OK.T()
}