模块 linlang.api

接口 DataService

所有超级接口:
AutoCloseable

public interface DataService extends AutoCloseable
Database service facade used by plugins and higher-level modules.

This API no longer uses ServiceLoader/SPI discovery. Create the concrete implementation directly in your runtime module (e.g. core) and pass it around via dependency injection.

Typical lifecycle:

  1. Construct implementation
  2. init(DbType, DbConfig) to open connections
  3. Obtain repositories via repo(Class)
  4. Optionally migrate() schemas
  5. Call flushAll() on shutdown
  • 嵌套类概要

    嵌套类
    修饰符和类型
    接口
    说明
    static class 
     
    static enum 
     
  • 方法概要

    修饰符和类型
    方法
    说明
    default void
    Close the service.
    void
    Flush all pending changes to the underlying store.
    <T> void
    flushOf(Class<T> entityType)
    Flush the repository of a specific entity type.
    void
    Initialize connection pool / driver by database type and config.
    void
    Perform pending schema migrations if supported by the implementation.
    <T, ID> Repository<T,ID>
    repo(Class<T> entityType)
    Obtain a repository for the annotated entity type.
  • 方法详细资料

    • init

      Initialize connection pool / driver by database type and config.
    • repo

      <T, ID> Repository<T,ID> repo(Class<T> entityType)
      Obtain a repository for the annotated entity type.
      参数:
      entityType - entity class
      返回:
      repository bound to that entity
    • migrate

      void migrate()
      Perform pending schema migrations if supported by the implementation. No-op if unsupported.
    • flushAll

      void flushAll()
      Flush all pending changes to the underlying store.
    • flushOf

      <T> void flushOf(Class<T> entityType)
      Flush the repository of a specific entity type.
    • close

      default void close()
      Close the service. Default behaviour flushes all repositories.
      指定者:
      close 在接口中 AutoCloseable