astaxie/beedb — pull request #49 by gabstv (2014-02-11 20:47:09+00:00)
Title: Added Model nesting by using the 'inline' keyword

Here's another feature inspired from [mgo](http://labix.org/mgo). It allows beedb's reflection to marshall/unmarshall the nested structs as if its fields were at the same level as the main struct's fields.
```go
//example
var orm beedb.Model

type SQLModel struct {
Id int `beedb:"PK" sql:"id"`
Created time.Time `sql:"created"`
Modified time.Time `sql:"modified"`
}
type User struct {
SQLModel `sql:",inline"`
Name string `sql:"name" tname:"fn_group"`
Auth int `sql:"auth"`
}

func main() {
// ...
user := &User{}
// ...
orm.Where("id=?", 1).Find(user)
fmt.Println(user.Id)
fmt.Println(user.Created)
fmt.Println(user.Name)
}
```