1
// Copyright 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
7
"labix.org/v2/mgo/bson"
9
"launchpad.net/juju-core/version"
12
type toolsDoc struct {
13
Version version.Binary
19
// GetBSON returns the structure to be serialized for the tools as a generic
21
func (t *Tools) GetBSON() (interface{}, error) {
25
return &toolsDoc{t.Version, t.URL, t.Size, t.SHA256}, nil
28
// SetBSON updates the internal members with the data stored in the bson.Raw
30
func (t *Tools) SetBSON(raw bson.Raw) error {
32
// Preserve the nil value in that case.
36
if err := raw.Unmarshal(&doc); err != nil {
39
t.Version = doc.Version