Documentation
¶
Index ¶
- func NewPostgresOrganizationConfigRepository(db *gorm.DB, logger *logrus.Logger) service.OrganizationConfigRepository
- type OrganizationConfigWithUsage
- type PostgresOrganizationConfigRepository
- func (r *PostgresOrganizationConfigRepository) AutoMigrate() error
- func (r *PostgresOrganizationConfigRepository) Count(ctx context.Context) (int64, error)
- func (r *PostgresOrganizationConfigRepository) CountByTemplateType(ctx context.Context) (map[entity.TemplateType]int64, error)
- func (r *PostgresOrganizationConfigRepository) Create(ctx context.Context, config *entity.OrganizationConfig) error
- func (r *PostgresOrganizationConfigRepository) Delete(ctx context.Context, organizationID string) error
- func (r *PostgresOrganizationConfigRepository) GetActiveConfigs(ctx context.Context) ([]*entity.OrganizationConfig, error)
- func (r *PostgresOrganizationConfigRepository) GetByOrganizationID(ctx context.Context, organizationID string) (*entity.OrganizationConfig, error)
- func (r *PostgresOrganizationConfigRepository) GetByTemplateType(ctx context.Context, templateType entity.TemplateType) ([]*entity.OrganizationConfig, error)
- func (r *PostgresOrganizationConfigRepository) GetConfigWithServiceUsage(ctx context.Context, organizationID string) (*OrganizationConfigWithUsage, error)
- func (r *PostgresOrganizationConfigRepository) List(ctx context.Context, limit, offset int) ([]*entity.OrganizationConfig, error)
- func (r *PostgresOrganizationConfigRepository) Update(ctx context.Context, config *entity.OrganizationConfig) error
- type ServiceUsageStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPostgresOrganizationConfigRepository ¶
func NewPostgresOrganizationConfigRepository(db *gorm.DB, logger *logrus.Logger) service.OrganizationConfigRepository
NewPostgresOrganizationConfigRepository creates a new PostgreSQL repository
Types ¶
type OrganizationConfigWithUsage ¶
type OrganizationConfigWithUsage struct { entity.OrganizationConfig ServiceUsage map[string]ServiceUsageStats `json:"service_usage"` }
OrganizationConfigWithUsage extends OrganizationConfig with usage statistics
type PostgresOrganizationConfigRepository ¶
type PostgresOrganizationConfigRepository struct {
// contains filtered or unexported fields
}
PostgresOrganizationConfigRepository implements OrganizationConfigRepository using PostgreSQL
func (*PostgresOrganizationConfigRepository) AutoMigrate ¶
func (r *PostgresOrganizationConfigRepository) AutoMigrate() error
AutoMigrate creates the database table if it doesn't exist
func (*PostgresOrganizationConfigRepository) Count ¶
func (r *PostgresOrganizationConfigRepository) Count(ctx context.Context) (int64, error)
Count returns the total number of organization configs
func (*PostgresOrganizationConfigRepository) CountByTemplateType ¶
func (r *PostgresOrganizationConfigRepository) CountByTemplateType(ctx context.Context) (map[entity.TemplateType]int64, error)
CountByTemplateType returns the count of configs by template type
func (*PostgresOrganizationConfigRepository) Create ¶
func (r *PostgresOrganizationConfigRepository) Create(ctx context.Context, config *entity.OrganizationConfig) error
Create creates a new organization config
func (*PostgresOrganizationConfigRepository) Delete ¶
func (r *PostgresOrganizationConfigRepository) Delete(ctx context.Context, organizationID string) error
Delete deletes an organization config
func (*PostgresOrganizationConfigRepository) GetActiveConfigs ¶
func (r *PostgresOrganizationConfigRepository) GetActiveConfigs(ctx context.Context) ([]*entity.OrganizationConfig, error)
GetActiveConfigs returns all active organization configs
func (*PostgresOrganizationConfigRepository) GetByOrganizationID ¶
func (r *PostgresOrganizationConfigRepository) GetByOrganizationID(ctx context.Context, organizationID string) (*entity.OrganizationConfig, error)
GetByOrganizationID retrieves an organization config by organization ID
func (*PostgresOrganizationConfigRepository) GetByTemplateType ¶
func (r *PostgresOrganizationConfigRepository) GetByTemplateType(ctx context.Context, templateType entity.TemplateType) ([]*entity.OrganizationConfig, error)
GetByTemplateType returns all configs with a specific template type
func (*PostgresOrganizationConfigRepository) GetConfigWithServiceUsage ¶
func (r *PostgresOrganizationConfigRepository) GetConfigWithServiceUsage(ctx context.Context, organizationID string) (*OrganizationConfigWithUsage, error)
GetConfigWithServiceUsage returns config with additional service usage statistics
func (*PostgresOrganizationConfigRepository) List ¶
func (r *PostgresOrganizationConfigRepository) List(ctx context.Context, limit, offset int) ([]*entity.OrganizationConfig, error)
List returns a paginated list of organization configs
func (*PostgresOrganizationConfigRepository) Update ¶
func (r *PostgresOrganizationConfigRepository) Update(ctx context.Context, config *entity.OrganizationConfig) error
Update updates an existing organization config
type ServiceUsageStats ¶
type ServiceUsageStats struct { TotalRequests int64 `json:"total_requests"` MonthlyRequests int64 `json:"monthly_requests"` AverageLatency float64 `json:"average_latency"` ErrorRate float64 `json:"error_rate"` LastUsed string `json:"last_used"` }
ServiceUsageStats contains usage statistics for a service