db

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package db provides database-related type definitions and interfaces for testing. This package contains types used for database operations and data structures in the test harness.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	Table  string
	OpType string
	Ops    []WriteOp
}

Batch represents a group of write operations

type Node

type Node struct {
	ID                    string    `json:"id" db:"id"`
	ParentID              string    `json:"parent_id" db:"parent_id"`
	Name                  string    `json:"name" db:"name"`
	Path                  string    `json:"path" db:"path"`
	Type                  string    `json:"type" db:"type"` // "file" or "folder"
	Size                  int64     `json:"size" db:"size"`
	Level                 int       `json:"level" db:"level"`
	Checked               bool      `json:"checked" db:"checked"`
	SecondaryExistenceMap string    `json:"secondary_existence_map,omitempty" db:"secondary_existence_map"` // JSON string
	ChildSeed             *int64    `json:"child_seed,omitempty" db:"child_seed"`                           // Optional child generation seed
	CreatedAt             time.Time `json:"created_at" db:"created_at"`
	UpdatedAt             time.Time `json:"updated_at" db:"updated_at"`
}

Node represents a filesystem node (file or folder) as stored in the database

type TableInfo

type TableInfo struct {
	TableID   string `json:"table_id"`
	TableName string `json:"table_name"`
	Type      string `json:"type"` // "primary" or "secondary"
}

TableInfo represents information about a database table

type WriteOp

type WriteOp struct {
	Path   string
	Query  string
	Params []any
	OpType string // "insert", "update", "delete"
}

WriteOp represents a queued SQL operation

type WriteQueueInterface

type WriteQueueInterface interface {
	Add(path string, op WriteOp)
	Flush(force ...bool) []Batch
	IsReadyToWrite() bool
	GetFlushInterval() time.Duration
	SetFlushInterval(interval time.Duration)
}

WriteQueueInterface defines methods for write queue operations

type WriteQueueType

type WriteQueueType int

WriteQueueType determines how the queue handles operations

const (
	NodeWriteQueue WriteQueueType = iota // For node tables with path-based batching
	LogWriteQueue                        // For log tables with simple insert operations
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL