coocood/qbs — pull request #24 by pix64 (2013-07-03 07:07:50+00:00)
Title: Support sql.null* types in models

This pull request adds Null* types from the database/sql package to the Hood SQL Types and adds support for the types in SetModelValue. I've tested the changes with both mysql, postgresql, and sqlite. Everything looks to be working as expected.

---
Example:
```go
type Test struct {
Id hood.Id
Number sql.NullInt64
}

a = new(Test)
q.Save(a) //Number column is set to NULL in database (defaults to NULL)

b = new(Test)
b.Number = sql.NullInt64{128, true} //Number column is set to 128 in database
q.Save(b)

c = new(Test)
c.Number = sql.NullInt64{128, false} //Number column is set to NULL in database since valid bool is set to false
q.Save(c)
````
Retrieving the row which was inserted by q.Save(c) above will give you a sql.NullInt64{0, false} for Number field

I also have allowed join columns to be of type sql.NullInt64.

```go
type Player struct {
Id int64
Name string
TeamId sql.NullInt64
Team *Team
}

type Team struct {
Id int64
Name string
}

player1 := new(Player)
player1.Name = "Peter"
player1.TeamId = sql.NullInt64{team.Id, true}
q.Save(player1)

player2 := new(Player)
player2.Name = "Ewan"
q.Save(player2)
```

In this scenario, a player can only be on 1 team at a time, but it is also possible he is not on any team.

---

Any feedback would be appreciated.