clean up boulderTypeConverter

This commit is contained in:
Roland Shoemaker 2015-05-03 01:57:30 -07:00
parent 0a4affaeba
commit 421434f2cb
1 changed files with 6 additions and 18 deletions

View File

@ -116,29 +116,17 @@ func (tc boulderTypeConverter) FromDb(target interface{}) (gorp.CustomScanner, b
return gorp.CustomScanner{new(string), target, binder}, true return gorp.CustomScanner{new(string), target, binder}, true
case *core.AcmeStatus: case *core.AcmeStatus:
binder := func(holder, target interface{}) error { binder := func(holder, target interface{}) error {
s, ok := holder.(*string) s := holder.(*string)
if !ok { st := target.(*core.AcmeStatus)
return errors.New("FromDb: Unable to convert core.OCSPStatus to string") *st = core.AcmeStatus(*s)
}
st, ok := target.(*core.AcmeStatus)
if !ok {
return errors.New("FromDb: Unable to convert core.OCSPStatus to string")
}
*st = core.AcmeStatus(string(*s))
return nil return nil
} }
return gorp.CustomScanner{new(string), target, binder}, true return gorp.CustomScanner{new(string), target, binder}, true
case *core.OCSPStatus: case *core.OCSPStatus:
binder := func(holder, target interface{}) error { binder := func(holder, target interface{}) error {
s, ok := holder.(*string) s := holder.(*string)
if !ok { st := target.(*core.OCSPStatus)
return errors.New("FromDb: Unable to convert core.OCSPStatus to string") *st = core.OCSPStatus(*s)
}
st, ok := target.(*core.OCSPStatus)
if !ok {
return errors.New("FromDb: Unable to convert core.OCSPStatus to string")
}
*st = core.OCSPStatus(string(*s))
return nil return nil
} }
return gorp.CustomScanner{new(string), target, binder}, true return gorp.CustomScanner{new(string), target, binder}, true