dev.soffa.foundation.data.DataStore Maven / Gradle / Ivy
package dev.soffa.foundation.data;
import dev.soffa.foundation.model.TenantId;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.List;
import java.util.Optional;
public interface DataStore {
default Optional findById(Class entityClass, Object value) {
return findById(TenantId.CONTEXT, entityClass, value);
}
boolean ping();
Optional findById(TenantId tenant, Class entityClass, Object value);
default long count(Class entityClass) {
return count(TenantId.CONTEXT, entityClass);
}
long count(TenantId tenant, Class entityClass);
default long count(@NonNull Class entityClass, @NonNull Criteria criteria) {
return count(TenantId.CONTEXT, entityClass, criteria);
}
long count(TenantId tenant, @NonNull Class entityClass, @NonNull Criteria criteria);
default int delete(@NonNull Class entityClass, @NonNull Criteria criteria) {
return delete(TenantId.CONTEXT, entityClass, criteria);
}
int delete(TenantId tenant, @NonNull Class entityClass, @NonNull Criteria criteria);
default E insert(E entity) {
return insert(TenantId.CONTEXT, entity);
}
default int[] batch(List entity) {
return batch(TenantId.CONTEXT, entity);
}
int[] batch(TenantId tenant, List entity);
default int[] batch(String table, List entity) {
return batch(TenantId.CONTEXT, table, entity);
}
int[] batch(TenantId tenantId, String table, List entity);
E insert(TenantId tenant, E entity);
default E update(E entity) {
return update(TenantId.CONTEXT, entity);
}
E update(TenantId tenant, E entity);
default int delete(E entity) {
return delete(TenantId.CONTEXT, entity);
}
int delete(TenantId tenant, E entity);
default List find(Class entityClass, Criteria criteria) {
return find(TenantId.CONTEXT, entityClass, criteria);
}
default int execute(String command) {
return execute(TenantId.CONTEXT, command);
}
int execute(TenantId tenant, String command);
List find(TenantId tenant, Class entityClass, Criteria criteria);
default Optional get(Class entityClass, Criteria criteria) {
return get(TenantId.CONTEXT, entityClass, criteria);
}
Optional get(TenantId tenant, Class entityClass, Criteria criteria);
default List findAll(Class entityClass) {
return findAll(TenantId.CONTEXT, entityClass);
}
List findAll(TenantId tenant, Class entityClass);
List query(String query, Class resultClass);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy