// QueryTx retrieves records with the specified offset and limit from the database.
QueryTx retrieves records with the specified offset and limit from the database.
// QueryTx retrieves records with the specified offset and limit from the database .
func (r MigrationRepository) QueryTx(ctx context.Context, t migration.Transaction, query *migration.QueryCondition, offset, limit uint) ([]migration.Log, error) {
	var items []migration.Log
	var where string
	tx, ok := t.(*sqlx.Tx)
	if !ok {
		return nil, errors.New("can not assert param t migration.Transaction to *sqlx.Tx")
	}
	if limit < 1 {
		limit = MaxLIstLimit
	}
	params := []interface{}{limit, offset}
	if query != nil && query.Where != nil {
		where = " WHERE status = $3 "
		params = append(params, query.Where.Status)
	}
	err := tx.SelectContext(ctx, &items, "SELECT * FROM " + migration.TableName + where + " LIMIT $1 OFFSET $2", params...)
	if err != nil {
		if err == sql.ErrNoRows {
			return nil, apperror.ErrNotFound
		}
	}
	return items, err
}
func ( r MigrationRepository ) QueryTx ( ctx context . Context , t migration . Transaction , query * migration . QueryCondition , offset , limit uint ) ( [ ] migration . Log , error ) { var items [ ] migration . Log var where string tx , ok := t . ( * sqlx . Tx ) if ! ok { return nil , errors . New ( " " ) } if limit < 1 { limit = MaxLIstLimit } params := [ ] interface { } { limit , offset } if query != nil && query . Where != nil { where = " " params = append ( params , query . Where . Status ) } err := tx . SelectContext ( ctx , & items , " " + migration . TableName + where + " " , params ... ) if err != nil { if err == sql . ErrNoRows { return nil , apperror . ErrNotFound } } return items , err }
QueryTx retrieves records with the specified offset and limit from the database.
QueryTx retrieves records with the specified offset and limit from the database .