Coder Social home page Coder Social logo

tgk-sain / closuretablecateogrystore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kaciras/closuretable

0.0 1.0 0.0 75 KB

基于ClosureTable的数据库无限级分类存储实现。

Home Page: https://blog.kaciras.net/article/36

License: MIT License

Java 100.00%

closuretablecateogrystore's Introduction

ClosureTable

基于ClosureTable的数据库无限级分类存储实现。

ClosureTable示例

ClosureTable以一张表存储节点之间的关系、其中包含了任何两个有关系(祖先与子代)节点的关联信息。其包含3个字段:

  • ancestor 祖先:祖先节点的id
  • descendant 子代:子代节点的id
  • distance 距离:子代到祖先中间隔了几代

ClosureTable能够很好地解决树结构在关系数据库中的查询需求。

运行演示

运行需要设置MySQL或Mariadb数据库连接,需要替换下面第三行的命令中的参数。

mvn package
cd target
java -jar closure-table-1.0.jar jdbc:mariadb://localhost:3306/test root password

更多的用法及测试见 CategoryStoreTest.java

配套文章 https://blog.kaciras.net/article/36/store-tree-in-database

closuretablecateogrystore's People

Contributors

kaciras avatar

Watchers

James Cloos avatar

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.