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

Method Update

model/token.go:199–214  ·  view source on GitHub ↗

Update Make sure your token's fields is completed, because this will update non-zero values

()

Source from the content-addressed store, hash-verified

197
198// Update Make sure your token's fields is completed, because this will update non-zero values
199func (token *Token) Update() (err error) {
200 defer func() {
201 if shouldUpdateRedis(true, err) {
202 gopool.Go(func() {
203 err := cacheSetToken(*token)
204 if err != nil {
205 common.SysError("failed to update token cache: " + err.Error())
206 }
207 })
208 }
209 }()
210 err = DB.Model(token).Select("name", "status", "expired_time", "remain_quota", "unlimited_quota",
211 "model_limits_enabled", "model_limits", "allow_ips", "group", "daily_usage_count", "total_usage_count", "last_usage_date",
212 "rate_limit_per_minute", "rate_limit_per_day", "last_rate_limit_reset", "channel_tag", "total_usage_limit").Updates(token).Error
213 return err
214}
215
216func (token *Token) SelectUpdate() (err error) {
217 defer func() {

Callers 1

DisableModelLimitsFunction · 0.45

Calls 4

SysErrorFunction · 0.92
shouldUpdateRedisFunction · 0.85
cacheSetTokenFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected