- Notifications
You must be signed in to change notification settings - Fork0
Structured Tabular Data Management in Go
License
NotificationsYou must be signed in to change notification settings
bearaujus/bdatamatrix
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
BDataMatrix is a lightweight Go library for managing structured tabular data efficiently. It provides functions to add, update, delete, sort, and query data, along with various export options such as CSV, TSV, JSON, and YAML.
To install BDataMatrix, run:
go get github.com/bearaujus/bdatamatrix
import"github.com/bearaujus/bdatamatrix"
- Create structured tabular data with defined headers.
- Add, update, delete, and search rows efficiently.
- Export data to CSV, TSV, JSON, YAML, or custom formats.
- Track header indices for optimized querying.
- Support for case-insensitive searching.
Create a new matrix with headers:
matrix,err:=bdatamatrix.New("ID","Name","Age")iferr!=nil {log.Fatal(err)}
Create a matrix with predefined data:
rows:= [][]string{ {"1","Alice","30"}, {"2","Bob","25"},}matrix,err:=bdatamatrix.NewWithData(rows,"ID","Name","Age")iferr!=nil {log.Fatal(err)}
_=matrix.AddRow("3","Charlie","35")query:= bdatamatrix.FindRowsQuery{Column:"Name",Operator:bdatamatrix.OperatorEquals,CaseInsensitive:true,Values: []string{"Alice"},}result,err:=matrix.FindRows(query)iferr!=nil {log.Fatal(err)}fmt.Println("Matched rows:",result)
Export as CSV:
csvOutput:=matrix.ToCSV(true)_=csvOutput.Write("output.csv",0644)
Export as JSON:
jsonOutput:=matrix.ToJSON(true,false)_=jsonOutput.Write("output.json",0644)
This project is licensed under the MIT License - see theLICENSE file for details.
About
Structured Tabular Data Management in Go
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published