Documentation
¶
Index ¶
- type DB
- func (db *DB) Close() error
- func (db *DB) CreateEvent(ctx context.Context, event *models.Event) error
- func (db *DB) CreateLog(ctx context.Context, log *models.Log) error
- func (db *DB) CreateMetric(ctx context.Context, metric *models.Metric) error
- func (db *DB) CreateService(ctx context.Context, service *models.Service) error
- func (db *DB) CreateTrace(ctx context.Context, trace *models.Trace) error
- func (db *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (db *DB) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (db *DB) GetServiceByName(ctx context.Context, name string) (*models.Service, error)
- func (db *DB) GetServiceByNameAndEnvironment(ctx context.Context, name, environment string) (*models.Service, error)
- func (db *DB) HealthCheck(ctx context.Context) error
- func (db *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (db *DB) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (db *DB) WithTransaction(ctx context.Context, fn func(*sqlx.Tx) error) error
- type MetricRepository
- type ServiceRepository
- func (r *ServiceRepository) Create(ctx context.Context, name, environment string) (*models.Service, error)
- func (r *ServiceRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *ServiceRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Service, error)
- func (r *ServiceRepository) GetByNameAndEnvironment(ctx context.Context, name, environment string) (*models.Service, error)
- func (r *ServiceRepository) GetOrCreate(ctx context.Context, name, environment string) (*models.Service, error)
- func (r *ServiceRepository) List(ctx context.Context, environment string, limit, offset int) ([]*models.Service, int64, error)
- func (r *ServiceRepository) Update(ctx context.Context, service *models.Service) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
DB wraps sqlx.DB and provides additional functionality
func (*DB) CreateEvent ¶
CreateEvent creates a new event
func (*DB) CreateMetric ¶
CreateMetric creates a new metric
func (*DB) CreateService ¶
CreateService creates a new service
func (*DB) CreateTrace ¶
CreateTrace creates a new trace
func (*DB) ExecContext ¶
func (db *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
ExecContext executes a query without returning any rows with context
func (*DB) GetContext ¶
func (db *DB) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
GetContext executes a query and binds the result to dest with context
func (*DB) GetServiceByName ¶
GetServiceByName gets a service by name using the default environment
func (*DB) GetServiceByNameAndEnvironment ¶
func (db *DB) GetServiceByNameAndEnvironment(ctx context.Context, name, environment string) (*models.Service, error)
GetServiceByNameAndEnvironment gets a service by name and environment
func (*DB) HealthCheck ¶
HealthCheck performs a health check on the database
func (*DB) QueryRowContext ¶
QueryRowContext executes a query that returns a single row with context
type MetricRepository ¶
type MetricRepository struct {
// contains filtered or unexported fields
}
MetricRepository handles database operations for metrics
func NewMetricRepository ¶
func NewMetricRepository(db *DB) *MetricRepository
NewMetricRepository creates a new metric repository
func (*MetricRepository) CreateBatch ¶
CreateBatch creates multiple metrics in a single transaction
type ServiceRepository ¶
type ServiceRepository struct {
// contains filtered or unexported fields
}
ServiceRepository handles database operations for services
func NewServiceRepository ¶
func NewServiceRepository(db *DB) *ServiceRepository
NewServiceRepository creates a new service repository
func (*ServiceRepository) Create ¶
func (r *ServiceRepository) Create(ctx context.Context, name, environment string) (*models.Service, error)
Create creates a new service or returns existing one
func (*ServiceRepository) GetByNameAndEnvironment ¶
func (r *ServiceRepository) GetByNameAndEnvironment(ctx context.Context, name, environment string) (*models.Service, error)
GetByNameAndEnvironment retrieves a service by name and environment
func (*ServiceRepository) GetOrCreate ¶
func (r *ServiceRepository) GetOrCreate(ctx context.Context, name, environment string) (*models.Service, error)
GetOrCreate gets an existing service or creates a new one