so mamy things...
This commit is contained in:
1 parent
f7a8d416c1
commit
78d50d9a6d
24 files changed
+516
-173
No files matched your search
@@ -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))
|
||||
}
|
||||
Reference in new issue
Block a user