MCPcopy Create free account
hub / github.com/openclaw/gogcli / BuildDeleteRequests

Function BuildDeleteRequests

internal/sheetsconditional/conditional.go:140–160  ·  view source on GitHub ↗
(sheetID int64, count int, indexRaw string, all bool)

Source from the content-addressed store, hash-verified

138}
139
140func BuildDeleteRequests(sheetID int64, count int, indexRaw string, all bool) ([]*sheets.Request, error) {
141 if all {
142 requests := make([]*sheets.Request, 0, count)
143 for index := count - 1; index >= 0; index-- {
144 requests = append(requests, deleteRequest(sheetID, int64(index)))
145 }
146
147 return requests, nil
148 }
149
150 index, err := strconv.Atoi(indexRaw)
151 if err != nil || index < 0 {
152 return nil, invalidf("invalid --index")
153 }
154
155 if index >= count {
156 return nil, invalidf("--index %d out of range; sheet has %d rules", index, count)
157 }
158
159 return []*sheets.Request{deleteRequest(sheetID, int64(index))}, nil
160}
161
162func ValidateClearIndex(indexRaw string) error {
163 indexRaw = strings.TrimSpace(indexRaw)

Callers 2

RunMethod · 0.92
TestDeletePlanningFunction · 0.85

Calls 2

deleteRequestFunction · 0.85
invalidfFunction · 0.70

Tested by 1

TestDeletePlanningFunction · 0.68