support function trigger view

This commit is contained in:
jipengfei-jpf
2023-07-16 20:48:10 +08:00
parent d9d78af61a
commit 288b8cc711
18 changed files with 637 additions and 2 deletions

View File

@ -0,0 +1,22 @@
package ai.chat2db.server.domain.api.service;
import ai.chat2db.server.tools.base.wrapper.result.ListResult;
import ai.chat2db.spi.model.Function;
import jakarta.validation.constraints.NotEmpty;
/**
* author jipengfei
* date 2021/9/23 15:22
*/
public interface FunctionService {
/**
* Querying all functions under a schema.
*
* @param databaseName
* @return
*/
ListResult<Function> functions(@NotEmpty String databaseName, String schemaName);
}

View File

@ -0,0 +1,16 @@
package ai.chat2db.server.domain.api.service;
import ai.chat2db.server.tools.base.wrapper.result.ListResult;
import ai.chat2db.spi.model.Procedure;
import jakarta.validation.constraints.NotEmpty;
public interface ProcedureService {
/**
* Querying all procedures under a schema.
*
* @param databaseName
* @return
*/
ListResult<Procedure> procedures(@NotEmpty String databaseName, String schemaName);
}

View File

@ -0,0 +1,17 @@
package ai.chat2db.server.domain.api.service;
import ai.chat2db.server.tools.base.wrapper.result.ListResult;
import ai.chat2db.spi.model.Trigger;
import jakarta.validation.constraints.NotEmpty;
public interface TriggerService {
/**
* Querying all triggers under a schema.
*
* @param databaseName
* @return
*/
ListResult<Trigger> triggers(@NotEmpty String databaseName, String schemaName);
}

View File

@ -0,0 +1,22 @@
package ai.chat2db.server.domain.api.service;
import ai.chat2db.server.tools.base.wrapper.result.ListResult;
import ai.chat2db.spi.model.Table;
import jakarta.validation.constraints.NotEmpty;
/**
* author jipengfei
* date 2021/9/23 15:22
*/
public interface ViewService {
/**
* Querying all views under a schema.
*
* @param databaseName
* @return
*/
ListResult<Table> views(@NotEmpty String databaseName, String schemaName);
}

View File

@ -0,0 +1,15 @@
package ai.chat2db.server.domain.core.impl;
import ai.chat2db.server.domain.api.service.FunctionService;
import ai.chat2db.server.tools.base.wrapper.result.ListResult;
import ai.chat2db.spi.model.Function;
import ai.chat2db.spi.sql.Chat2DBContext;
import org.springframework.stereotype.Service;
@Service
public class FunctionServiceImpl implements FunctionService {
@Override
public ListResult<Function> functions(String databaseName, String schemaName) {
return ListResult.of(Chat2DBContext.getMetaData().functions(databaseName, schemaName));
}
}

View File

@ -0,0 +1,16 @@
package ai.chat2db.server.domain.core.impl;
import ai.chat2db.server.domain.api.service.ProcedureService;
import ai.chat2db.server.tools.base.wrapper.result.ListResult;
import ai.chat2db.spi.model.Procedure;
import ai.chat2db.spi.sql.Chat2DBContext;
import org.springframework.stereotype.Service;
@Service
public class ProcedureServiceImpl implements ProcedureService {
@Override
public ListResult<Procedure> procedures(String databaseName, String schemaName) {
return ListResult.of(Chat2DBContext.getMetaData().procedures(databaseName, schemaName));
}
}

View File

@ -0,0 +1,15 @@
package ai.chat2db.server.domain.core.impl;
import ai.chat2db.server.domain.api.service.TriggerService;
import ai.chat2db.server.tools.base.wrapper.result.ListResult;
import ai.chat2db.spi.model.Trigger;
import ai.chat2db.spi.sql.Chat2DBContext;
import org.springframework.stereotype.Service;
@Service
public class TriggerServiceImpl implements TriggerService {
@Override
public ListResult<Trigger> triggers(String databaseName, String schemaName) {
return ListResult.of(Chat2DBContext.getMetaData().triggers(databaseName, schemaName));
}
}

View File

@ -0,0 +1,16 @@
package ai.chat2db.server.domain.core.impl;
import ai.chat2db.server.domain.api.service.ViewService;
import ai.chat2db.server.tools.base.wrapper.result.ListResult;
import ai.chat2db.spi.model.Table;
import ai.chat2db.spi.sql.Chat2DBContext;
import org.springframework.stereotype.Service;
@Service
public class ViewServiceImpl implements ViewService {
@Override
public ListResult<Table> views(String databaseName, String schemaName) {
return ListResult.of(Chat2DBContext.getMetaData().views(databaseName, schemaName));
}
}