Merge pull request #59 from flynn/large-objects

Minor docs fixes for large objects
This commit is contained in:
Jack Christensen 2015-01-02 19:05:46 -06:00
commit 1e92e5afe6
2 changed files with 8 additions and 6 deletions

View File

@ -25,6 +25,7 @@ The pgx native interface supports the following extra features:
* Configurable connection pool with after connect hooks to do arbitrary connection setup * Configurable connection pool with after connect hooks to do arbitrary connection setup
* PostgreSQL array to Go slice mapping for integers, floats, and strings * PostgreSQL array to Go slice mapping for integers, floats, and strings
* Hstore support * Hstore support
* Large object support
## database/sql ## database/sql

View File

@ -78,18 +78,19 @@ func (o *LargeObjects) Unlink(oid Oid) error {
} }
// A LargeObject is a large object stored on the server. It is only valid within // A LargeObject is a large object stored on the server. It is only valid within
// the transaction that it was initialized in. It implements the these interfaces: // the transaction that it was initialized in. It implements these interfaces:
// //
// - io.Writer // io.Writer
// - io.Reader // io.Reader
// - io.Seeker // io.Seeker
// - io.Closer // io.Closer
type LargeObject struct { type LargeObject struct {
fd int32 fd int32
lo *LargeObjects lo *LargeObjects
} }
// Write writes // Write writes p to the large object and returns the number of bytes written
// and an error if not all of p was written.
func (o *LargeObject) Write(p []byte) (int, error) { func (o *LargeObject) Write(p []byte) (int, error) {
n, err := fpInt32(o.lo.fp.CallFn("lowrite", []fpArg{fpIntArg(o.fd), p})) n, err := fpInt32(o.lo.fp.CallFn("lowrite", []fpArg{fpIntArg(o.fd), p}))
return int(n), err return int(n), err