// Update will replace the contents of the named object with the whole
// of the new object.
Update will replace the contents of the named object with the whole
of the new object.
// Update will replace the contents of the named object with the whole // of the new object .
func (fs *FileStore) Update(name string, gobj interface{}) (err error) {
	if !fs.Exists(fs.Basepath + "/" + name) {
		return fmt.Errorf("Update: File Does Exists")
	}
	stobj := gobj 
	jbuf, err := json.MarshalIndent(stobj, "  ", "  ")
	if err != nil {
		return err
	}
	path := fs.Basepath + "/" + name
	err = ioutil.WriteFile(path, jbuf, 0644)
	if err != nil {
		return fmt.Errorf("  Store.Object write failed %s -> %v", path, err)
	}
	return err
}
func ( fs * FileStore ) Update ( name string , gobj interface { } ) ( err error ) { if ! fs . Exists ( fs . Basepath + " " + name ) { return fmt . Errorf ( " " ) } stobj := gobj jbuf , err := json . MarshalIndent ( stobj , " " , " " ) if err != nil { return err } path := fs . Basepath + " " + name err = ioutil . WriteFile ( path , jbuf , 0644 ) if err != nil { return fmt . Errorf ( " " , path , err ) } return err }
Update will replace the contents of the named object with the whole
of the new object.
Update will replace the contents of the named object with the whole of the new object .
// Update is opposite of create. Update errors if the file does not exist // XXX ~ We are assuming this is going to be JSON Fix this! // turn an interface into an object // JSONify the "object" param // Now write to the file