func (x *storableWrap) Save(ch chan<- datastore.Property) error { ch <- datastore.Property{ Name: keyUpdated, Value: x.Updated, NoIndex: true, } return datastore.SaveStruct(x.Storable, ch) }
func (e *Evolution) Save(c chan<- datastore.Property) error { e.AncestorCount = len(e.Ancestry) var err error e.AncestryBytes, err = json.Marshal(e.Ancestry) if err != nil { panic(err) } return datastore.SaveStruct(e, c) }
func (u *user) Save(c chan<- datastore.Property) error { n := len(u.ConfirmCodes) u.confirmCodesKey = make([]string, 0, n) u.confirmCodesVal = make([]string, 0, n) for key, val := range u.ConfirmCodes { u.confirmCodesKey = append(u.confirmCodesKey, key) u.confirmCodesVal = append(u.confirmCodesVal, val) } return datastore.SaveStruct(u, c) }
func (score *Score) Save(c chan<- datastore.Property) os.Error { // インデックスがない値にコピー score.Japanese_noindex = score.Japanese score.Math_noindex = score.Math score.English_noindex = score.English datastore.SaveStruct(score, c) return nil }
func (notebook *Notebook) Save(c chan<- datastore.Property) error { // save Ordering buffer := new(bytes.Buffer) encoder := gob.NewEncoder(buffer) err := encoder.Encode(notebook.Order) if err != nil { return err } c <- datastore.Property{ Name: "Order", Value: buffer.Bytes(), NoIndex: true, } // save the rest return datastore.SaveStruct(notebook, c) }
// encode encodes src using gob.Encoder func encode(src interface{}) (b []byte, err error) { c := make(chan datastore.Property, 32) donec := make(chan struct{}) go func() { b, err = propertiesToGob(c) close(donec) }() var err1 error if e, ok := src.(datastore.PropertyLoadSaver); ok { err1 = e.Save(c) } else { err1 = datastore.SaveStruct(src, c) } <-donec if err1 != nil { return nil, err1 } return b, err }
func (d *Driver) SaveStruct(src interface{}, c chan<- datastore.Property) error { return datastore.SaveStruct(src, c) }