@@ -40,7 +40,8 @@ func (e *Episode) SetID(id int) {
4040// AfterFind is a callback that is run by Hare after
4141// a record is found.
4242// You need to add this method to each one of your
43- // models, but the only required line is the first one.
43+ // models, but the only required lines are the first one
44+ // and the last one.
4445func (e * Episode ) AfterFind (db * hare.Database ) error {
4546 // IMPORTANT!!! This line of code is necessary in your AfterFind
4647 // in order for the Find method to work correctly!
@@ -50,10 +51,10 @@ func (e *Episode) AfterFind(db *hare.Database) error {
5051 // required, but they are a good example of extra
5152 // functionality you can implement in your callbacks.
5253
53- // This is an example of how you can do Rails-like associations.
54- // When an episode is found, this code will run and lookup the
55- // associated host record then populate the embedded Host
56- // struct.
54+ // This is an example of how you can do a Rails-like
55+ // "belongs_to" association. When an episode is found, this
56+ // code will run and lookup the associated host record then
57+ // populate the embedded Host struct.
5758 h := Host {}
5859 err := db .Find ("hosts" , e .HostID , & h )
5960 if err != nil {
@@ -79,7 +80,7 @@ func (e *Episode) AfterFind(db *hare.Database) error {
7980}
8081
8182// QueryEpisodes takes a Hare db handle and a query function, and returns
82- // an array of episodes. If you add this boilerplate method to your model
83+ // an array of episodes. If you add this boilerplate function to your model
8384// you can then write queries using a closure as the query language.
8485func QueryEpisodes (db * hare.Database , queryFn func (e Episode ) bool , limit int ) ([]Episode , error ) {
8586 var results []Episode
0 commit comments