TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Writing a SQL database from scratch in Go

430 点作者 v3gas大约 5 年前

7 条评论

eatonphil大约 5 年前
Unexpected, but welcome, to see the first part in the series on here right now. I just published the second part [0] today, featuring binary expressions and WHERE filtering. It also updates the REPL to use a prettier table-printing library and a readline implementation.<p>The repo [1] has some additional bare notes on architecture and links to similar, more mature projects (primarily go-mysql-server and ramsql).<p>[0] <a href="https:&#x2F;&#x2F;notes.eatonphil.com&#x2F;database-basics-expressions-and-where.html" rel="nofollow">https:&#x2F;&#x2F;notes.eatonphil.com&#x2F;database-basics-expressions-and-...</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;eatonphil&#x2F;gosql" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;eatonphil&#x2F;gosql</a>
评论 #22853256 未加载
评论 #22854266 未加载
cube2222大约 5 年前
Great blog post!<p>I&#x27;d just like to add for the curious, that usually you&#x27;d use goyacc for parsing SQL.<p>And most serious SQL projects in Go have started with the SQL parser from vitess and adapted it to their use case (which is just funny trivia, but for anything big, I recommend it, did the same for OctoSQL [0]).<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;cube2222&#x2F;octosql" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cube2222&#x2F;octosql</a>
评论 #22853859 未加载
评论 #22855669 未加载
评论 #22855384 未加载
zoom6628大约 5 年前
Probably the first article Ive ever read about lexical parsing with code that i have actually understood - and I dont even program in golang. Great job.
评论 #22852575 未加载
评论 #22852439 未加载
userbinator大约 5 年前
<i>selectKeyword keyword = &quot;select&quot;</i><p>I don&#x27;t work with Go, so this may be a requirement of the language that I don&#x27;t know, but whenever I see lines like this, it automatically brings up the question <i>why?</i> --- do you really expect to need to rename the SELECT keyword? Especially when it&#x27;s named &quot;selectKeyword&quot;. Why not just use the string constant? Ditto for the others like &quot;leftparenSymbol&quot; --- I see there&#x27;s explicit character constants in some of the other code too... it reminds me of the classic anti-pattern like &quot;int five = 5;&quot;.<p>Also, you may find the full SQL grammars interesting to look through --- they are quite a bit more complex than the subset presented in the article: <a href="https:&#x2F;&#x2F;ronsavage.github.io&#x2F;SQL&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ronsavage.github.io&#x2F;SQL&#x2F;</a>
评论 #22853939 未加载
评论 #22852945 未加载
评论 #22852661 未加载
评论 #22852578 未加载
评论 #22859499 未加载
alperakgun大约 5 年前
Curious - would Rust be more appropriate than Go for such a task?
评论 #22853916 未加载
评论 #22853899 未加载
rochak大约 5 年前
Do you know about a tutorial or a book that helps write Database from scratch either in Java or C?
评论 #22863800 未加载
alexanderhorl大约 5 年前
Are you going to add persistence in an upcoming part?
评论 #22855703 未加载