// SPDX-FileCopyrightText: 2026 Stefan Majewsky // SPDX-License-Identifier: Apache-2.0 package oblast_pgx import ( "database/sql" "errors" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgconn" "go.xyrillian.de/oblast/handle" ) type wrappedRows struct { inner pgx.Rows } var _ handle.Rows = wrappedRows{} // Columns implements the [handle.Rows] interface. func (r wrappedRows) Columns() ([]string, error) { descriptions := r.inner.FieldDescriptions() result := make([]string, len(descriptions)) for idx, desc := range descriptions { result[idx] = desc.Name } return result, nil } // Close implements the [handle.Rows] interface. func (r wrappedRows) Close() error { r.inner.Close() return nil } // Err implements the [handle.Rows] interface. func (r wrappedRows) Err() error { return r.inner.Err() } // Next implements the [handle.Rows] interface. func (r wrappedRows) Next() bool { return r.inner.Next() } // Scan implements the [handle.Rows] interface. func (r wrappedRows) Scan(args ...any) error { return r.inner.Scan(args...) } type wrappedResult struct { inner pgconn.CommandTag } var _ sql.Result = wrappedResult{} // LastInsertId implements the [sql.Result] interface. func (r wrappedResult) LastInsertId() (int64, error) { return 0, errors.New("PostgreSQL does not support LastInsertId()") } // LastInsertId implements the [sql.Result] interface. func (r wrappedResult) RowsAffected() (int64, error) { return r.inner.RowsAffected(), nil }