so mamy things...

This commit is contained in:
didier amyot committed 2015-07-05 17:17:01 -04:00
1 parent f7a8d416c1
commit 78d50d9a6d
24 files changed
+516 -173

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
package doormen
import (
"gopkg.in/mgo.v2/bson"
"math/big"
)
func (val *DoormanValue) GetBSON() (interface{}, error) {
ret := &doormanValue{val.Name, ""}
txt, err := val.Probability.MarshalText()
if err != nil {
return nil, err
}
ret.Probability = string(txt)
return ret, nil
}
func (val *DoormanValue) SetBSON(raw bson.Raw) error {
v := new(doormanValue)
if err := raw.Unmarshal(v); err != nil {
return err
}
val.Name = v.Name
val.Probability = new(big.Rat)
return val.Probability.UnmarshalText([]byte(v.Probability))
}