Files
tyapi-server/internal/domains/api/repositories/api_call_repository.go
2025-07-28 01:46:39 +08:00

29 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package repositories
import (
"context"
"tyapi-server/internal/domains/api/entities"
"tyapi-server/internal/shared/interfaces"
)
type ApiCallRepository interface {
Create(ctx context.Context, call *entities.ApiCall) error
Update(ctx context.Context, call *entities.ApiCall) error
FindById(ctx context.Context, id string) (*entities.ApiCall, error)
FindByUserId(ctx context.Context, userId string, limit, offset int) ([]*entities.ApiCall, error)
// 新增分页查询用户API调用记录
ListByUserId(ctx context.Context, userId string, options interfaces.ListOptions) ([]*entities.ApiCall, int64, error)
// 新增根据条件筛选API调用记录
ListByUserIdWithFilters(ctx context.Context, userId string, filters map[string]interface{}, options interfaces.ListOptions) ([]*entities.ApiCall, int64, error)
// 新增根据条件筛选API调用记录包含产品名称
ListByUserIdWithFiltersAndProductName(ctx context.Context, userId string, filters map[string]interface{}, options interfaces.ListOptions) (map[string]string, []*entities.ApiCall, int64, error)
// 新增统计用户API调用次数
CountByUserId(ctx context.Context, userId string) (int64, error)
// 新增根据TransactionID查询
FindByTransactionId(ctx context.Context, transactionId string) (*entities.ApiCall, error)
}