Unlink removes a large object from the database.
(ctx context.Context, oid uint32)
| 47 | |
| 48 | // Unlink removes a large object from the database. |
| 49 | func (o *LargeObjects) Unlink(ctx context.Context, oid uint32) error { |
| 50 | var result int32 |
| 51 | err := o.tx.QueryRow(ctx, "select lo_unlink($1)", oid).Scan(&result) |
| 52 | if err != nil { |
| 53 | return err |
| 54 | } |
| 55 | |
| 56 | if result != 1 { |
| 57 | return errors.New("failed to remove large object") |
| 58 | } |
| 59 | |
| 60 | return nil |
| 61 | } |
| 62 | |
| 63 | // A LargeObject is a large object stored on the server. It is only valid within the transaction that it was initialized |
| 64 | // in. It uses the context it was initialized with for all operations. It implements these interfaces: |