Instead of specifying the filename of the generated mock such as --filename=api_service.go, we can specify the case: snake, camel, or underscore. In the example below, it generated a api_service.go file.
//go:generate mockery --name=Service --dir=. --output=../../mocks/services --outpkg=servicemock --case=snake
type ApiService interface {
GetRows(ctx context.Context) ([]any, error)
}