Uniformize enum style

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-05-20 09:41:22 -07:00
parent bc6d028ef3
commit 30db98455d
191 changed files with 7946 additions and 5129 deletions

View File

@@ -16,6 +16,7 @@ package coredata
import (
"context"
"encoding"
"encoding/json"
"errors"
"fmt"
@@ -60,6 +61,57 @@ const (
AgentRunStatusFailed AgentRunStatus = "FAILED"
)
var (
_ fmt.Stringer = AgentRunStatus("")
_ encoding.TextMarshaler = AgentRunStatus("")
_ encoding.TextUnmarshaler = (*AgentRunStatus)(nil)
)
func AgentRunStatuses() []AgentRunStatus {
return []AgentRunStatus{
AgentRunStatusPending,
AgentRunStatusRunning,
AgentRunStatusSuspended,
AgentRunStatusAwaitingApproval,
AgentRunStatusCompleted,
AgentRunStatusFailed,
}
}
func (v AgentRunStatus) IsValid() bool {
switch v {
case
AgentRunStatusPending,
AgentRunStatusRunning,
AgentRunStatusSuspended,
AgentRunStatusAwaitingApproval,
AgentRunStatusCompleted,
AgentRunStatusFailed:
return true
}
return false
}
func (v AgentRunStatus) String() string {
return string(v)
}
func (v AgentRunStatus) MarshalText() ([]byte, error) {
return []byte(v.String()), nil
}
func (v *AgentRunStatus) UnmarshalText(text []byte) error {
val := AgentRunStatus(text)
if !val.IsValid() {
return fmt.Errorf("invalid AgentRunStatus value: %q", string(text))
}
*v = val
return nil
}
func (e AgentRun) CursorKey(orderBy AgentRunOrderField) page.CursorKey {
switch orderBy {
case AgentRunOrderFieldCreatedAt: