auxten/go-sqldb
소개
순수 Go로 구현된 데이터베이스 이론 연구용 SQL 데이터베이스입니다.
데이터 및 분석What you can do
- Pure Golang implementation, does not rely on any third-party packages. Goconvey was only introduced in unit tests
- Unit test coverage ≈ 73.5%
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- -1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalGo SQL DB
"Go SQL DB" is a relational database that supports SQL queries for research purposes. The main goal is to show the basic principles and key design of a relational database to database enthusiasts. Therefore, to easily understand, a lot of tricks but not very rigorous design was adopted, and the amount of code was controlled at about 2000 lines (including 400 lines of unit tests).
Features
- Pure Golang implementation, does not rely on any third-party packages. Goconvey was only introduced in unit tests
- Unit test coverage ≈ 73.5%
Storage Engine
- Special Thanks to Let's Build a Simple Database
- Data retrieval structure based on B+Tree
- Disk persistence engine based on 4KB paging
- Close to POD (Plain Old Data) speed serialization & deserialization
SQL Parser
- Tokenizer is implemented based on text/scanner
- Support simple SELECT, INSERT syntax
- SELECT supports WHERE of numeric type
- Support LIMIT, but not support ORDER BY temporarily
- If you want to know how the SQL Parser that can be used in the production environment is implemented, please refer to the SQL Parser that I stripped from CockroachDB and supports the SQL-2011 standard
Execution Planner
- Select Implementation based on Volcano Model
- HTTP-based query and insert interface
Known Issues
- No DDL is implemented for the time being, only a fixed Schema
struct Row { Id uint32 Sex byte Age uint8 Username [32]byte Email [128]byte Phone [64]byte } - For limited support for SQL syntax, see Test Cases
- Tokenizer is based on a clever implementation of the Golang language itself, there will be problems with the support of special characters in some strings, which can be solved by quoting strings with
"
How to run
Run
go run . test.dbINSERT
Execute
INSERT INTO table (id, username, email) VALUES (10, auxten, "auxtenwpc_gmailcom")SELECT
Query
SELECT * FROM table WHERE id > 3 LIMIT 10BY accessing: http://localhost:8080/query?q=SELECT%20*%20FROM%20table%20WHERE%20id%20%3E%203%20LIMIT%2010
Thanks
관련 프로젝트 살펴보기
불러오는 중…