Class YdbTable<T extends tech.ydb.yoj.repository.db.Entity<T>>

java.lang.Object
tech.ydb.yoj.repository.ydb.table.YdbTable<T>
All Implemented Interfaces:
tech.ydb.yoj.repository.db.Table<T>

public class YdbTable<T extends tech.ydb.yoj.repository.db.Entity<T>> extends Object implements tech.ydb.yoj.repository.db.Table<T>
  • Constructor Details

  • Method Details

    • findAll

      public List<T> findAll()
      Specified by:
      findAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • streamAll

      public Stream<T> streamAll(int batchSize)
      Provides stream for all entities in a collection. Makes mutliple queries if necessary, each selecting at most batchSize. batchSize should be small enough to ensure that batch does not exceed 40Mib
      Specified by:
      streamAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
      Parameters:
      batchSize - number of entities to fetch in query to db. Max 5000.
      Returns:
      stream of all entities in a collection
    • streamAll

      public <V extends tech.ydb.yoj.repository.db.Table.ViewId<T>> Stream<V> streamAll(Class<V> viewType, int batchSize)
      view support for streamAll(int)
      Specified by:
      streamAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • streamPartial

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<T> streamPartial(ID partial, int batchSize)
      Provides stream for entities in a collection filtered by partial PK. Makes mutliple queries if necessary, each selecting at most batchSize. batchSize should be small enough to ensure that batch does not exceed 40Mib
      Specified by:
      streamPartial in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
      Parameters:
      partial - partial PK
      batchSize - number of entities to fetch in query to db. Max 5000.
      Returns:
      stream of selected entities in a collection
    • streamPartial

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>, V extends tech.ydb.yoj.repository.db.Table.ViewId<T>> Stream<V> streamPartial(Class<V> viewType, ID partial, int batchSize)
      Specified by:
      streamPartial in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • streamAllIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<ID> streamAllIds(int batchSize)
      Specified by:
      streamAllIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • streamPartialIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<ID> streamPartialIds(ID partial, int batchSize)
      Specified by:
      streamPartialIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • findAll

      public <V extends tech.ydb.yoj.repository.db.Table.View> List<V> findAll(Class<V> viewType)
      Specified by:
      findAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • deleteAll

      public void deleteAll()
      Specified by:
      deleteAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • bulkUpsert

      public void bulkUpsert(List<T> input, tech.ydb.yoj.repository.db.bulk.BulkParams params)
      Specified by:
      bulkUpsert in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • readTable

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<T> readTable(tech.ydb.yoj.repository.db.readtable.ReadTableParams<ID> params)
      Specified by:
      readTable in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • readTableIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<ID> readTableIds(tech.ydb.yoj.repository.db.readtable.ReadTableParams<ID> params)
      Specified by:
      readTableIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • readTable

      public <V extends tech.ydb.yoj.repository.db.Table.ViewId<T>, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> Stream<V> readTable(Class<V> viewClass, tech.ydb.yoj.repository.db.readtable.ReadTableParams<ID> params)
      Specified by:
      readTable in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public T find(tech.ydb.yoj.repository.db.Entity.Id<T> id)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View> V find(Class<V> viewType, tech.ydb.yoj.repository.db.Entity.Id<T> id)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<T> find(tech.ydb.yoj.repository.db.Range<ID> range)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<V> find(Class<V> viewType, tech.ydb.yoj.repository.db.Range<ID> range)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<V> find(Class<V> viewType, Set<ID> ids)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public final List<T> find(YqlStatementPart<?> part, YqlStatementPart<?>... otherParts)
    • find

      public List<T> find(Collection<? extends YqlStatementPart<?>> parts)
    • countAll

      public long countAll()
      Specified by:
      countAll in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • count

      public long count(String indexName, FilterExpression<T> filter)
      Specified by:
      count in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public List<T> find(@Nullable String indexName, @Nullable FilterExpression<T> filter, @Nullable OrderExpression<T> orderBy, @Nullable Integer limit, @Nullable Long offset)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • findIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<ID> findIds(@Nullable String indexName, @Nullable FilterExpression<T> filter, @Nullable OrderExpression<T> orderBy, @Nullable Integer limit, @Nullable Long offset)
      Specified by:
      findIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View> List<V> find(Class<V> viewType, @Nullable String indexName, @Nullable FilterExpression<T> filter, @Nullable OrderExpression<T> orderBy, @Nullable Integer limit, @Nullable Long offset, boolean distinct)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<T> find(Set<ID> ids, @Nullable FilterExpression<T> filter, @Nullable OrderExpression<T> orderBy, @Nullable Integer limit)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • findUncached

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<T> findUncached(Set<ID> ids, @Nullable FilterExpression<T> filter, @Nullable OrderExpression<T> orderBy, @Nullable Integer limit)
      Specified by:
      findUncached in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View, ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<V> find(Class<V> viewType, Set<ID> ids, @Nullable FilterExpression<T> filter, @Nullable OrderExpression<T> orderBy, @Nullable Integer limit)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <K> List<T> find(String indexName, Set<K> keys, @Nullable FilterExpression<T> filter, @Nullable OrderExpression<T> orderBy, @Nullable Integer limit)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View, K> List<V> find(Class<V> viewType, String indexName, Set<K> keys, @Nullable FilterExpression<T> filter, @Nullable OrderExpression<T> orderBy, @Nullable Integer limit)
      Specified by:
      find in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • buildStatementParts

      public static <T extends tech.ydb.yoj.repository.db.Entity<T>> List<YqlStatementPart<? extends YqlStatementPart<?>>> buildStatementParts(@Nullable FilterExpression<T> filter, @Nullable OrderExpression<T> orderBy, @Nullable Integer limit, @Nullable Long offset)
    • buildStatementParts

      public static <T extends tech.ydb.yoj.repository.db.Entity<T>> List<YqlStatementPart<? extends YqlStatementPart<?>>> buildStatementParts(@Nullable String indexName, @Nullable FilterExpression<T> filter, @Nullable OrderExpression<T> orderBy, @Nullable Integer limit, @Nullable Long offset)
    • count

      public long count(YqlStatementPart<?>... parts)
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View> List<V> find(Class<V> viewType, YqlStatementPart<?> part, YqlStatementPart<?>... otherParts)
    • find

      public <V extends tech.ydb.yoj.repository.db.Table.View> List<V> find(Class<V> viewType, Collection<? extends YqlStatementPart<?>> parts, boolean distinct)
    • findIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<ID> findIds(YqlStatementPart<?> part, YqlStatementPart<?>... otherParts)
    • findIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<ID> findIds(tech.ydb.yoj.repository.db.Range<ID> range)
      Specified by:
      findIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • findIds

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> List<ID> findIds(Set<ID> partialIds)
      Specified by:
      findIds in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • update

      public void update(tech.ydb.yoj.repository.db.Entity.Id<T> id, tech.ydb.yoj.repository.db.statement.Changeset changeset)
      Specified by:
      update in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • insert

      public T insert(T t)
      Specified by:
      insert in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • save

      public T save(T t)
      Specified by:
      save in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • delete

      public void delete(tech.ydb.yoj.repository.db.Entity.Id<T> id)
      Specified by:
      delete in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • migrate

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> void migrate(ID id)
      Migrates the specified entity and its projections, if any. Does nothing if the entity does not exist.
      If the entity has projections, its createProjections() method MUST NOT fail when called on a raw, non-post-loaded entity.
      Type Parameters:
      ID - entity ID type
      Parameters:
      id - entity ID
    • getFirstLevelCache

      public tech.ydb.yoj.repository.db.cache.FirstLevelCache getFirstLevelCache()
      Specified by:
      getFirstLevelCache in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • postLoad

      @NonNull public T postLoad(T e)
      Specified by:
      postLoad in interface tech.ydb.yoj.repository.db.Table<T extends tech.ydb.yoj.repository.db.Entity<T>>
    • updateIn

      public <ID extends tech.ydb.yoj.repository.db.Entity.Id<T>> void updateIn(Collection<ID> ids, tech.ydb.yoj.repository.db.statement.Changeset changeset)