Giter Site home page Giter Site logo

multipleds's Introduction

MultipleDS

multiple data source manager and Execute SQL ,手动管理多个数据源 并且能在多种数据源上执行sql

需求来源

最近想做一个可视化展示需求,用户配置数据源,并且查询sql,将查询sql 的结果作为可视化渲染源数据

功能

  • 管理多种数据源(mysql,pgsql 等常见的数据源)
  • 提供访问入口

开发

实现某种数据源 要经历三个步骤

  1. 继承连接参数BaseConnectParam 实现自己的连接参数
  2. 继承 BaseDSProcessor 实现改种数据源的处理,用于SPI 处理
  3. 实现DSClient
  4. 实现DsChannel 用于创建数据源
  5. 实现 DSChannelFactory 用于SPI 服务的发现

使用

  • 使用DSUtils
  • DSClientProvider
  • 参考example
        PgsqlConnectParam connectionParam =new PgsqlConnectParam();
        connectionParam.setAddress("123.249.117.198");
        connectionParam.setPort(5432);
        connectionParam.setDatabase("things_link");
        connectionParam.setUsername("xxx");
        connectionParam.setPassword("xxx@1xxx23!");
        connectionParam.setDriverClassName("org.postgresql.Driver");
        Connection connection =
                DSUtils.getConnection(DbType.POSTGRESQL, connectionParam);
        // connect 可以做任何事情
        // 或者扩展下 交给jdbctemplate 执行
                

有缓存的使用(Map)
DSClientProvider.getInstance().getConnection(DbType.POSTGRESQL, connectionParam)

multipleds's People

Contributors

wxiao1002 avatar

Stargazers

wangxiao@jlc avatar  avatar

Watchers

 avatar

Forkers

jlcwx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.