Class ReaderImpl<V>

java.lang.Object
de.chojo.sadu.queries.execution.reading.ReaderImpl<V>
All Implemented Interfaces:
DataSourceProvider, ConnectionProvider, QueryProvider, Reader<V>
Direct Known Subclasses:
AutoMappedQuery, MappedQuery

public abstract class ReaderImpl<V> extends Object implements QueryProvider, Reader<V>
  • Constructor Details

  • Method Details

    • firstResult

      public Result<V> firstResult()
      Description copied from interface: Reader
      Retrieves a single result from the query.

      See Reader.first() for direct access

      Specified by:
      firstResult in interface Reader<V>
      Returns:
      the result of the query
    • allResults

      public Result<List<V>> allResults()
      Description copied from interface: Reader
      Retrieves all the results of the query.

      See Reader.all() for direct access

      Specified by:
      allResults in interface Reader<V>
      Returns:
      a Result object containing a List of results
    • storeOneAndAppend

      public AppendedQuery storeOneAndAppend(String key)
      Description copied from interface: Reader
      Stores a query result and allows to create a new query.
      Specified by:
      storeOneAndAppend in interface Reader<V>
      Parameters:
      key - the key used to identify the stored result
      Returns:
      an AppendedQuery object that can execute another query with the same chain
    • storeAllAndAppend

      public AppendedQuery storeAllAndAppend(String key)
      Description copied from interface: Reader
      Stores all query results and allows to create a new query.
      Specified by:
      storeAllAndAppend in interface Reader<V>
      Parameters:
      key - the key used to identify the stored result
      Returns:
      an AppendedQuery object that can execute another query with the same chain
    • mapper

      protected abstract RowMapping<V> mapper(ResultSet set) throws SQLException
      Throws:
      SQLException
    • mapperConfig

      protected MapperConfig mapperConfig()
    • first

      public Optional<V> first()
      Description copied from interface: Reader
      Retrieves the first value from the query result and wraps it in an Optional object.

      If the query returns no results, an empty Optional object is returned.

      Specified by:
      first in interface Reader<V>
      Returns:
      an Optional containing the first value from the query result, or an empty Optional if the query returns no results
    • all

      public List<V> all()
      Description copied from interface: Reader
      Retrieves all elements from the Reader.
      Specified by:
      all in interface Reader<V>
      Returns:
      a List of all elements
    • sql

      public TokenizedQuery sql()
    • call

      public Call call()
    • query

      public QueryImpl query()
      Specified by:
      query in interface QueryProvider