MCPcopy Create free account
hub / github.com/astercloud/aster / Exists

Method Exists

pkg/store/mysql.go:404–410  ·  view source on GitHub ↗

Exists 检查资源是否存在

(ctx context.Context, collection, key string)

Source from the content-addressed store, hash-verified

402
403// Exists 检查资源是否存在
404func (s *MySQLStore) Exists(ctx context.Context, collection, key string) (bool, error) {
405 var count int64
406 if err := s.db.WithContext(ctx).Model(&CollectionItem{}).Where("collection = ? AND `key` = ?", collection, key).Count(&count).Error; err != nil {
407 return false, err
408 }
409 return count > 0, nil
410}
411
412// Close 关闭数据库连接
413func (s *MySQLStore) Close() error {

Callers

nothing calls this directly

Calls 1

CountMethod · 0.65

Tested by

no test coverage detected