repository

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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

AutoMigrate creates the database table if it doesn't exist

func (*PostgresOrganizationConfigRepository) Count

Count returns the total number of organization configs

func (*PostgresOrganizationConfigRepository) CountByTemplateType

CountByTemplateType returns the count of configs by template type

func (*PostgresOrganizationConfigRepository) Create

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

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

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

List returns a paginated list of organization configs

func (*PostgresOrganizationConfigRepository) Update

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

Jump to

Keyboard shortcuts

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