Cell operations
Cells
Cell operations: PutCell, GetCell, DeleteCell, and secondary indexes
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Cell operations: PutCell, GetCell, DeleteCell, and secondary indexes
coord := hexxladb.Coord{Q: 3, R: 1}
pk, _ := lattice.Pack(coord)
err := tx.PutCell(ctx, record.CellRecord{
Key: pk,
RawContent: "Use testcontainers-go for integration tests.",
Tags: []string{"fact", "testing", "database"},
Provenance: record.ProvenanceWire{
SourceID: "session-2",
Confidence: 0.95,
},
Validity: record.ValidityWire{
ValidFrom: &startTime,
},
})
cell, ok, err := tx.GetCell(ctx, pk)
if err != nil {
return err
}
if !ok {
return errors.New("cell not found")
}
fmt.Println(cell.RawContent)
err := tx.DeleteCell(ctx, pk)
err := tx.AscendCellsBySource(ctx, "session-2", func(cell record.CellRecord) bool {
fmt.Printf("Cell: %s\n", cell.RawContent)
return true // continue iteration
})
bucket := timeBucketFromTime(t) // Your function to compute bucket
err := tx.AscendCellsInTimeBucket(ctx, bucket, func(cell record.CellRecord) bool {
fmt.Printf("Cell: %s\n", cell.RawContent)
return true
})
err := tx.AscendCellsByTag(ctx, "testing", func(cell record.CellRecord) bool {
fmt.Printf("Cell: %s\n", cell.RawContent)
return true
})
err := tx.AscendDistinctTags(ctx, func(tag string) bool {
fmt.Println(tag)
return true
})
tags, err := tx.ListExistingTopics(ctx)
result, err := db.BatchPutCells(ctx, cells, hexxladb.BatchPutCellOptions{
BatchSize: 1000,
OnProgress: func(written, total int) {
fmt.Printf("Progress: %d/%d\n", written, total)
},
ContinueOnError: true,
})
// User message
cell := hexxladb.NewUserMessageCell(coord, content, sourceID, confidence)
// Assistant response
cell := hexxladb.NewAssistantResponseCell(coord, content, sourceID, confidence)
// System prompt
cell := hexxladb.NewSystemPromptCell(coord, content)
// Extracted fact
cell := hexxladb.NewFactCell(coord, content, category)