当前位置:网站首页>Storage engine written by golang, based on b+ tree, mmap
Storage engine written by golang, based on b+ tree, mmap
2022-08-03 22:28:00 【InfoQ】
mydb
package main
import (
"fmt"
"github.com/alberliu/mydb"
"strconv"
)
func toBytes(i int) []byte {
return []byte(strconv.Itoa(i))
}
func main() {
db, err := mydb.Open("data")
if err != nil {
panic(err)
}
fmt.Println("init: ", db.Range(mydb.Infinity, mydb.Infinity))
for i := 1; i <= 5; i++ {
db.Add(toBytes(i), toBytes(i))
}
fmt.Println("add: ", db.Range(mydb.Infinity, mydb.Infinity))
db.Update(toBytes(1), toBytes(4))
fmt.Println("update", db.Range(mydb.Infinity, mydb.Infinity))
db.Delete(toBytes(1))
fmt.Println("delete", db.Range(mydb.Infinity, mydb.Infinity))
fmt.Println("range", db.Range(toBytes(3), toBytes(4)))
}
边栏推荐
- Golang第一章:入门
- Golang Chapter 2: Program Structure
- Bytebase database schema change management tool
- 全球观之地理部分
- 2022-08-02 mysql/stonedb慢SQL-Q18-内存使用暴涨分析
- 老板:公司系统太多,能不能实现账号互通?
- Cisco ike2 IPSec配置
- Conditional Statements for Shell Programming
- First domestic open source framework 】 【 general cloud computing framework, any program can be made into cloud computing.
- 静态文件快速建站
猜你喜欢
关于IDO预售系统开发技术讲解丨浅谈IDO预售合约系统开发原理分析
LabVIEW code generation error 61056
for loop exercises
七夕快乐!
嵌入式系统:概述
Teach a Man How to Fish - How to Query the Properties of Any SAP UI5 Control by Yourself Documentation and Technical Implementation Details Demo
113. 授人以渔 - 如何自行查询任意 SAP UI5 控件属性的文档和技术实现细节
直播预告 | 构建业务智联,快速拥抱财务数字化转型
[MySQL Advanced] Creation and Management of Databases and Tables
Go开发工具GoLand V2022.2 来了——Go 工作区重大升级
随机推荐
Lift, Splat, Shoot: Encoding Images from Arbitrary Camera Rigs by Implicitly Unprojecting to 3D 论文笔记
RPA power business automation super order!
物联网新零售模式,引领购物新潮流
win10系统下yolov5-V6.1版本的tensorrt部署细节教程及bug修改
七夕快乐!
First domestic open source framework 】 【 general cloud computing framework, any program can be made into cloud computing.
RPA助力商超订单自动化!
"Digital Economy Panorama White Paper" Financial Digital User Chapter released!
嵌入式开发:嵌入式基础——代码和数据空间揭秘
工作小计 QT打包
Flutter 桌面探索 | 自定义可拖拽导航栏
CAS:153162-70-0_N-BOC-6-Biotinamidohexylamine
Kubernetes入门到精通-Operator 模式
Conditional Statements for Shell Programming
488. Zuma Game
Recognized by International Authorities | Yunzhuang Technology was selected in "RPA Global Market Pattern Report, Q3 2022"
Basic Concepts of Graphs
utils 定时器
老板:公司系统太多,能不能实现账号互通?
PowerMockup 4.3.4::::Crack