MCPcopy Create free account
hub / github.com/tbphp/gpt-load / apiKeyToMap

Method apiKeyToMap

internal/keypool/provider.go:632–641  ·  view source on GitHub ↗

apiKeyToMap converts an APIKey model to a map for HSET.

(key *models.APIKey)

Source from the content-addressed store, hash-verified

630
631// apiKeyToMap converts an APIKey model to a map for HSET.
632func (p *KeyProvider) apiKeyToMap(key *models.APIKey) map[string]any {
633 return map[string]any{
634 "id": fmt.Sprint(key.ID),
635 "key_string": key.KeyValue,
636 "status": key.Status,
637 "failure_count": key.FailureCount,
638 "group_id": key.GroupID,
639 "created_at": key.CreatedAt.Unix(),
640 }
641}
642
643// pluckIDs extracts IDs from a slice of APIKey.
644func pluckIDs(keys []models.APIKey) []uint {

Callers 3

LoadKeysFromDBMethod · 0.95
addKeyToStoreMethod · 0.95
addKeysToCacheBatchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected