func (c *Context) Original() (coal.Model, error) {
	// begin trace
	c.Tracer.Push("fire/Context.Original")

	// check operation
	if c.Operation != Update {
		panic("fire: the original can only be loaded during an update operation")
	}

	// return cached model
	if c.original != nil {
		c.Tracer.Pop()
		return c.original, nil
	}

	// create a new model
	m := c.Model.Meta().Make()

	// read original document
	c.Tracer.Push("mgo/Query.One")
	c.Tracer.Tag("id", c.Model.ID())
	err := c.Store.C(c.Model).FindId(c.Model.ID()).One(m)
	if err != nil {
		return nil, err
	}
	c.Tracer.Pop()

	// cache model
	c.original = coal.Init(m)

	// finish trace
	c.Tracer.Pop()

	return c.original, nil
}
func (c *Context) Original() (coal.Model, error) {
	
	c.Tracer.Push("fire/Context.Original")

	
	if c.Operation != Update {
		panic("fire: the original can only be loaded during an update operation")
	}

	
	if c.original != nil {
		c.Tracer.Pop()
		return c.original, nil
	}

	
	m := c.Model.Meta().Make()

	
	c.Tracer.Push("mgo/Query.One")
	c.Tracer.Tag("id", c.Model.ID())
	err := c.Store.C(c.Model).FindId(c.Model.ID()).One(m)
	if err != nil {
		return nil, err
	}
	c.Tracer.Pop()

	
	c.original = coal.Init(m)

	
	c.Tracer.Pop()

	return c.original, nil
}
func ( c * Context ) Original ( ) ( coal . Model , error ) { // begin trace c . Tracer . Push ( " " ) // check operation if c . Operation != Update { panic ( " " ) } // return cached model if c . original != nil { c . Tracer . Pop ( ) return c . original , nil } // create a new model m := c . Model . Meta ( ) . Make ( ) // read original document c . Tracer . Push ( " " ) c . Tracer . Tag ( " " , c . Model . ID ( ) ) err := c . Store . C ( c . Model ) . FindId ( c . Model . ID ( ) ) . One ( m ) if err != nil { return nil , err } c . Tracer . Pop ( ) // cache model c . original = coal . Init ( m ) // finish trace c . Tracer . Pop ( ) return c . original , nil }
// Original will return the stored version of the model. This method is intended
// to be used to calculate the changed fields during an Update operation. Any
// returned error is already marked as fatal. This function will cache and reuse
// loaded models between multiple callbacks.
//
// Note: The method will panic if being used during any other operation than Update.
Original will return the stored version of the model . This method is intended to be used to calculate the changed fields during an Update operation . Any returned error is already marked as fatal . This function will cache and reuse loaded models between multiple callbacks . Note : The method will panic if being used during any other operation than Update .