MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / increaseTokenQuota

Function increaseTokenQuota

model/token.go:308–317  ·  view source on GitHub ↗
(id int, quota int)

Source from the content-addressed store, hash-verified

306}
307
308func increaseTokenQuota(id int, quota int) (err error) {
309 err = DB.Model(&Token{}).Where("id = ?", id).Updates(
310 map[string]interface{}{
311 "remain_quota": gorm.Expr("remain_quota + ?", quota),
312 "used_quota": gorm.Expr("used_quota - ?", quota),
313 "accessed_time": common.GetTimestamp(),
314 },
315 ).Error
316 return err
317}
318
319func DecreaseTokenQuota(id int, key string, quota int) (err error) {
320 if quota < 0 {

Callers 2

batchUpdateFunction · 0.85
IncreaseTokenQuotaFunction · 0.85

Calls 1

GetTimestampFunction · 0.92

Tested by

no test coverage detected