Documentation
¶
Index ¶
- type DB
- func (db *DB) Close()
- func (db *DB) CreateTable(tableName string, schema string) error
- func (db *DB) DropTable(tableName string) error
- func (db *DB) Exec(query string, params ...any) (sql.Result, error)
- func (db *DB) ForceFlushTable(tableName string)
- func (db *DB) GetWriteQueue(table string) typesdb.WriteQueueInterface
- func (db *DB) InitWriteQueue(table string, queueType typesdb.WriteQueueType, batchSize int, ...)
- func (db *DB) Query(table string, query string, params ...any) (*sql.Rows, error)
- func (db *DB) QueryRow(query string, params ...any) *sql.Row
- func (db *DB) QueueWrite(tableName, query string, params ...any)
- func (db *DB) QueueWriteWithPath(tableName, path, query string, params ...any)
- func (db *DB) Write(query string, params ...any) error
- func (db *DB) WriteBatch(tableQueries map[string][]string, tableParams map[string][][]any) error
- type WriteQueue
- func (wq *WriteQueue) Add(path string, op typesdb.WriteOp)
- func (wq *WriteQueue) Flush(force ...bool) []typesdb.Batch
- func (wq *WriteQueue) GetFlushInterval() time.Duration
- func (wq *WriteQueue) IsReadyToWrite() bool
- func (wq *WriteQueue) SetFlushInterval(interval time.Duration)
- func (wq *WriteQueue) ShouldFlush(force ...bool) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) CreateTable ¶
CreateTable creates a table if it doesn't exist.
func (*DB) ForceFlushTable ¶
ForceFlushTable forces a flush of the write queue for a specific table
func (*DB) GetWriteQueue ¶
func (db *DB) GetWriteQueue(table string) typesdb.WriteQueueInterface
GetWriteQueue returns the write queue for a given table.
func (*DB) InitWriteQueue ¶
func (db *DB) InitWriteQueue(table string, queueType typesdb.WriteQueueType, batchSize int, flushInterval time.Duration)
InitWriteQueue initializes a write queue for a specific table.
func (*DB) QueueWrite ¶
QueueWrite always treats ops here as inserts
func (*DB) QueueWriteWithPath ¶
QueueWriteWithPath is for update‐style ops
type WriteQueue ¶
type WriteQueue struct {
// contains filtered or unexported fields
}
WriteQueue manages write operations for a single table
func NewWriteQueue ¶
func NewWriteQueue(tableName string, queueType typesdb.WriteQueueType, batchSize int, flushTimer time.Duration) *WriteQueue
NewWriteQueue creates a new write queue for a specific table
func (*WriteQueue) Add ¶
func (wq *WriteQueue) Add(path string, op typesdb.WriteOp)
Add queues a new operation
func (*WriteQueue) Flush ¶
func (wq *WriteQueue) Flush(force ...bool) []typesdb.Batch
Flush processes all queued operations and returns the batches
func (*WriteQueue) GetFlushInterval ¶
func (wq *WriteQueue) GetFlushInterval() time.Duration
GetFlushInterval returns the current flush interval
func (*WriteQueue) IsReadyToWrite ¶
func (wq *WriteQueue) IsReadyToWrite() bool
IsReadyToWrite returns whether the queue is ready to be flushed
func (*WriteQueue) SetFlushInterval ¶
func (wq *WriteQueue) SetFlushInterval(interval time.Duration)
SetFlushInterval allows changing the flush interval
func (*WriteQueue) ShouldFlush ¶
func (wq *WriteQueue) ShouldFlush(force ...bool) bool
ShouldFlush determines if a flush should occur and sets up the writing state Returns (ShouldFlush bool)