NewDataReader is a constructor function for DataReader. It initializes a new DataReader with a given database, a logger, and sets transaction options to be read-only with Repeatable Read isolation level.
(database *db.Postgres)
| 32 | // NewDataReader is a constructor function for DataReader. |
| 33 | // It initializes a new DataReader with a given database, a logger, and sets transaction options to be read-only with Repeatable Read isolation level. |
| 34 | func NewDataReader(database *db.Postgres) *DataReader { |
| 35 | return &DataReader{ |
| 36 | database: database, // Set the database to the passed in PostgreSQL instance |
| 37 | txOptions: pgx.TxOptions{IsoLevel: pgx.RepeatableRead, AccessMode: pgx.ReadOnly}, // Set the transaction options |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | // QueryRelationships reads relation tuples from the storage based on the given filter. |
| 42 | func (r *DataReader) QueryRelationships(ctx context.Context, tenantID string, filter *base.TupleFilter, snap string, pagination database.CursorPagination) (it *database.TupleIterator, err error) { |
no outgoing calls
no test coverage detected