(ctx context.Context, providerId string, start, end int64, offset, limit int, order string, apiIds ...string)
| 160 | } |
| 161 | |
| 162 | func (i *imlAPIUseService) SumByApisPage(ctx context.Context, providerId string, start, end int64, offset, limit int, order string, apiIds ...string) ([]*APIUse, int64, error) { |
| 163 | list, total, err := i.store.SumByGroupPage(ctx, "api", order, offset, limit, "api,sum(input_token) as input_token,sum(output_token) as output_token,sum(total_token) as total_token", "provider = ? and api in (?) and minute >= ? and minute <= ?", providerId, apiIds, start, end) |
| 164 | if err != nil { |
| 165 | return nil, 0, err |
| 166 | } |
| 167 | |
| 168 | result := make([]*APIUse, 0, len(list)) |
| 169 | for _, v := range list { |
| 170 | result = append(result, &APIUse{ |
| 171 | API: v.API, |
| 172 | InputToken: v.InputToken, |
| 173 | OutputToken: v.OutputToken, |
| 174 | TotalToken: v.TotalToken, |
| 175 | }) |
| 176 | } |
| 177 | return result, total, nil |
| 178 | } |
| 179 | |
| 180 | func (i *imlAPIUseService) SumByApis(ctx context.Context, providerId string, start, end int64, apiIds ...string) ([]*APIUse, error) { |
| 181 | //list, err := i.store.SumByGroup(ctx, "api", "api,sum(input_token) as input_token,sum(output_token) as output_token,sum(total_token) as total_token", "provider = ? and api in (?) and minute >= ? and minute <= ?", providerId, apiIds, start, end) |
nothing calls this directly
no outgoing calls
no test coverage detected