Documentation
¶
Index ¶
- type AuditEntry
- type ConnectionProfile
- type QueryRecord
- type Store
- func (s *Store) Close() error
- func (s *Store) CreateAuditEntry(entry *AuditEntry) error
- func (s *Store) CreateConnectionProfile(profile *ConnectionProfile) error
- func (s *Store) CreateQueryRecord(record *QueryRecord) error
- func (s *Store) DB() *sqlx.DB
- func (s *Store) DeleteConnectionProfile(id string) error
- func (s *Store) DeleteQueryRecord(id string) error
- func (s *Store) GetConnectionProfile(id string) (*ConnectionProfile, error)
- func (s *Store) GetQueryRecord(id string) (*QueryRecord, error)
- func (s *Store) ListAuditEntries(limit, offset int, level string) ([]AuditEntry, error)
- func (s *Store) ListConnectionProfiles() ([]ConnectionProfile, error)
- func (s *Store) ListQueryRecords(limit, offset int) ([]QueryRecord, error)
- func (s *Store) Ping() error
- func (s *Store) Transaction(fn func(*sqlx.Tx) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditEntry ¶
type AuditEntry struct {
ID string `db:"id" json:"id"`
Action string `db:"action" json:"action"` // connection_created, query_executed, etc.
Detail string `db:"detail" json:"detail"`
Level string `db:"level" json:"level"` // info, warning, error
IPAddress string `db:"ip_address" json:"ip_address"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
}
AuditEntry represents an audit log entry
type ConnectionProfile ¶
type ConnectionProfile struct {
ID string `db:"id" json:"id"`
Name string `db:"name" json:"name"`
DBType string `db:"db_type" json:"db_type"` // postgres, mysql
Host string `db:"host" json:"host"`
Port int `db:"port" json:"port"`
Database string `db:"database" json:"database"`
Username string `db:"username" json:"username"`
EncryptedPassword string `db:"encrypted_password" json:"-"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}
ConnectionProfile represents a saved database connection
type QueryRecord ¶
type QueryRecord struct {
ID string `db:"id" json:"id"`
ConnectionID string `db:"connection_id" json:"connection_id"`
Question string `db:"question" json:"question"`
GeneratedSQL string `db:"generated_sql" json:"generated_sql"`
ExecutionTimeMs int64 `db:"execution_time_ms" json:"execution_time_ms"`
RowCount int `db:"row_count" json:"row_count"`
Status string `db:"status" json:"status"` // success, error
Error string `db:"error" json:"error,omitempty"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
}
QueryRecord represents a query execution history entry
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CreateAuditEntry ¶
func (s *Store) CreateAuditEntry(entry *AuditEntry) error
CreateAuditEntry creates a new audit log entry
func (*Store) CreateConnectionProfile ¶
func (s *Store) CreateConnectionProfile(profile *ConnectionProfile) error
CreateConnectionProfile creates a new connection profile
func (*Store) CreateQueryRecord ¶
func (s *Store) CreateQueryRecord(record *QueryRecord) error
CreateQueryRecord creates a new query record
func (*Store) DeleteConnectionProfile ¶
DeleteConnectionProfile deletes a connection profile by ID
func (*Store) DeleteQueryRecord ¶
DeleteQueryRecord deletes a query record by ID
func (*Store) GetConnectionProfile ¶
func (s *Store) GetConnectionProfile(id string) (*ConnectionProfile, error)
GetConnectionProfile retrieves a connection profile by ID
func (*Store) GetQueryRecord ¶
func (s *Store) GetQueryRecord(id string) (*QueryRecord, error)
GetQueryRecord retrieves a query record by ID
func (*Store) ListAuditEntries ¶
func (s *Store) ListAuditEntries(limit, offset int, level string) ([]AuditEntry, error)
ListAuditEntries retrieves audit entries with pagination and optional level filter
func (*Store) ListConnectionProfiles ¶
func (s *Store) ListConnectionProfiles() ([]ConnectionProfile, error)
ListConnectionProfiles retrieves all connection profiles
func (*Store) ListQueryRecords ¶
func (s *Store) ListQueryRecords(limit, offset int) ([]QueryRecord, error)
ListQueryRecords retrieves query records with pagination