database

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*sqlx.DB
}

func Initialize

func Initialize(dbPath string) (*DB, error)

Initialize creates a new database connection and runs migrations

func (*DB) CreateAgent

func (db *DB) CreateAgent(req models.CreateAgentRequest) (*models.Agent, error)

func (*DB) CreateCommand

func (db *DB) CreateCommand(agentID string, req models.CreateCommandRequest) (*models.Command, error)

func (*DB) CreateEvent

func (db *DB) CreateEvent(agentID string, req models.CreateEventRequest) (*models.Event, error)

func (*DB) CreateTask

func (db *DB) CreateTask(req models.CreateTaskRequest) (*models.Task, error)

func (*DB) CreateTodo

func (db *DB) CreateTodo(agentID string, req models.CreateTodoRequest) (*models.TodoItem, error)

func (*DB) DeleteAgent

func (db *DB) DeleteAgent(id string) error

func (*DB) DeleteTask

func (db *DB) DeleteTask(id string) error

func (*DB) DeleteTodo

func (db *DB) DeleteTodo(agentID, todoID string) error

func (*DB) GetAgent

func (db *DB) GetAgent(id string) (*models.Agent, error)

func (*DB) GetCommand

func (db *DB) GetCommand(agentID, commandID string) (*models.Command, error)

func (*DB) GetFleetStatus

func (db *DB) GetFleetStatus() (*models.FleetStatus, error)

func (*DB) GetRecentUpdates

func (db *DB) GetRecentUpdates(limit int, since *time.Time) ([]models.Event, error)

func (*DB) GetTask

func (db *DB) GetTask(id string) (*models.Task, error)

func (*DB) GetTodo

func (db *DB) GetTodo(agentID, todoID string) (*models.TodoItem, error)

func (*DB) ListAgents

func (db *DB) ListAgents(status string, limit, offset int) ([]models.Agent, int, error)

func (*DB) ListCommands

func (db *DB) ListCommands(agentID, status string, limit int) ([]models.Command, error)

func (*DB) ListEvents

func (db *DB) ListEvents(agentID, eventType string, since *time.Time, limit, offset int) ([]models.Event, int, error)

func (*DB) ListTasks

func (db *DB) ListTasks(status, assignedAgentID, priority string, limit, offset int) ([]models.Task, int, error)

func (*DB) ListTodos

func (db *DB) ListTodos(agentID string) ([]models.TodoItem, error)

func (*DB) UpdateAgent

func (db *DB) UpdateAgent(id string, req models.UpdateAgentRequest) (*models.Agent, error)

func (*DB) UpdateCommand

func (db *DB) UpdateCommand(agentID, commandID string, req models.UpdateCommandRequest) (*models.Command, error)

func (*DB) UpdateTask

func (db *DB) UpdateTask(id string, req models.UpdateTaskRequest) (*models.Task, error)

func (*DB) UpdateTodo

func (db *DB) UpdateTodo(agentID, todoID string, req models.UpdateTodoRequest) (*models.TodoItem, error)

Jump to

Keyboard shortcuts

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