MCPcopy Create free account
hub / github.com/compozy/agh / parsePositiveIntQuery

Function parsePositiveIntQuery

internal/api/core/agent_channels.go:889–906  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

887}
888
889func parsePositiveIntQuery(c *gin.Context) (int, error) {
890 const key = "limit"
891 if c == nil {
892 return 0, nil
893 }
894 raw := strings.TrimSpace(c.Query(key))
895 if raw == "" {
896 return 0, nil
897 }
898 parsed, err := strconv.Atoi(raw)
899 if err != nil {
900 return 0, fmt.Errorf("query parameter %q must be a positive integer: %w", key, err)
901 }
902 if parsed <= 0 {
903 return 0, fmt.Errorf("query parameter %q must be a positive integer: %d", key, parsed)
904 }
905 return parsed, nil
906}
907
908func (h *BaseHandlers) nowUTC() time.Time {
909 if h == nil || h.Now == nil {

Callers 7

AgentChannelRecvMethod · 0.85
NetworkSubscriptionsMethod · 0.85
parseNetworkThreadQueryFunction · 0.85
ListAgentSoulHistoryMethod · 0.85

Calls 1

QueryMethod · 0.65

Tested by

no test coverage detected