relops/sqlc — pull request #6 by 0x6e6562 (2014-12-23 12:57:07+00:00)
Title: Add basic support for RETURNING syntax

As discussed in #5, this patch provides basic support for the RETURNING syntax on Postgres.

Take the following example auto-increment table definition:

```sql
CREATE TABLE key_value
(
id SERIAL PRIMARY KEY,
value TEXT
);
```

You can use the `Returning()` API like so:

```go
var id int
row, err := sqlc.InsertInto(KEY_VALUE).
SetString(KEY_VALUE.VALUE, "foo").
Returning(KEY_VALUE.ID).
Fetch(d, db)
err = row.Scan(&id)
```

Right now, no other database is supported, so if people require this, then let their requirements be known. Also, the API only accepts one column definition in the `Returning()` function - in the future we could expand this to be variadic. There are probably are few more things that could be made more flexible as well.