SawitDB (Go) is the high-performance Golang implementation of SawitDB. It aims to provide near-native speeds while maintaining full compatibility with the .sawit binary format used by the Node.js and PHP versions.
🚨 Emergency: Aceh Flood Relief Please support our brothers and sisters in Aceh.
- Paged Architecture: Data is stored in 4096-byte binary pages.
- Object Caching (New): Implements Page-Level Object Caching for high-speed reads (bypassing JSON parse for hot pages).
- Hash Joins (New): Optimized
JOINoperations (O(M+N)) for massive performance gains on relations. - Persistent Indexes (New): Indexes are now automatically persisted in
_indexessystem table and restored on load. - Query Cache (New): LRU Cache for parsed queries to reduce CPU overhead.
- Concurrency: Goroutine-safe server implementation.
- Network Support: Client-Server architecture using TCP.
go get github.com/WowoEngine/SawitDB-GoBuild the CLI tool:
go build -o sawit-cli.exe ./cmd/cli
./sawit-cliInside the interactive shell:
MASUK WILAYAH my_plantation
LAHAN trees
TANAM KE trees (id, type) BIBIT (1, 'Dura')
PANEN * DARI treesgo run cmd/sawit-server/main.go
# Or build
go build -o sawit-server.exe ./cmd/sawit-server
./sawit-serverThe server will start on 0.0.0.0:7878 by default.
You can use the Engine directly in your Go applications.
package main
import (
"fmt"
"github.com/WowoEngine/SawitDB-Go/internal/engine"
)
func main() {
db, _ := engine.NewSawitDB("./data/plantation.sawit")
defer db.Close()
// AQL
db.Query("LAHAN trees", nil)
db.Query("TANAM KE trees (id, type) BIBIT (1, 'Dura')", nil)
// Fetch
res, _ := db.Query("PANEN * DARI trees DIMANA type='Dura'", nil)
fmt.Println(res)
}- pkg/engine: Core Database Engine logic.
- pkg/storage: Pager and File I/O.
- pkg/parser: Query Parser (AQL/SQL).
- pkg/index: B-Tree Index implementation.
- pkg/server: TCP Server implementation.
MIT License

