Skip to content
/ salmon Public

自研可控的分布式数据库框架,简化dao层开发,比mybatis更可控更灵活,支持常规事务、基于二阶段协议提交以及重试机制的跨库事务,支持多种策略分库分表,支持jdbc、oracle等主流数据库,无缝对接spring,欢迎试用。

License

Notifications You must be signed in to change notification settings

data2/salmon

Repository files navigation

Salmon

License Coverage Status

Salmon, an easy framework which support distributed db system.

Self-developed and controllable distributed database framework

  • Simplify dao layer development, more controllable and flexible than mybatis
  • Support regular transactions, cross-database transactions based on two-phase protocol commit and retry mechanism
  • Support multiple strategies for sub-database sub-table
  • Support mainstream databases such as jdbc and oracle
  • Seamless connection with spring

Inquire

@Autowired
@Mapper(file = "mapper1", database = DataBase.JDBC)
public Salmon salmon;

//Inquire
Map map = (Map) salmon.select("query2").execute("101a7cb6-0aff-11ec-b26b-88e9fe840b9a");

//Inquire
Map map = (Map) salmon.select("query").execute(Collections.singletonMap("id", "101a7cb6-0aff-11ec-b26b-88e9fe840b9a"));

Insert

// insert
Map param3 = Maps.newConcurrentMap();
param3.put("id", UUID.randomUUID().toString());
param3.put("namespace", "test");
param3.put("path", "spring.port");
param3.put("value", "9093");
salmon.insert("insert").execute(param);

Affairs

//Open the transaction

salmon.startTrans();
Map param = Maps.newConcurrentMap();
param.put("id", UUID.randomUUID().toString());
param.put("namespace", "test");
param.put("path", "spring.port");
param.put("value", "9091");
salmon.insertTrans("insert").execute(param);

Map param2 = Maps.newConcurrentMap();
param2.put("id", UUID.randomUUID().toString());
param2.put("namespace", "test");
param2.put("path", "spring.port");
param2.put("value", "9092");
salmon.insertTrans("insert").execute(param2);

salmon.commitTrans();

Configuration

    spring:
      salmon:
        scan:package
        database:
          jdbc:
            url: jdbc:mysql://ip:3306/udp
            username: username
            password: pwd
            
     --<test>
        select 1 from dual

About

自研可控的分布式数据库框架,简化dao层开发,比mybatis更可控更灵活,支持常规事务、基于二阶段协议提交以及重试机制的跨库事务,支持多种策略分库分表,支持jdbc、oracle等主流数据库,无缝对接spring,欢迎试用。

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages