Showing preview only (8,073K chars total). Download the full file or copy to clipboard to get everything.
Repository: gofr-dev/gofr
Branch: development
Commit: 9f54f6fd51f3
Files: 858
Total size: 7.6 MB
Directory structure:
gitextract_4eff3cym/
├── .codeclimate.yml
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ ├── feature_request.md
│ │ └── question.md
│ ├── dependabot.yml
│ ├── pull_request_template.md
│ └── workflows/
│ ├── go.yml
│ ├── typos.yml
│ ├── website-prod.yml
│ └── website-stage.yml
├── .gitignore
├── .golangci.yml
├── .ls-lint.yml
├── .qlty/
│ ├── .gitignore
│ ├── configs/
│ │ ├── .hadolint.yaml
│ │ └── .yamllint.yaml
│ └── qlty.toml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── README.md
├── SECURITY.md
├── docs/
│ ├── Dockerfile
│ ├── advanced-guide/
│ │ ├── authentication/
│ │ │ └── page.md
│ │ ├── building-cli-applications/
│ │ │ └── page.md
│ │ ├── circuit-breaker/
│ │ │ └── page.md
│ │ ├── custom-spans-in-tracing/
│ │ │ └── page.md
│ │ ├── dealing-with-sql/
│ │ │ └── page.md
│ │ ├── debugging/
│ │ │ └── page.md
│ │ ├── gofr-errors/
│ │ │ └── page.md
│ │ ├── graphql/
│ │ │ └── page.md
│ │ ├── grpc/
│ │ │ └── page.md
│ │ ├── grpc-streaming/
│ │ │ └── page.md
│ │ ├── handling-data-migrations/
│ │ │ └── page.md
│ │ ├── handling-file/
│ │ │ └── page.md
│ │ ├── http-communication/
│ │ │ └── page.md
│ │ ├── injecting-databases-drivers/
│ │ │ └── page.md
│ │ ├── key-value-store/
│ │ │ └── page.md
│ │ ├── middlewares/
│ │ │ └── page.md
│ │ ├── monitoring-service-health/
│ │ │ └── page.md
│ │ ├── overriding-default/
│ │ │ └── page.md
│ │ ├── publishing-custom-metrics/
│ │ │ └── page.md
│ │ ├── rbac/
│ │ │ └── page.md
│ │ ├── remote-log-level-change/
│ │ │ └── page.md
│ │ ├── serving-static-files/
│ │ │ └── page.md
│ │ ├── setting-custom-response-headers/
│ │ │ └── page.md
│ │ ├── startup-hooks/
│ │ │ └── page.md
│ │ ├── swagger-documentation/
│ │ │ └── page.md
│ │ ├── using-cron/
│ │ │ └── page.md
│ │ ├── using-publisher-subscriber/
│ │ │ └── page.md
│ │ └── websocket/
│ │ └── page.md
│ ├── datasources/
│ │ ├── arangodb/
│ │ │ └── page.md
│ │ ├── cassandra/
│ │ │ └── page.md
│ │ ├── clickhouse/
│ │ │ └── page.md
│ │ ├── cockroachdb/
│ │ │ └── page.md
│ │ ├── couchbase/
│ │ │ └── page.md
│ │ ├── dgraph/
│ │ │ └── page.md
│ │ ├── elasticsearch/
│ │ │ └── page.md
│ │ ├── getting-started/
│ │ │ └── page.md
│ │ ├── influxdb/
│ │ │ └── page.md
│ │ ├── migrations/
│ │ │ └── elasticsearch/
│ │ │ └── page.md
│ │ ├── mongodb/
│ │ │ └── page.md
│ │ ├── opentsdb/
│ │ │ └── page.md
│ │ ├── oracle/
│ │ │ └── page.md
│ │ ├── scylladb/
│ │ │ └── page.md
│ │ ├── solr/
│ │ │ └── page.md
│ │ └── surrealdb/
│ │ └── page.md
│ ├── events.json
│ ├── navigation.js
│ ├── page.md
│ ├── quick-start/
│ │ ├── add-rest-handlers/
│ │ │ └── page.md
│ │ ├── cli/
│ │ │ └── page.md
│ │ ├── configuration/
│ │ │ └── page.md
│ │ ├── connecting-mysql/
│ │ │ └── page.md
│ │ ├── connecting-redis/
│ │ │ └── page.md
│ │ ├── introduction/
│ │ │ └── page.md
│ │ └── observability/
│ │ └── page.md
│ ├── references/
│ │ ├── configs/
│ │ │ └── page.md
│ │ ├── context/
│ │ │ └── page.md
│ │ ├── gofrcli/
│ │ │ └── page.md
│ │ └── testing/
│ │ └── page.md
│ └── testimonials.json
├── examples/
│ ├── grpc/
│ │ ├── grpc-streaming-client/
│ │ │ ├── README.md
│ │ │ ├── client/
│ │ │ │ ├── chat.pb.go
│ │ │ │ ├── chat.proto
│ │ │ │ ├── chat_grpc.pb.go
│ │ │ │ ├── chatservice_client.go
│ │ │ │ └── health_client.go
│ │ │ └── main.go
│ │ ├── grpc-streaming-server/
│ │ │ ├── README.md
│ │ │ ├── main.go
│ │ │ ├── main_test.go
│ │ │ └── server/
│ │ │ ├── chat.pb.go
│ │ │ ├── chat.proto
│ │ │ ├── chat_grpc.pb.go
│ │ │ ├── chatservice_gofr.go
│ │ │ ├── chatservice_server.go
│ │ │ ├── health_gofr.go
│ │ │ └── request_gofr.go
│ │ ├── grpc-unary-client/
│ │ │ ├── README.md
│ │ │ ├── client/
│ │ │ │ ├── health_client.go
│ │ │ │ ├── health_test.go
│ │ │ │ ├── hello.pb.go
│ │ │ │ ├── hello.proto
│ │ │ │ ├── hello_client.go
│ │ │ │ ├── hello_grpc.pb.go
│ │ │ │ └── hello_test.go
│ │ │ ├── main.go
│ │ │ └── main_test.go
│ │ └── grpc-unary-server/
│ │ ├── README.md
│ │ ├── main.go
│ │ ├── main_test.go
│ │ └── server/
│ │ ├── health_gofr.go
│ │ ├── health_test.go
│ │ ├── hello.pb.go
│ │ ├── hello.proto
│ │ ├── hello_gofr.go
│ │ ├── hello_grpc.pb.go
│ │ ├── hello_server.go
│ │ ├── hello_server_test.go
│ │ ├── hello_test.go
│ │ ├── request_gofr.go
│ │ └── request_test.go
│ ├── http-server/
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── docker/
│ │ │ ├── docker-compose.yaml
│ │ │ ├── prometheus/
│ │ │ │ └── prometheus.yml
│ │ │ └── provisioning/
│ │ │ ├── dashboards/
│ │ │ │ ├── dashboards.yaml
│ │ │ │ └── gofr-dashboard/
│ │ │ │ └── dashboards.json
│ │ │ └── datasources/
│ │ │ └── datasource.yaml
│ │ ├── main.go
│ │ ├── main_test.go
│ │ └── static/
│ │ └── openapi.json
│ ├── http-server-using-redis/
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── main.go
│ │ └── main_test.go
│ ├── sample-cmd/
│ │ ├── README.md
│ │ ├── configs/
│ │ │ └── .test.env
│ │ ├── main.go
│ │ └── main_test.go
│ ├── using-add-filestore/
│ │ ├── README.md
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── main.go
│ │ └── main_test.go
│ ├── using-add-rest-handlers/
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── main.go
│ │ ├── main_test.go
│ │ └── migrations/
│ │ ├── 1721816030_create_user_table.go
│ │ ├── 1721816030_create_user_table_test.go
│ │ ├── all.go
│ │ └── all_test.go
│ ├── using-cron-jobs/
│ │ ├── Readme.md
│ │ ├── main.go
│ │ └── main_test.go
│ ├── using-custom-metrics/
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── main.go
│ │ └── main_test.go
│ ├── using-file-bind/
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── main.go
│ │ └── main_test.go
│ ├── using-graphql/
│ │ ├── configs/
│ │ │ └── schema.graphqls
│ │ ├── main.go
│ │ ├── main_test.go
│ │ └── migrations/
│ │ ├── 20240205125300_create_users_table.go
│ │ └── all.go
│ ├── using-html-template/
│ │ ├── README.md
│ │ ├── main.go
│ │ ├── main_test.go
│ │ ├── static/
│ │ │ ├── 404.html
│ │ │ ├── index.html
│ │ │ └── style.css
│ │ └── templates/
│ │ └── todo.html
│ ├── using-http-auth-middleware/
│ │ ├── ReadMe.md
│ │ ├── main.go
│ │ └── main_test.go
│ ├── using-http-service/
│ │ ├── Dockerfile
│ │ ├── main.go
│ │ ├── main_test.go
│ │ └── readme.md
│ ├── using-migrations/
│ │ ├── Dockerfile
│ │ ├── go.sum
│ │ ├── main.go
│ │ ├── main_test.go
│ │ ├── migrations/
│ │ │ ├── 1722507126_create_employee_table.go
│ │ │ ├── 1722507126_create_employee_table_test.go
│ │ │ ├── 1722507180_redis_add_employee_name.go
│ │ │ ├── 1722507180_redis_add_employee_name_test.go
│ │ │ ├── all.go
│ │ │ └── all_test.go
│ │ └── readme.md
│ ├── using-publisher/
│ │ ├── Dockerfile
│ │ ├── main.go
│ │ ├── main_test.go
│ │ ├── migrations/
│ │ │ ├── 1721801313_create_topics.go
│ │ │ ├── 1721801313_create_topics_test.go
│ │ │ ├── all.go
│ │ │ └── all_test.go
│ │ └── readme.md
│ ├── using-subscriber/
│ │ ├── Dockerfile
│ │ ├── main.go
│ │ ├── main_test.go
│ │ ├── migrations/
│ │ │ ├── 1721800255_create_topics.go
│ │ │ ├── 1721800255_create_topics_test.go
│ │ │ ├── all.go
│ │ │ └── all_test.go
│ │ └── readme.md
│ └── using-web-socket/
│ ├── Readme.md
│ ├── main.go
│ └── main_test.go
├── go.mod
├── go.sum
├── go.work
├── go.work.sum
├── pkg/
│ └── gofr/
│ ├── auth.go
│ ├── cmd/
│ │ ├── request.go
│ │ ├── request_test.go
│ │ ├── responder.go
│ │ ├── responder_test.go
│ │ └── terminal/
│ │ ├── colors.go
│ │ ├── output.go
│ │ ├── output_test.go
│ │ ├── printers.go
│ │ ├── printers_test.go
│ │ ├── progress.go
│ │ ├── progress_test.go
│ │ ├── spinner.go
│ │ └── spinner_test.go
│ ├── cmd.go
│ ├── cmd_test.go
│ ├── config/
│ │ ├── config.go
│ │ ├── godotenv.go
│ │ ├── godotenv_test.go
│ │ ├── mock_config.go
│ │ └── mock_config_test.go
│ ├── constants.go
│ ├── container/
│ │ ├── container.go
│ │ ├── container_test.go
│ │ ├── datasources.go
│ │ ├── health.go
│ │ ├── health_test.go
│ │ ├── metrics.go
│ │ ├── mock_container.go
│ │ ├── mock_datasources.go
│ │ ├── mock_logger.go
│ │ ├── mock_metrics.go
│ │ ├── mockcontainer_test.go
│ │ └── sql_mock.go
│ ├── context.go
│ ├── context_test.go
│ ├── cron.go
│ ├── cron_scheduler.go
│ ├── cron_test.go
│ ├── crud_handlers.go
│ ├── crud_handlers_test.go
│ ├── crud_helpers.go
│ ├── datasource/
│ │ ├── README.md
│ │ ├── arangodb/
│ │ │ ├── arango.go
│ │ │ ├── arango_db.go
│ │ │ ├── arango_db_test.go
│ │ │ ├── arango_document.go
│ │ │ ├── arango_document_test.go
│ │ │ ├── arango_graph.go
│ │ │ ├── arango_graph_test.go
│ │ │ ├── arango_helper.go
│ │ │ ├── arango_helper_test.go
│ │ │ ├── arango_test.go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── interface.go
│ │ │ ├── logger.go
│ │ │ ├── logger_test.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_collection.go
│ │ │ ├── mock_database.go
│ │ │ ├── mock_graph.go
│ │ │ ├── mock_interfaces.go
│ │ │ ├── mock_logger.go
│ │ │ ├── mock_metrics.go
│ │ │ └── mock_user.go
│ │ ├── cassandra/
│ │ │ ├── cassandra.go
│ │ │ ├── cassandra_batch.go
│ │ │ ├── cassandra_batch_test.go
│ │ │ ├── cassandra_test.go
│ │ │ ├── errors.go
│ │ │ ├── errors_test.go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── interfaces.go
│ │ │ ├── internal.go
│ │ │ ├── logger.go
│ │ │ ├── logger_test.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_interfaces.go
│ │ │ ├── mock_logger.go
│ │ │ └── mock_metrics.go
│ │ ├── clickhouse/
│ │ │ ├── clickhouse.go
│ │ │ ├── clickhouse_test.go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── interface.go
│ │ │ ├── logger.go
│ │ │ ├── logger_test.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_interface.go
│ │ │ ├── mock_logger.go
│ │ │ └── mock_metrics.go
│ │ ├── couchbase/
│ │ │ ├── couchbase.go
│ │ │ ├── couchbase_test.go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── interfaces.go
│ │ │ ├── logger.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_interfaces.go
│ │ │ ├── mock_logger.go
│ │ │ ├── mock_metrics.go
│ │ │ └── wrappers.go
│ │ ├── datasource.go
│ │ ├── dbresolver/
│ │ │ ├── circuit_breaker.go
│ │ │ ├── factory.go
│ │ │ ├── factory_test.go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── logger.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_db.go
│ │ │ ├── mock_logger.go
│ │ │ ├── mock_metrics.go
│ │ │ ├── mock_strategy.go
│ │ │ ├── options.go
│ │ │ ├── resolver.go
│ │ │ ├── resolver_test.go
│ │ │ ├── strategy.go
│ │ │ └── strategy_test.go
│ │ ├── dgraph/
│ │ │ ├── dgraph.go
│ │ │ ├── dgraph_test.go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── interfaces.go
│ │ │ ├── logger.go
│ │ │ ├── logger_test.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_interfaces.go
│ │ │ ├── mock_logger.go
│ │ │ └── mock_metrics.go
│ │ ├── elasticsearch/
│ │ │ ├── documents.go
│ │ │ ├── elasticsearch.go
│ │ │ ├── elasticsearch_test.go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── logger.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_logger.go
│ │ │ └── mock_metrics.go
│ │ ├── errors.go
│ │ ├── errors_test.go
│ │ ├── file/
│ │ │ ├── azure/
│ │ │ │ ├── fs.go
│ │ │ │ ├── fs_test.go
│ │ │ │ ├── go.mod
│ │ │ │ ├── go.sum
│ │ │ │ ├── storage_adapter.go
│ │ │ │ └── storage_adapter_test.go
│ │ │ ├── common_file.go
│ │ │ ├── common_file_test.go
│ │ │ ├── common_fs.go
│ │ │ ├── common_fs_signedurl_test.go
│ │ │ ├── common_fs_test.go
│ │ │ ├── ftp/
│ │ │ │ ├── fs.go
│ │ │ │ ├── fs_test.go
│ │ │ │ ├── go.mod
│ │ │ │ ├── go.sum
│ │ │ │ ├── storage_adapter.go
│ │ │ │ └── storage_adapter_test.go
│ │ │ ├── gcs/
│ │ │ │ ├── fs.go
│ │ │ │ ├── fs_test.go
│ │ │ │ ├── gcs_cloud_test.go
│ │ │ │ ├── go.mod
│ │ │ │ ├── go.sum
│ │ │ │ ├── storage_adapter.go
│ │ │ │ └── storage_adapter_test.go
│ │ │ ├── helper.go
│ │ │ ├── interface.go
│ │ │ ├── local_fs.go
│ │ │ ├── local_fs_test.go
│ │ │ ├── logger.go
│ │ │ ├── mock_interface.go
│ │ │ ├── observability.go
│ │ │ ├── row_reader.go
│ │ │ ├── row_reader_test.go
│ │ │ ├── s3/
│ │ │ │ ├── file.go
│ │ │ │ ├── file_parse.go
│ │ │ │ ├── file_test.go
│ │ │ │ ├── fs.go
│ │ │ │ ├── fs_dir.go
│ │ │ │ ├── fs_test.go
│ │ │ │ ├── go.mod
│ │ │ │ ├── go.sum
│ │ │ │ ├── interface.go
│ │ │ │ ├── logger.go
│ │ │ │ ├── logger_test.go
│ │ │ │ └── mock_interface.go
│ │ │ └── sftp/
│ │ │ ├── file.go
│ │ │ ├── fs.go
│ │ │ ├── fs_test.go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── interface.go
│ │ │ ├── logger.go
│ │ │ ├── logger_test.go
│ │ │ └── mock_interface.go
│ │ ├── health.go
│ │ ├── influxdb/
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── influxdb.go
│ │ │ ├── influxdb_test.go
│ │ │ ├── interface.go
│ │ │ ├── internal.go
│ │ │ ├── logger.go
│ │ │ ├── metrics.go
│ │ │ ├── metrics_logger.go
│ │ │ ├── mock_interface.go
│ │ │ └── mock_logger.go
│ │ ├── interface.go
│ │ ├── kv-store/
│ │ │ ├── badger/
│ │ │ │ ├── badger.go
│ │ │ │ ├── badger_test.go
│ │ │ │ ├── go.mod
│ │ │ │ ├── go.sum
│ │ │ │ ├── logger.go
│ │ │ │ ├── logger_test.go
│ │ │ │ ├── metrics.go
│ │ │ │ ├── mock_logger.go
│ │ │ │ └── mock_metrics.go
│ │ │ ├── dynamodb/
│ │ │ │ ├── dynamo.go
│ │ │ │ ├── dynamo_test.go
│ │ │ │ ├── go.mod
│ │ │ │ ├── go.sum
│ │ │ │ ├── logger.go
│ │ │ │ ├── metrics.go
│ │ │ │ ├── mock_dynamodb.go
│ │ │ │ ├── mock_logger.go
│ │ │ │ └── mock_metrics.go
│ │ │ └── nats/
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── interface.go
│ │ │ ├── logger.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_interface.go
│ │ │ ├── mock_logger.go
│ │ │ ├── mock_metrics.go
│ │ │ ├── nats.go
│ │ │ └── nats_test.go
│ │ ├── logger.go
│ │ ├── mongo/
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── logger.go
│ │ │ ├── logger_test.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_logger.go
│ │ │ ├── mock_metrics.go
│ │ │ ├── mongo.go
│ │ │ └── mongo_test.go
│ │ ├── opentsdb/
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── interface.go
│ │ │ ├── mock_interface.go
│ │ │ ├── observability.go
│ │ │ ├── opentsdb.go
│ │ │ ├── opentsdb_test.go
│ │ │ ├── preprocess.go
│ │ │ └── response.go
│ │ ├── oracle/
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── interface.go
│ │ │ ├── logger.go
│ │ │ ├── logger_test.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_interface.go
│ │ │ ├── mock_logger.go
│ │ │ ├── mock_metrics.go
│ │ │ ├── oracle.go
│ │ │ └── oracle_test.go
│ │ ├── pubsub/
│ │ │ ├── eventhub/
│ │ │ │ ├── eventhub.go
│ │ │ │ ├── eventhub_test.go
│ │ │ │ ├── go.mod
│ │ │ │ ├── go.sum
│ │ │ │ ├── helper.go
│ │ │ │ ├── helper_test.go
│ │ │ │ ├── logger.go
│ │ │ │ ├── logger_test.go
│ │ │ │ ├── message.go
│ │ │ │ ├── metrics.go
│ │ │ │ ├── mock_logger.go
│ │ │ │ └── mock_metrics.go
│ │ │ ├── google/
│ │ │ │ ├── google.go
│ │ │ │ ├── google_test.go
│ │ │ │ ├── health.go
│ │ │ │ ├── helper.go
│ │ │ │ ├── interfaces.go
│ │ │ │ ├── message.go
│ │ │ │ ├── message_test.go
│ │ │ │ ├── metrics.go
│ │ │ │ ├── mock_interfaces.go
│ │ │ │ ├── mock_metrics.go
│ │ │ │ ├── tracing.go
│ │ │ │ └── tracing_test.go
│ │ │ ├── interface.go
│ │ │ ├── kafka/
│ │ │ │ ├── conn.go
│ │ │ │ ├── errors.go
│ │ │ │ ├── health.go
│ │ │ │ ├── health_test.go
│ │ │ │ ├── helper.go
│ │ │ │ ├── interfaces.go
│ │ │ │ ├── kafka.go
│ │ │ │ ├── kafka_sasl.go
│ │ │ │ ├── kafka_sasl_test.go
│ │ │ │ ├── kafka_test.go
│ │ │ │ ├── message.go
│ │ │ │ ├── message_test.go
│ │ │ │ ├── metrics.go
│ │ │ │ ├── mock_interfaces.go
│ │ │ │ ├── mock_metrics.go
│ │ │ │ ├── tls.go
│ │ │ │ ├── tls_test.go
│ │ │ │ ├── tracing.go
│ │ │ │ └── tracing_test.go
│ │ │ ├── log.go
│ │ │ ├── message.go
│ │ │ ├── message_test.go
│ │ │ ├── mqtt/
│ │ │ │ ├── default_client.go
│ │ │ │ ├── helper.go
│ │ │ │ ├── interface.go
│ │ │ │ ├── message.go
│ │ │ │ ├── message_test.go
│ │ │ │ ├── mock_client.go
│ │ │ │ ├── mock_interfaces.go
│ │ │ │ ├── mock_token.go
│ │ │ │ ├── mqtt.go
│ │ │ │ └── mqtt_test.go
│ │ │ ├── nats/
│ │ │ │ ├── client.go
│ │ │ │ ├── client_helper.go
│ │ │ │ ├── client_test.go
│ │ │ │ ├── committer.go
│ │ │ │ ├── committer_test.go
│ │ │ │ ├── config.go
│ │ │ │ ├── connection_manager.go
│ │ │ │ ├── connection_manager_test.go
│ │ │ │ ├── connectors.go
│ │ │ │ ├── connectors_test.go
│ │ │ │ ├── errors.go
│ │ │ │ ├── go.mod
│ │ │ │ ├── go.sum
│ │ │ │ ├── health.go
│ │ │ │ ├── health_test.go
│ │ │ │ ├── interfaces.go
│ │ │ │ ├── message.go
│ │ │ │ ├── message_test.go
│ │ │ │ ├── metrics.go
│ │ │ │ ├── mock_client.go
│ │ │ │ ├── mock_jetstream.go
│ │ │ │ ├── mock_metrics.go
│ │ │ │ ├── mock_tracer.go
│ │ │ │ ├── pubsub_wrapper.go
│ │ │ │ ├── stream_manager.go
│ │ │ │ ├── stream_manager_test.go
│ │ │ │ ├── subscription_manager.go
│ │ │ │ ├── subscription_manager_test.go
│ │ │ │ ├── tracing.go
│ │ │ │ ├── tracing_test.go
│ │ │ │ └── wrapper_test.go
│ │ │ └── sqs/
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── health.go
│ │ │ ├── health_test.go
│ │ │ ├── interfaces.go
│ │ │ ├── message.go
│ │ │ ├── message_test.go
│ │ │ ├── mock_client.go
│ │ │ ├── sqs.go
│ │ │ ├── sqs_test.go
│ │ │ ├── tracing.go
│ │ │ └── tracing_test.go
│ │ ├── redis/
│ │ │ ├── config.go
│ │ │ ├── config_test.go
│ │ │ ├── health.go
│ │ │ ├── health_test.go
│ │ │ ├── hook.go
│ │ │ ├── hook_test.go
│ │ │ ├── messages.go
│ │ │ ├── messages_test.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_metrics.go
│ │ │ ├── pubsub.go
│ │ │ ├── pubsub_test.go
│ │ │ ├── redis.go
│ │ │ └── redis_test.go
│ │ ├── scylladb/
│ │ │ ├── errors.go
│ │ │ ├── errors_test.go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── interface.go
│ │ │ ├── internal.go
│ │ │ ├── logger.go
│ │ │ ├── logger_test.go
│ │ │ ├── mock_interface.go
│ │ │ ├── mock_logger.go
│ │ │ ├── scylladb.go
│ │ │ └── scylladb_test.go
│ │ ├── solr/
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── logger.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_logger.go
│ │ │ ├── mock_metrics.go
│ │ │ ├── solr.go
│ │ │ └── solr_test.go
│ │ ├── sql/
│ │ │ ├── bind.go
│ │ │ ├── bind_test.go
│ │ │ ├── db.go
│ │ │ ├── db_test.go
│ │ │ ├── health.go
│ │ │ ├── health_test.go
│ │ │ ├── metrics.go
│ │ │ ├── mock_metrics.go
│ │ │ ├── query_builder.go
│ │ │ ├── query_builder_test.go
│ │ │ ├── sql.go
│ │ │ ├── sql_mock.go
│ │ │ ├── sql_test.go
│ │ │ ├── supabase.go
│ │ │ └── supabase_test.go
│ │ └── surrealdb/
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── interface.go
│ │ ├── mock_interface.go
│ │ ├── surrealdb.go
│ │ ├── surrealdb_test.go
│ │ ├── utils.go
│ │ └── wrapper.go
│ ├── default.go
│ ├── exporter.go
│ ├── exporter_test.go
│ ├── external_db.go
│ ├── external_db_test.go
│ ├── factory.go
│ ├── file/
│ │ ├── file.go
│ │ ├── file_test.go
│ │ ├── zip.go
│ │ └── zip_test.go
│ ├── gofr.go
│ ├── gofr_test.go
│ ├── graphql.go
│ ├── graphql_test.go
│ ├── grpc/
│ │ ├── log.go
│ │ ├── log_test.go
│ │ ├── middleware/
│ │ │ ├── apikey_auth.go
│ │ │ ├── auth_test.go
│ │ │ ├── basic_auth.go
│ │ │ ├── common.go
│ │ │ ├── oauth.go
│ │ │ └── oauth_integration_test.go
│ │ ├── rate_limiter.go
│ │ └── rate_limiter_test.go
│ ├── grpc.go
│ ├── grpc_test.go
│ ├── handler.go
│ ├── handler_test.go
│ ├── http/
│ │ ├── errors.go
│ │ ├── errors_test.go
│ │ ├── form_data_binder.go
│ │ ├── form_data_binder_test.go
│ │ ├── metrics.go
│ │ ├── middleware/
│ │ │ ├── apikey_auth.go
│ │ │ ├── apikey_auth_test.go
│ │ │ ├── auth.go
│ │ │ ├── auth_test.go
│ │ │ ├── basic_auth.go
│ │ │ ├── basic_auth_test.go
│ │ │ ├── config.go
│ │ │ ├── config_test.go
│ │ │ ├── cors.go
│ │ │ ├── cors_test.go
│ │ │ ├── errors.go
│ │ │ ├── errors_test.go
│ │ │ ├── logger.go
│ │ │ ├── logger_test.go
│ │ │ ├── metrics.go
│ │ │ ├── metrics_test.go
│ │ │ ├── oauth.go
│ │ │ ├── oauth_test.go
│ │ │ ├── rate_limiter.go
│ │ │ ├── rate_limiter_store.go
│ │ │ ├── rate_limiter_test.go
│ │ │ ├── tracer.go
│ │ │ ├── tracer_test.go
│ │ │ ├── validate.go
│ │ │ ├── validate_test.go
│ │ │ ├── web_socket.go
│ │ │ └── web_socket_test.go
│ │ ├── multipart_file_bind.go
│ │ ├── multipart_file_bind_test.go
│ │ ├── request.go
│ │ ├── request_test.go
│ │ ├── responder.go
│ │ ├── responder_test.go
│ │ ├── response/
│ │ │ ├── file.go
│ │ │ ├── raw.go
│ │ │ ├── redirect.go
│ │ │ ├── response.go
│ │ │ ├── template.go
│ │ │ └── xml.go
│ │ ├── router.go
│ │ └── router_test.go
│ ├── http_server.go
│ ├── http_server_test.go
│ ├── logging/
│ │ ├── ctx_logger.go
│ │ ├── ctx_logger_test.go
│ │ ├── level.go
│ │ ├── level_test.go
│ │ ├── logger.go
│ │ ├── logger_test.go
│ │ ├── mock_logger.go
│ │ ├── mock_logger_test.go
│ │ └── remotelogger/
│ │ ├── dynamic_level_logger.go
│ │ ├── dynamic_level_logger_test.go
│ │ └── mock_buffer_logger.go
│ ├── metrics/
│ │ ├── errors.go
│ │ ├── exporters/
│ │ │ ├── exporter.go
│ │ │ ├── telemetry.go
│ │ │ └── telemetry_test.go
│ │ ├── handler.go
│ │ ├── handler_test.go
│ │ ├── register.go
│ │ ├── register_test.go
│ │ ├── store.go
│ │ └── store_test.go
│ ├── metrics_server.go
│ ├── migration/
│ │ ├── arango.go
│ │ ├── arango_test.go
│ │ ├── cassandra.go
│ │ ├── cassandra_test.go
│ │ ├── clickhouse.go
│ │ ├── clickhouse_test.go
│ │ ├── datasource.go
│ │ ├── datasource_test.go
│ │ ├── dgraph.go
│ │ ├── dgraph_test.go
│ │ ├── elasticsearch.go
│ │ ├── elasticsearch_test.go
│ │ ├── interface.go
│ │ ├── logger.go
│ │ ├── migration.go
│ │ ├── migration_test.go
│ │ ├── mock_interface.go
│ │ ├── mongo.go
│ │ ├── mongo_test.go
│ │ ├── opentsdb.go
│ │ ├── opentsdb_test.go
│ │ ├── oracle.go
│ │ ├── oracle_test.go
│ │ ├── pubsub.go
│ │ ├── pubsub_test.go
│ │ ├── redis.go
│ │ ├── redis_test.go
│ │ ├── scylla_db.go
│ │ ├── scylla_db_test.go
│ │ ├── sql.go
│ │ ├── sql_test.go
│ │ ├── surreal_db.go
│ │ └── surreal_db_test.go
│ ├── otel.go
│ ├── otel_test.go
│ ├── rbac/
│ │ ├── config.go
│ │ ├── config_test.go
│ │ ├── endpoint_matcher.go
│ │ ├── endpoint_matcher_test.go
│ │ ├── middleware.go
│ │ └── middleware_test.go
│ ├── rbac.go
│ ├── rbac_test.go
│ ├── request.go
│ ├── responder.go
│ ├── rest.go
│ ├── run.go
│ ├── service/
│ │ ├── apikey_auth.go
│ │ ├── apikey_auth_test.go
│ │ ├── auth.go
│ │ ├── auth_test.go
│ │ ├── basic_auth.go
│ │ ├── basic_auth_test.go
│ │ ├── circuit_breaker.go
│ │ ├── circuit_breaker_test.go
│ │ ├── connection_pool.go
│ │ ├── connection_pool_test.go
│ │ ├── custom_header.go
│ │ ├── custom_header_test.go
│ │ ├── errors.go
│ │ ├── errors_test.go
│ │ ├── health.go
│ │ ├── health_config.go
│ │ ├── health_config_test.go
│ │ ├── health_test.go
│ │ ├── logger.go
│ │ ├── logger_test.go
│ │ ├── metrics.go
│ │ ├── mock_http_service.go
│ │ ├── mock_metrics.go
│ │ ├── mock_oauth_server.go
│ │ ├── new.go
│ │ ├── new_test.go
│ │ ├── oauth.go
│ │ ├── oauth_test.go
│ │ ├── options.go
│ │ ├── rate_limiter.go
│ │ ├── rate_limiter_config.go
│ │ ├── rate_limiter_config_test.go
│ │ ├── rate_limiter_store.go
│ │ ├── rate_limiter_store_test.go
│ │ ├── rate_limiter_test.go
│ │ ├── response.go
│ │ ├── response_test.go
│ │ ├── retry.go
│ │ └── retry_test.go
│ ├── shutdown.go
│ ├── shutdown_test.go
│ ├── static/
│ │ ├── files.go
│ │ ├── index.css
│ │ ├── index.html
│ │ ├── oauth2-redirect.html
│ │ ├── swagger-ui-bundle.js
│ │ ├── swagger-ui-standalone-preset.js
│ │ ├── swagger-ui.css
│ │ └── swagger-ui.js
│ ├── subscriber.go
│ ├── subscriber_test.go
│ ├── swagger.go
│ ├── swagger_test.go
│ ├── telemetry.go
│ ├── testutil/
│ │ ├── error.go
│ │ ├── error_test.go
│ │ ├── os.go
│ │ ├── os_test.go
│ │ ├── port.go
│ │ └── port_test.go
│ ├── version/
│ │ └── version.go
│ ├── websocket/
│ │ ├── interfaces.go
│ │ ├── mock_interfaces.go
│ │ ├── options.go
│ │ ├── websocket.go
│ │ └── websocket_test.go
│ ├── websocket.go
│ └── websocket_test.go
└── typos.toml
================================================
FILE CONTENTS
================================================
================================================
FILE: .codeclimate.yml
================================================
version: "2"
checks:
argument-count:
enabled: true
config:
threshold: 6
complex-logic:
enabled: true
config:
threshold: 10
file-lines:
enabled: true
config:
threshold: 300
method-complexity:
enabled: true
config:
threshold: 12
method-count:
enabled: true
config:
threshold: 25
method-lines:
enabled: true
config:
threshold: 100
nested-control-flow:
enabled: true
config:
threshold: 4
return-statements:
enabled: true
config:
threshold: 8
similar-code:
enabled: false
identical-code:
enabled: false
# plugins:
# eslint:
# enabled: true
# channel: "eslint-6"
exclude_patterns:
- "**/mock_*"
- "**/*_test.go"
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: triage
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior, if applicable:
1. The code is
```go
```
2. The error is
```
```
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Environments (please complete the following information):**
- OS: [e.g. Linux]
- gofr version [e.g. v1.5.0]
- go version [e.g. 1.21]
**More description**
Add any other context about the problem here.
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: triage
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
================================================
FILE: .github/ISSUE_TEMPLATE/question.md
================================================
---
name: Question
about: Ask a question on using gofr
title: ''
labels: ''
assignees: ''
---
================================================
FILE: .github/dependabot.yml
================================================
---
version: 2
updates:
- package-ecosystem: "gomod"
open-pull-requests-limit: 10 # avoid spam, if no one reacts
directories:
- "/"
- "/examples/*"
- "/pkg/gofr/datasource/*"
- "/pkg/gofr/datasource/file/*"
- "/pkg/gofr/datasource/kv-store/*"
- "/pkg/gofr/datasource/pubsub/*"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
open-pull-requests-limit: 10 # avoid spam, if no one reacts
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
groups:
actions:
update-types:
- "minor"
- "patch"
================================================
FILE: .github/pull_request_template.md
================================================
## Pull Request Template
**Description:**
- Provide a concise explanation of the changes made.
- Mention the issue number(s) this PR addresses (if applicable).
- Highlight the motivation behind the changes and the expected benefits.
**Breaking Changes (if applicable):**
- List any breaking changes introduced by this PR.
- Explain the rationale behind these changes and how they will impact users.
**Additional Information:**
- Mention any relevant dependencies or external libraries used.
- Include screenshots or code snippets (if necessary) to clarify the changes.
**Checklist:**
- [ ] I have formatted my code using `goimport` and `golangci-lint`.
- [ ] All new code is covered by unit tests.
- [ ] This PR does not decrease the overall code coverage.
- [ ] I have reviewed the code comments and documentation for clarity.
**Thank you for your contribution!**
================================================
FILE: .github/workflows/go.yml
================================================
---
name: Workflow-Pipeline
permissions:
contents: read
# Define when this workflow should run
on:
# Run on push events to main or development branches
push:
branches:
- main
- development
paths-ignore:
- 'docs/**' # Ignore changes to docs folder
- '**/*.md'
# Run on pull requests to main or development branches
pull_request:
branches:
- main
- development
paths-ignore:
- 'docs/**' # Ignore changes to docs folder
- '**/*.md'
# Define the jobs that this workflow will run
jobs:
# Job for testing the examples directory
Example-Unit-Testing:
name: Example Unit Testing (v${{ matrix.go-version }})🛠
runs-on: ubuntu-latest
# Define a matrix strategy to test against multiple Go versions
strategy:
matrix:
go-version: ['1.25','1.24', '1.23']
# Continue with other jobs if one version fails
fail-fast: false
# Define service containers that tests depend on
services:
# Kafka service
kafka:
image: bitnamilegacy/kafka:3.4.1
ports:
- "9092:9092"
env:
KAFKA_ENABLE_KRAFT: yes
KAFKA_CFG_PROCESS_ROLES: broker,controller
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://127.0.0.1:9092
KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: true
KAFKA_BROKER_ID: 1
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 1@127.0.0.1:9093
ALLOW_PLAINTEXT_LISTENER: yes
KAFKA_CFG_NODE_ID: 1
# Redis service
redis:
image: redis:7.0.5
ports:
- "2002:6379"
options: "--entrypoint redis-server"
# MySQL service
mysql:
image: mysql:8.2.0
ports:
- "2001:3306"
env:
MYSQL_ROOT_PASSWORD: "password"
MYSQL_DATABASE: "test"
# Steps to execute for this job
steps:
- name: Checkout code into go module directory
uses: actions/checkout@v6
with:
fetch-depth: 0 # Full git history for accurate testing
# Set up the Go environment with the specified version
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
id: Go
- name: Get dependencies
run: |
go mod download
- name: Start Zipkin
run: docker run -d -p 2005:9411 openzipkin/zipkin:latest
# Run tests with automatic retry on failures
- name: Test with Retry Logic
id: test
uses: nick-fields/retry@v3
with:
timeout_minutes: 5 # Maximum time for the tests to run
max_attempts: 2 # Retry up to 2 times if tests fail
command: |
export APP_ENV=test
# Run tests for the examples directory with coverage
go test ./examples/... -v -short -covermode=atomic -coverprofile packageWithpbgo.cov -coverpkg=./examples/...
# Filter out auto-generated files by protobuf and gofr framework from coverage report
grep -vE '(/client/|grpc-.+-client/main\.go|_client\.go|_gofr\.go|_grpc\.pb\.go|\.pb\.go|\.proto|health_.*\.go)' packageWithpbgo.cov > profile.cov
# Display coverage statistics
go tool cover -func profile.cov
# Upload coverage report for the 1.24 Go version only
- name: Upload Test Coverage
if: ${{ matrix.go-version == '1.24'}}
uses: actions/upload-artifact@v7
with:
name: Example-Test-Report
path: profile.cov
# Job for testing the pkg directory
PKG-Unit-Testing:
name: PKG Unit Testing (v${{ matrix.go-version }})🛠
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.25','1.24', '1.23']
fail-fast: false
steps:
- name: Checkout code into go module directory
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
id: Go
- name: Get dependencies
run: |
go mod download
# Run pkg tests with automatic retry logic
- name: Test with Retry Logic
id: test
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 2
retry_on: error
command: |
export APP_ENV=test
# Run tests for root gofr package
go test -v -short -covermode=atomic \
-coverpkg=./pkg/gofr -coverprofile=gofr_only.cov ./pkg/gofr
exit_code=$?
if [ $exit_code -eq 2 ]; then
echo "::error::Panic detected in root gofr package tests"
exit 2
elif [ $exit_code -ne 0 ]; then
echo "::error::Root gofr package tests failed"
exit $exit_code
fi
# Run tests for sub-packages
go test -v -covermode=atomic \
-coverpkg=./pkg/gofr -coverprofile=submodules.cov ./pkg/gofr/...
exit_code=$?
if [ $exit_code -eq 2 ]; then
echo "::error::Panic detected in gofr sub-packages tests"
exit 2
elif [ $exit_code -ne 0 ]; then
echo "::error::Gofr sub-packages tests failed"
exit $exit_code
fi
# Combine coverage profiles
echo "mode: atomic" > profile.cov
grep -h -v "mode:" gofr_only.cov submodules.cov | grep -v '/mock_' >> profile.cov
# Show coverage summary
go tool cover -func profile.cov
# Upload coverage report for the 1.24 Go version only
- name: Upload Test Coverage
if: ${{ matrix.go-version == '1.24'}}
uses: actions/upload-artifact@v7
with:
name: PKG-Coverage-Report
path: profile.cov
# Job for analyzing and reporting code coverage
parse_coverage:
name: Code Coverage
runs-on: ubuntu-latest
# This job runs after both Example and PKG testing are complete
needs: [ Example-Unit-Testing,PKG-Unit-Testing ]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v6
# Download coverage reports from previous jobs
- name: Download Coverage Report
uses: actions/download-artifact@v8
with:
path: artifacts
# Merge the coverage reports from Example and PKG tests
- name: Merge Coverage Files
working-directory: artifacts
run: |
echo "mode: atomic" > merged_profile.cov
grep -h -v "mode:" ./Example-Test-Report/profile.cov ./PKG-Coverage-Report/profile.cov >> merged_profile.cov
# Calculate and output the total code coverage percentage
- name: Parse code-coverage value
working-directory: artifacts
run: |
codeCoverage=$(go tool cover -func=merged_profile.cov | grep total | awk '{print $3}')
codeCoverage=${codeCoverage%?}
echo "CODE_COVERAGE=$codeCoverage" >> $GITHUB_ENV
echo "✅ Total Code Coverage: $codeCoverage%"
# - name: Check if code-coverage is greater than threshold
# run: |
# codeCoverage=${{ env.CODE_COVERAGE }}
# codeCoverage=${codeCoverage%??}
# if [[ $codeCoverage -lt 92 ]]; then echo "code coverage cannot be less than 92%, currently its ${{ env.CODE_COVERAGE }}%" && exit 1; fi;
# Job for testing submodules inside the pkg directory
Submodule-Unit-Testing:
name: Submodule Unit Testing (v${{ matrix.go-version }})🛠
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.25','1.24', '1.23']
fail-fast: false
steps:
- name: Checkout code into go module directory
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
id: Go
# Find all submodules (directories with go.mod files) in the pkg directory
- name: Detect Submodules
id: detect_submodules
run: |
# Find all directories containing a go.mod file within 'pkg'
SUBMODULES=$(find pkg -name "go.mod" -exec dirname {} \; | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "submodules=$SUBMODULES" >> $GITHUB_OUTPUT
# Test all submodules in parallel with retry logic
- name: Test Submodules with Retry and Parallelism
id: test_submodules
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 2
command: |
export APP_ENV=test
# Create a directory for coverage reports
mkdir -p coverage_reports
# Get the list of submodules
SUBMODULES='${{ steps.detect_submodules.outputs.submodules }}'
# Process each submodule in parallel with a maximum of 4 parallel jobs
echo $SUBMODULES | jq -c '.[]' | xargs -I{} -P 4 bash -c '
module={}
echo "Testing module: $module"
cd $module
# Extract module name (replace / with _)
module_name=$(echo $module | tr "/" "_")
# Download dependencies for the submodule
go mod download
go mod tidy
# Run tests with a focus on failed tests first
go test ./... -v -short -coverprofile=${module_name}.cov -coverpkg=./...
# Copy coverage file to the coverage_reports directory
cp ${module_name}.cov ../../../coverage_reports/
cd -
'
# Upload submodule coverage reports as an artifact
- name: Upload Coverage Reports
uses: actions/upload-artifact@v7
with:
name: submodule-coverage-reports
path: coverage_reports/*.cov
# Job for uploading coverage to external services (qlty.sh)
upload_coverage:
name: Upload Coverage📊
runs-on: ubuntu-latest
env:
QLTY_TOKEN: ${{ secrets.QLTY_TOKEN }}
QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_TOKEN }}
# This job only needs example and pkg test results, not submodules
needs: [Example-Unit-Testing, PKG-Unit-Testing]
# Only run this job on pushes to the development branch
if: ${{ github.repository == 'gofr-dev/gofr' && github.event_name == 'push' && github.ref == 'refs/heads/development'}}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v6
- name: Install qlty CLI
run: |
curl https://qlty.sh | sh
echo "$HOME/.qlty/bin" >> $GITHUB_PATH
# Download coverage artifacts
- name: Download Coverage Report
uses: actions/download-artifact@v8
with:
path: artifacts
# Merge coverage from example and pkg tests only
- name: Merge Coverage Files
working-directory: artifacts
run: |
echo "mode: atomic" > merged_profile.cov
grep -h -v "mode:" ./Example-Test-Report/profile.cov ./PKG-Coverage-Report/profile.cov >> merged_profile.cov
# Generate and print total coverage percentage
echo "Total Coverage:"
go tool cover -func=merged_profile.cov | tail -n 1
shell: bash
# Upload merged coverage to CodeClimate for analysis
- name: Upload
working-directory: artifacts
run: qlty coverage publish merged_profile.cov --format=coverprofile --strip-prefix="gofr.dev/" --add-prefix="${GITHUB_WORKSPACE}/"
env:
QLTY_TOKEN: ${{ secrets.QLTY_TOKEN }}
# Job for code quality checks
code_quality:
name: Code Quality🎖️
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.changed-submodules.outputs.modules }}
has_modules: ${{ steps.changed-submodules.outputs.has_modules }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v6
with:
fetch-depth: 0 # Full history needed for proper diff analysis
- name: Set up Go environment
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: false
- name: Get dependencies
run: go mod download
# Use the official golangci-lint action for the root module
# This action automatically detects changed files and only reports new issues
- name: Lint Root Module
uses: golangci/golangci-lint-action@v9
with:
version: v2.4.0
only-new-issues: true
args: --timeout=5m
# Detect changed files to determine which submodules need linting
# This implements a changed-files based approach as suggested by the maintainer
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v47
with:
files: |
pkg/**/*.go
pkg/**/go.mod
pkg/**/go.sum
# Find all submodules that have changes
- name: Find Changed Submodules
id: changed-submodules
run: |
# Check if any files changed
if [ "${{ steps.changed-files.outputs.any_changed }}" != "true" ]; then
echo "✅ No changes in pkg/ directory"
echo "modules=[]" >> $GITHUB_OUTPUT
echo "has_modules=false" >> $GITHUB_OUTPUT
exit 0
fi
changed_files="${{ steps.changed-files.outputs.all_changed_files }}"
changed_modules=""
echo "📝 Changed files detected:"
echo "$changed_files" | tr ' ' '\n'
echo ""
# Extract unique submodule directories from changed files
for file in $changed_files; do
# Find the nearest parent directory containing go.mod
dir=$(dirname "$file")
while [ "$dir" != "." ] && [ "$dir" != "/" ]; do
if [ -f "$dir/go.mod" ] && [[ "$dir" == pkg/* ]]; then
# Check if this module is not already in the list
if [[ ! "$changed_modules" =~ (^|[[:space:]])"$dir"($|[[:space:]]) ]]; then
changed_modules="$changed_modules$dir "
fi
break
fi
dir=$(dirname "$dir")
done
done
changed_modules=$(echo "$changed_modules" | xargs -n1 | sort -u)
if [ -n "$changed_modules" ]; then
echo "📦 Submodules with changes:"
echo "$changed_modules"
# Convert to JSON array for matrix usage
modules_json=$(echo "$changed_modules" | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "modules=$modules_json" >> $GITHUB_OUTPUT
echo "has_modules=true" >> $GITHUB_OUTPUT
else
echo "✅ No submodule changes detected"
echo "modules=[]" >> $GITHUB_OUTPUT
echo "has_modules=false" >> $GITHUB_OUTPUT
fi
# Separate job to lint changed submodules using matrix strategy
# This allows us to use the official golangci-lint action for each submodule
lint_changed_submodules:
name: Lint Submodules🔍
runs-on: ubuntu-latest
needs: code_quality
if: needs.code_quality.outputs.has_modules == 'true'
strategy:
matrix:
module: ${{ fromJson(needs.code_quality.outputs.modules) }}
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go environment
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: false
- name: Download dependencies for ${{ matrix.module }}
working-directory: ${{ matrix.module }}
run: go mod download
# Use the official golangci-lint action for this submodule
- name: Lint ${{ matrix.module }}
uses: golangci/golangci-lint-action@v9
with:
version: v2.4.0
working-directory: ${{ matrix.module }}
only-new-issues: true
args: --timeout=9m
# Job for checking filename conventions
linting_party:
name: Linting Party🥳
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up Go environment
uses: actions/setup-go@v5
with:
go-version: 1.25
# Check file naming conventions using ls-lint
- name: Check for file names errors
uses: ls-lint/action@v2.3.1
with:
config: .ls-lint.yml
================================================
FILE: .github/workflows/typos.yml
================================================
name: Typos Check
on:
push:
pull_request:
jobs:
typos:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: typos-action
uses: crate-ci/typos@v1.44.0
================================================
FILE: .github/workflows/website-prod.yml
================================================
name: Build and Deploy
permissions:
contents: read
on:
push:
tags:
- "v*.*.*"
env:
APP_NAME: gofr-website
WEBSITE_REGISTRY: ghcr.io
GAR_PROJECT: raramuri-tech
GAR_REGISTRY: kops-dev
CLUSTER_NAME: raramuri-tech
CLUSTER_PROJECT: raramuri-tech
NAMESPACE: gofr-dev
NAMESPACE_STAGE: gofr-dev-stg
jobs:
dockerize:
if: ${{ github.repository == 'gofr-dev/gofr' }}
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
outputs:
image: ${{ steps.output-image.outputs.image }}
name: 🐳 Dockerize
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GAR
uses: docker/login-action@v4
with:
registry: us-central1-docker.pkg.dev
username: _json_key
password: ${{ secrets.GOFR_WEBSITE_GOFR_DEV_DEPLOYMENT_KEY }}
- name: Log in to the GitHub Container registry
uses: docker/login-action@v4
with:
registry: ${{ env.WEBSITE_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download UI Image
run: |
docker pull ${{ env.WEBSITE_REGISTRY }}/gofr-dev/website:latest
- name: Determine Image Tag
id: determine-tag
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
else
TAG=${{ github.sha }}
fi
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Build and Push Image
uses: docker/build-push-action@v7
with:
push: true
context: ./
file: ./docs/Dockerfile
tags: us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY }}/${{ env.APP_NAME }}:${{ env.TAG }}
- id: output-image
run: echo "image=`echo us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY }}/${{ env.APP_NAME }}:${{ env.TAG }}`" >> "$GITHUB_OUTPUT"
deployment:
runs-on: ubuntu-latest
name: 🚀 Deploy-Prod
needs: dockerize
container:
image: ghcr.io/zopsmart/gha-images:deployments-0.1.3
options: --rm
env:
image: ${{needs.dockerize.outputs.image}}
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Authorize to GCP service account
uses: google-github-actions/auth@v3
with:
credentials_json: ${{ secrets.GOFR_WEBSITE_GOFR_DEV_DEPLOYMENT_KEY }}
- name: Set GCloud Project and Fetch Cluster Credentials
run: gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --region=us-central1 --project=${{ env.CLUSTER_PROJECT }}
- name: Update Deployment Image
run: kubectl set image deployment/${{ env.APP_NAME }} ${{ env.APP_NAME }}=${{ env.image }} --namespace ${{ env.NAMESPACE }}
================================================
FILE: .github/workflows/website-stage.yml
================================================
name: Build and Deploy Website To Stage
permissions:
contents: read
on:
push:
branches:
- development
env:
APP_NAME: gofr-website
WEBSITE_REGISTRY: ghcr.io
GAR_PROJECT: raramuri-tech
GAR_REGISTRY: kops-dev
CLUSTER_NAME: raramuri-tech
CLUSTER_PROJECT: raramuri-tech
NAMESPACE: gofr-dev
NAMESPACE_STAGE: gofr-dev-stg
jobs:
dockerize:
if: ${{ github.repository == 'gofr-dev/gofr' }}
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
outputs:
image: ${{ steps.output-image.outputs.image }}
name: 🐳 Dockerize
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GAR
uses: docker/login-action@v4
with:
registry: us-central1-docker.pkg.dev
username: _json_key
password: ${{ secrets.GOFR_WEBSITE_GOFR_DEV_STG_DEPLOYMENT_KEY }}
- name: Log in to the GitHub Container registry
uses: docker/login-action@v4
with:
registry: ${{ env.WEBSITE_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download UI Image
run: |
docker pull ${{ env.WEBSITE_REGISTRY }}/gofr-dev/website:latest
- name: Determine Image Tag
id: determine-tag
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
else
TAG=${{ github.sha }}
fi
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Build and Push Image
uses: docker/build-push-action@v7
with:
push: true
context: ./
file: ./docs/Dockerfile
tags: us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY }}/${{ env.APP_NAME }}:${{ env.TAG }}
- id: output-image
run: echo "image=`echo us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY }}/${{ env.APP_NAME }}:${{ env.TAG }}`" >> "$GITHUB_OUTPUT"
deployment_stage:
runs-on: ubuntu-latest
name: 🚀 Deploy-Stage
needs: dockerize
container:
image: ghcr.io/zopsmart/gha-images:deployments-0.1.3
options: --rm
env:
image: ${{needs.dockerize.outputs.image}}
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Authorize to GCP service account
uses: google-github-actions/auth@v3
with:
credentials_json: ${{ secrets.GOFR_WEBSITE_GOFR_DEV_STG_DEPLOYMENT_KEY }}
- name: Set GCloud Project and Fetch Cluster Credentials
run: gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --region=us-central1 --project=${{ env.CLUSTER_PROJECT }}
- name: Update Deployment Image
run: kubectl set image deployment/${{ env.APP_NAME }} ${{ env.APP_NAME }}=${{ env.image }} --namespace ${{ env.NAMESPACE_STAGE }}
================================================
FILE: .gitignore
================================================
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.txt
# Dependency directories (remove the comment below to include it)
vendor/
.idea
*.impl
# IDE Cache
.vscode
.DS_Store
================================================
FILE: .golangci.yml
================================================
version: "2"
linters:
default: none
enable:
- asciicheck
- bodyclose
- canonicalheader
- copyloopvar
- dogsled
- dupl
- err113
- errcheck
- errorlint
- exhaustive
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- goprintffuncname
- gosec
- govet
- ineffassign
- lll
- mirror
- misspell
- mnd
- nakedret
- nestif
- noctx
- nolintlint
- prealloc
- revive
- rowserrcheck
- staticcheck
- testifylint
- thelper
- unconvert
- unparam
- unused
- usestdlibvars
- usetesting
- whitespace
- wsl_v5
# don't enable:
# - godox # Disabling because we need TODO lines at this stage of project.
# - testpackage # We also need to do unit test for unexported functions. And adding _internal in all files is cumbersome.
settings:
dupl:
threshold: 100
exhaustive:
default-signifies-exhaustive: false
funlen:
lines: 100
statements: 50
goconst:
min-len: 2
min-occurrences: 2
gocritic:
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
gocyclo:
min-complexity: 10
govet:
enable:
- shadow
settings:
printf:
funcs:
- (gofr.dev/pkg/gofr/Logger).Logf
- (gofr.dev/pkg/gofr/Logger).Errorf
lll:
line-length: 140
misspell:
locale: US
mnd:
checks:
- argument
- case
- condition
- return
nolintlint:
require-explanation: true # require an explanation for nolint directives
require-specific: true # require nolint directives to be specific about which linter is being skipped
allow-unused: false # report any unused nolint directives
revive:
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: empty-block
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: exported
arguments:
# enables checking public methods of private types
- checkPrivateReceivers
# make error messages clearer
- sayRepetitiveInsteadOfStutters
- name: increment-decrement
- name: indent-error-flow
- name: range
- name: receiver-naming
- name: redefines-builtin-id
- name: superfluous-else
- name: time-naming
- name: unexported-return
- name: unreachable-code
- name: unused-parameter
- name: var-declaration
- name: var-naming
- name: bare-return
- name: bool-literal-in-expr
- name: comment-spacings
- name: early-return
- name: defer
- name: deep-exit
- name: unused-receiver
- name: use-any
staticcheck:
checks:
- all
- -QF1001 # TODO remove this line and fix reported errors
- -QF1003 # TODO remove this line and fix reported errors
- -QF1008 # TODO remove this line and fix reported errors
- -ST1000 # TODO remove this line and fix reported errors
usestdlibvars:
time-layout: true
exclusions:
presets:
- common-false-positives # TODO fix errors reported by this and remove this line
- legacy # TODO fix errors reported by this and remove this line
- std-error-handling # TODO remove this line, configure errcheck, and fix reported errors
rules:
- linters:
- dupl
- goconst
- mnd
path: _test\.go
- linters:
- revive
text: "exported (.+) should have comment" # TODO fix errors reported by this and remove this line
paths:
- examples # TODO remove this line and fix reported errors
formatters:
enable:
- gci
- gofmt
settings:
gci:
sections:
- standard
- default
- localmodule
goimports:
local-prefixes:
- gofr.dev
================================================
FILE: .ls-lint.yml
================================================
---
ls:
.go: snake_case
.pb.go: snake_case
================================================
FILE: .qlty/.gitignore
================================================
*
!configs
!configs/**
!hooks
!hooks/**
!qlty.toml
!.gitignore
================================================
FILE: .qlty/configs/.hadolint.yaml
================================================
ignored:
- DL3008
================================================
FILE: .qlty/configs/.yamllint.yaml
================================================
rules:
document-start: disable
quoted-strings:
required: only-when-needed
extra-allowed: ["{|}"]
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
================================================
FILE: .qlty/qlty.toml
================================================
# This file was automatically generated by `qlty init`.
# You can modify it to suit your needs.
# We recommend you to commit this file to your repository.
#
# This configuration is used by both Qlty CLI and Qlty Cloud.
#
# Qlty CLI -- Code quality toolkit for developers
# Qlty Cloud -- Fully automated Code Health Platform
#
# Try Qlty Cloud: https://qlty.sh
#
# For a guide to configuration, visit https://qlty.sh/d/config
# Or for a full reference, visit https://qlty.sh/d/qlty-toml
config_version = "0"
exclude_patterns = [
"*_min.*",
"*-min.*",
"*.min.*",
"**/.yarn/**",
"**/*.d.ts",
"**/assets/**",
"**/bower_components/**",
"**/build/**",
"**/cache/**",
"**/config/**",
"**/db/**",
"**/deps/**",
"**/dist/**",
"**/extern/**",
"**/external/**",
"**/generated/**",
"**/Godeps/**",
"**/gradlew/**",
"**/mvnw/**",
"**/node_modules/**",
"**/protos/**",
"**/seed/**",
"**/target/**",
"**/templates/**",
"**/testdata/**",
"**/vendor/**",
"**/mock_*",
"**/*_test.go",
]
test_patterns = [
"**/test/**",
"**/spec/**",
"**/*.test.*",
"**/*.spec.*",
"**/*_test.*",
"**/*_spec.*",
"**/test_*.*",
"**/spec_*.*",
]
[smells]
mode = "comment"
[smells.boolean_logic]
threshold = 10
enabled = true
[smells.file_complexity]
threshold = 85 # Increased from 66 to match your codeclimate complex-logic: 10 scaled appropriately
enabled = true
[smells.return_statements]
threshold = 25 # Significantly increased from 8 to match your codeclimate threshold
enabled = true
[smells.nested_control_flow]
threshold = 4
enabled = true
[smells.function_parameters]
threshold = 6
enabled = true
[smells.function_complexity]
threshold = 13
enabled = true
# CRITICAL: Completely disable duplication detection like in Code Climate
[smells.duplication]
enabled = false
[[source]]
name = "default"
default = true
# CRITICAL TRIAGE RULES: These will suppress the specific issues shown in your screenshot
# Completely ignore similar-code issues (22 occurrences in your screenshot)
[[triage]]
match.rules = ["qlty:similar-code"]
match.file_patterns = ["**/*.go"]
set.ignored = true
# Completely ignore identical-code issues (4 occurrences in your screenshot)
[[triage]]
match.rules = ["qlty:identical-code"]
match.file_patterns = ["**/*.go"]
set.ignored = true
# Set function-parameters issues to low priority instead of medium (10 occurrences)
[[triage]]
match.rules = ["qlty:function-parameters"]
match.file_patterns = ["**/*.go"]
set.level = "low"
set.mode = "monitor"
# Set return-statements issues to low priority (6 occurrences)
[[triage]]
match.rules = ["qlty:return-statements"]
match.file_patterns = ["**/*.go"]
set.level = "low"
set.mode = "monitor"
# Set file-complexity issues to low priority (1 occurrence)
[[triage]]
match.rules = ["qlty:file-complexity"]
match.file_patterns = ["**/*.go"]
set.level = "low"
set.mode = "monitor"
# Set nested-control-flow issues to low priority (1 occurrence)
[[triage]]
match.rules = ["qlty:nested-control-flow"]
match.file_patterns = ["**/*.go"]
set.level = "low"
set.mode = "monitor"
# Additional safeguard: Set all medium-level structure issues to monitor mode
[[triage]]
match.plugins = ["qlty"]
match.levels = ["medium"]
match.file_patterns = ["**/*.go"]
set.mode = "monitor"
# Set all duplication category issues to be ignored
[[triage]]
match.plugins = ["qlty"]
match.category = ["duplication"]
set.ignored = true
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
support[at]gofr.dev.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
================================================
FILE: CONTRIBUTING.md
================================================
## Contribution Guidelines
* Minor changes can be done directly by editing code on GitHub. GitHub automatically creates a temporary branch and
files a PR. This is only suitable for really small changes like: spelling fixes, variable name changes or error string
change etc. For larger commits, the following steps are recommended.
* (Optional) If you want to discuss your implementation with the users of GoFr, use the GitHub discussions of this repo.
* Configure your editor to use goimports and golangci-lint on file changes. Any code which is not formatted using these
tools, will fail on the pipeline.
* Contributors should begin working on an issue only after it has been assigned to them. To get an issue assigned, please comment on the GitHub thread
and request assignment from a maintainer. This helps avoid duplicate or conflicting pull requests from multiple contributors.
* Issues labeled triage are not open for direct contributions. If you're interested in working on a triage issue, please reach out to the maintainers
to discuss it before proceeding in the GitHub thread.
<!-- spellchecker:off "favour" have to be ignored here -->
* We follow **American English** conventions in this project (e.g., *"favor"* instead of *"favour"*). Please keep this consistent across all code comments, documentation, etc.
<!-- spellchecker:on -->
* All code contributions should have associated tests and all new line additions should be covered in those test cases.
No PR should ever decrease the overall code coverage.
* Once your code changes are done along with the test cases, submit a PR to development branch. Please note that all PRs
are merged from feature branches to development first.
* A PR should be raised only when development is complete and the code is ready for review. This approach helps reduce the number of open pull requests and facilitates a more efficient review process for the team.
* All PRs need to be reviewed by at least 2 GoFr developers. They might reach out to you for any clarification.
* Thank you for your contribution. :)
### GoFr Testing Policy:
Testing is a crucial aspect of software development, and adherence to these guidelines ensures the stability, reliability, and maintainability of the GoFr codebase.
### Guidelines
1. **Test Types:**
- Write unit tests for every new function or method.
- Include integration tests for any major feature added.
2. **Test Coverage:**
- No new code should decrease the existing code coverage for the packages and files.
> The `code-climate` coverage check will not pass if there is any decrease in the test-coverage before and after any new PR is submitted.
3. **Naming Conventions:**
- Prefix unit test functions with `Test`.
- Use clear and descriptive names.
```go
func TestFunctionName(t *testing.T) {
// Test logic
}
```
4. **Table-Driven Tests:**
- Consider using table-driven tests for testing multiple scenarios.
> [!NOTE]
> Some services will be required to pass the entire test suite. We recommend using docker for running those services.
```console
docker run --name mongodb -d -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=user -e MONGO_INITDB_ROOT_PASSWORD=password mongodb/mongodb-community-server:latest
docker run -d -p 21:21 -p 21000-21010:21000-21010 -e USERS='user|password' delfer/alpine-ftp-server
# the docker image is relatively unstable. Alternatively, refer to official guide of OpenTSDB to locally setup OpenTSDB env.
# http://opentsdb.net/docs/build/html/installation.html#id1
docker run -d --name gofr-opentsdb -p 4242:4242 petergrace/opentsdb-docker:latest
docker run --name gofr-mysql -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=test -p 2001:3306 -d mysql:8.0.30
docker run --name gofr-redis -p 2002:6379 -d redis:7.0.5
docker run --name gofr-solr -p 2020:8983 solr -DzkRun
docker run --name gofr-zipkin -d -p 2005:9411 openzipkin/zipkin:2
docker run --rm -it -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack
docker run --name cassandra-node -d -p 9042:9042 -v cassandra_data:/var/lib/cassandra cassandra:latest
docker run --name gofr-pgsql -d -e POSTGRES_DB=customers -e POSTGRES_PASSWORD=root123 -p 2006:5432 postgres:15.1
docker run --name gofr-mssql -d -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=reallyStrongPwd123' -p 2007:1433 mcr.microsoft.com/azure-sql-edge
docker run --name kafka-1 -p 9092:9092 \
-e KAFKA_ENABLE_KRAFT=yes \
-e KAFKA_CFG_PROCESS_ROLES=broker,controller \
-e KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER \
-e KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 \
-e KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT \
-e KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092 \
-e KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=true \
-e KAFKA_BROKER_ID=1 \
-e KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@127.0.0.1:9093 \
-e ALLOW_PLAINTEXT_LISTENER=yes \
-e KAFKA_CFG_NODE_ID=1 \
-v kafka_data:/bitnami \
bitnami/kafka:3.4
docker pull scylladb/scylla
docker run --name scylla -d -p 2025:9042 scylladb/scylla
docker run -d --name nats-server -p 4222:4222 -p 8222:8222 nats:latest -js
docker pull surrealdb/surrealdb:latest
docker run --name surrealdb -d -p 8000:8000 surrealdb/surrealdb:latest start --bind 0.0.0.0:8000
docker run -d --name arangodb \
-p 8529:8529 \
-e ARANGO_ROOT_PASSWORD=rootpassword \
--pull always \
arangodb:latest
docker run --name dynamodb-local -d -p 8000:8000 amazon/dynamodb-local
docker run -d --name db -p 8091-8096:8091-8096 -p 11210-11211:11210-11211 couchbase
docker login container-registry.oracle.com
docker pull container-registry.oracle.com/database/free:latest
docker run -d --name oracle-free -p 1521:1521 -e ORACLE_PWD=YourPasswordHere container-registry.oracle.com/database/free:latest
docker run -it --rm -p 4443:4443 -e STORAGE_EMULATOR_HOST=0.0.0.0:4443 fsouza/fake-gcs-server:latest
```
> [!NOTE]
> Please note that the recommended local port for the services are different from the actual ports. This is done to avoid conflict with the local installation on developer machines. This method also allows a developer to work on multiple projects which uses the same services but bound on different ports. One can choose to change the port for these services. Just remember to add the same in configs/.local.env, if you decide to do that.
### Coding Guidelines
* Use only what is given to you as part of function parameter or receiver. No globals. Inject all dependencies including
DB, Logger etc.
* No magic. So, no init. In a large project, it becomes difficult to track which package is doing what at the
initialization step.
* Exported functions must have an associated godoc.
* Sensitive data(username, password, keys) should not be pushed. Always use environment variables.
* Take interfaces and return concrete types.
- Lean interfaces - take 'exactly' what you need, not more. Onus of interface definition is on the package who is
using it. so, it should be as lean as possible. This makes it easier to test.
- Be careful of type assertions in this context. If you take an interface and type assert to a type - then it's
similar to taking concrete type.
* Uses of context:
- We should use context as a first parameter.
- Can not use string as a key for the context. Define your own type and provide context accessor method to avoid
conflict.
* External Library uses:
- A little copying is better than a little dependency.
- All external dependencies should go through the same careful consideration, we would have done to our own written
code. We need to test the functionality we are going to use from an external library, as sometimes library
implementation may change.
- All dependencies must be abstracted as an interface. This will make it easier to switch libraries at later point
of time.
* Version tagging as per Semantic versioning (https://semver.org/)
### Documentation
* After adding or modifying existing code, update the documentation too - [development/docs](https://github.com/gofr-dev/gofr/tree/development/docs).
* When you consider a new documentation page is needed, start by adding a new file and writing your new documentation. Then - add a reference to it in [navigation.js](https://gofr.dev/docs/navigation.js).
* If needed, update or add proper code examples for your changes.
* In case images are needed, add it to [docs/public](./docs/public) folder.
* Make sure you don't break existing links and references.
* Maintain Markdown standards, you can read more [here](https://www.markdownguide.org/basic-syntax/), this includes:
- Headings (`#`, `##`, etc.) should be placed in order.
- Use trailing white space or the <br> HTML tag at the end of the line.
- Use "`" sign to add single line code and "```" to add multi-line code block.
- Use relative references to images (in `public` folder as mentioned above.)
* The [gofr.dev documentation](https://gofr.dev/docs) site is updated upon push to `/docs` path in the repo. Verify your changes are live after next GoFr version.
================================================
FILE: Dockerfile
================================================
FROM golang:1.24
RUN mkdir -p /go/src/gofr.dev
WORKDIR /go/src/gofr.dev
COPY . .
RUN go build -ldflags "-linkmode external -extldflags -static" -a examples/http-server/main.go
FROM alpine:latest
RUN apk add --no-cache tzdata ca-certificates
COPY --from=0 /go/src/gofr.dev/main /main
EXPOSE 8000
CMD ["/main"]
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
<div align="center">
<h1 style="font-size: 100px; font-weight: 500;">
<i>Go</i>Fr
</h1>
<div align="center">
<p>
<img width="300" alt="logo" src="https://github.com/gofr-dev/gofr/assets/44036979/916fe7b1-42fb-4af1-9e0b-4a7a064c243c">
<h2 style="font-size: 28px;"><b>GoFr: An Opinionated Microservice Development Framework</b></h2>
</p>
<a href="https://pkg.go.dev/gofr.dev"><img src="https://img.shields.io/badge/GoDoc-Read%20Documentation-blue?style=for-the-badge" alt="godoc"></a>
<a href="https://gofr.dev/docs"><img src="https://img.shields.io/badge/GoFr-Docs-orange?style=for-the-badge" alt="gofr-docs"></a>
<a href="https://qlty.sh/gh/gofr-dev/projects/gofr"><img src="https://qlty.sh/gh/gofr-dev/projects/gofr/maintainability.svg" alt="Maintainability" height="27.99" /></a>
<a href="https://qlty.sh/gh/gofr-dev/projects/gofr"><img src="https://qlty.sh/gh/gofr-dev/projects/gofr/coverage.svg" alt="Code Coverage" height="27.99" /></a>
<a href="https://goreportcard.com/report/gofr.dev"><img src="https://goreportcard.com/badge/gofr.dev?style=for-the-badge" alt="Go Report Card"></a>
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache_2.0-blue?style=for-the-badge" alt="Apache 2.0 License"></a>
<a href="https://discord.gg/wsaSkQTdgq"><img src="https://img.shields.io/badge/discord-join-us?style=for-the-badge&logo=discord&color=7289DA" alt="discord" /></a>
<a href="https://gurubase.io/g/gofr"><img src="https://img.shields.io/badge/Gurubase-Ask%20GoFr%20Guru-006BFF?style=for-the-badge" /></a>
</div>
<h2>Listed in the <a href="https://landscape.cncf.io/?selected=go-fr">CNCF Landscape</a></h2>
</div>
## 🎯 **Goal**
GoFr is designed to **simplify microservice development**, with key focuses on **Kubernetes deployment** and **out-of-the-box observability**. While capable of building generic applications, **microservices** remain at its core.
---
## 💡 **Key Features**
1. **Simple API Syntax**
2. **REST Standards by Default**
3. **Configuration Management**
4. **[Observability](https://gofr.dev/docs/quick-start/observability)** (Logs, Traces, Metrics)
5. **Inbuilt [Auth Middleware](https://gofr.dev/docs/advanced-guide/http-authentication)** & Custom Middleware Support
6. **[gRPC Support](https://gofr.dev/docs/advanced-guide/grpc)**
7. **[HTTP Service](https://gofr.dev/docs/advanced-guide/http-communication)** with Circuit Breaker Support
8. **[Pub/Sub](https://gofr.dev/docs/advanced-guide/using-publisher-subscriber)**
9. **[Health Check](https://gofr.dev/docs/advanced-guide/monitoring-service-health)** for All Datasources
10. **[Database Migration](https://gofr.dev/docs/advanced-guide/handling-data-migrations)**
11. **[Cron Jobs](https://gofr.dev/docs/advanced-guide/using-cron)**
12. **Support for [Changing Log Level](https://gofr.dev/docs/advanced-guide/remote-log-level-change) Without Restarting**
13. **[Swagger Rendering](https://gofr.dev/docs/advanced-guide/swagger-documentation)**
14. **[Abstracted File Systems](https://gofr.dev/docs/advanced-guide/handling-file)**
15. **[Websockets](https://gofr.dev/docs/advanced-guide/websocket)**
---
## 🚀 **Getting Started**
### **Prerequisites**
- GoFr requires **[Go](https://go.dev/)** version **[1.24](https://go.dev/doc/devel/release#go1.24.0)** or above.
### **Installation**
To get started with GoFr, add the following import to your code and use Go’s module support to automatically fetch dependencies:
```go
import "gofr.dev/pkg/gofr"
```
Alternatively, use the command:
```bash
go get -u gofr.dev/pkg/gofr
```
---
## 🏃 **Running GoFr**
Here's a simple example to get a GoFr application up and running:
```go
package main
import "gofr.dev/pkg/gofr"
func main() {
app := gofr.New()
app.GET("/greet", func(ctx *gofr.Context) (any, error) {
return "Hello World!", nil
})
app.Run() // listens and serves on localhost:8000
}
```
To run this code:
```bash
$ go run main.go
```
Visit [`localhost:8000/greet`](http://localhost:8000/greet) to see the result.
---
## 📂 **More Examples**
Explore a variety of ready-to-run examples in the [GoFr examples directory](https://github.com/gofr-dev/gofr/tree/development/examples).
---
## 👩💻 **Documentation**
- **[GoDoc](https://pkg.go.dev/gofr.dev)**: Official API documentation.
- **[GoFr Documentation](https://gofr.dev/docs)**: Comprehensive guides and resources.
---
## 👍 **Contribute**
Join Us in Making GoFr Better
**Share your experience**: If you’ve found GoFr helpful, consider writing a review or tutorial on platforms like **[Medium](https://medium.com/)**, **[Dev.to](https://dev.to/)**, or your personal blog.
Your insights could help others get started faster!
**Contribute to the project**: Want to get involved? Check out our **[CONTRIBUTING.md](CONTRIBUTING.md)**
guide to learn how you can contribute code, suggest improvements, or report issues.
---
## 🔒 **Secure Cloning**
To securely clone the GoFr repository, you can use HTTPS or SSH:
### Cloning with HTTPS
```bash
git clone https://github.com/gofr-dev/gofr.git
```
### Cloning with SSH
```bash
git clone git@github.com:gofr-dev/gofr.git
```
### 🎁 **Get a GoFr T-Shirt & Stickers!**
If your PR is merged, or if you contribute by writing articles or promoting GoFr, we invite you to fill out [this form](https://forms.gle/R1Yz7ZzY3U5WWTgy5) to claim your GoFr merchandise as a token of our appreciation!
### Partners
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.png" alt="JetBrains logo" width="200">
================================================
FILE: SECURITY.md
================================================
# Security Policy
## Supported Versions
Following versions are being supported for security updates.
| Version | Supported |
| ------- | ------------------ |
| 1.0.x | :white_check_mark: |
## Reporting a Vulnerability
To report a vulnerability, please file an issue on this repo and add "security" label. Security related issues will be prioritized over others. We strive to triage the issue within a single working day.
================================================
FILE: docs/Dockerfile
================================================
FROM ghcr.io/gofr-dev/website:latest AS builder
WORKDIR /app
COPY docs/quick-start /app/src/app/docs/quick-start
COPY docs/public/ /app/public
COPY docs/advanced-guide /app/src/app/docs/advanced-guide
COPY docs/datasources /app/src/app/docs/datasources
COPY docs/references /app/src/app/docs/references
COPY docs/page.md /app/src/app/docs
COPY docs/navigation.js /app/src/lib
COPY docs/events.json /app/src/app/events
COPY docs/testimonials.json /app/utils
ENV NODE_ENV=production
RUN npm install
RUN npm run build
# Stage 2: Serve with Static Server
FROM zopdev/static-server:v0.0.5
# Copy static files from the builder stage
COPY --from=builder /app/out static
# Expose the port server is running on
EXPOSE 8000
# Start go server
CMD ["/main"]
================================================
FILE: docs/advanced-guide/authentication/page.md
================================================
# Authentication
Authentication is a crucial aspect of web applications, controlling access to resources based on user roles or permissions.
It is the process of verifying a user's identity to grant access to protected resources. It ensures that only authenticated
users can perform actions or access data within an application.
GoFr offers a **Unified Authentication** model, meaning that once you enable an authentication method, it automatically
applies to both your HTTP and gRPC services.
## Exempted Paths
By default, the authentication middleware exempts the following paths from authentication:
- `/.well-known/alive`: Used for liveness probes, should be publicly accessible for health checks.
The health check endpoint `/.well-known/health` is exempted by default, but as it may contain sensitive information about the service and its dependencies, it is recommended to require authentication for it.
## 1. Basic Auth
*Basic Authentication* is a simple authentication scheme where the user's credentials (username and password) are
transmitted in the request header in a Base64-encoded format.
Basic auth is the simplest way to authenticate your APIs. It's built on
{% new-tab-link title="HTTP protocol authentication scheme" href="https://datatracker.ietf.org/doc/html/rfc7617" /%}.
It involves sending the prefix `Basic` trailed by the Base64-encoded `<username>:<password>` within the standard `Authorization` header.
### Usage in GoFr
GoFr offers two ways to implement basic authentication:
**1. Predefined Credentials**
Use `EnableBasicAuth(username, password)` to configure GoFr with pre-defined credentials.
```go
func main() {
app := gofr.New()
app.EnableBasicAuth("admin", "secret_password") // Replace with your credentials
app.GET("/protected-resource", func(c *gofr.Context) (any, error) {
return "Success", nil
})
app.Run()
}
```
**2. Custom Validation Function**
Use `EnableBasicAuthWithValidator(validationFunc)` to implement your own validation logic for credentials.
The `validationFunc` takes the username and password as arguments and returns true if valid, false otherwise.
```go
func validateUser(c *container.Container, username, password string) bool {
// Implement your credential validation logic here
return username == "john" && password == "doe123"
}
func main() {
app := gofr.New()
app.EnableBasicAuthWithValidator(validateUser)
app.Run()
}
```
## 2. API Keys Auth
*API Key Authentication* is an authentication scheme where a unique API key is included in the request header `X-Api-Key` for validation against a store of authorized keys.
### Usage in GoFr
GoFr offers two ways to implement API Keys authentication.
**1. Framework Default Validation**
- GoFr's default validation can be selected using **_EnableAPIKeyAuth(apiKeys ...string)_**
```go
func main() {
app := gofr.New()
app.EnableAPIKeyAuth("9221e451-451f-4cd6-a23d-2b2d3adea9cf", "0d98ecfe-4677-48aa-b463-d43505766915")
app.Run()
}
```
**2. Custom Validation Function**
- GoFr allows a custom validator function for validating APIKeys using **_EnableAPIKeyAuthWithValidator(validator)_**
```go
func apiKeyValidator(c *container.Container, apiKey string) bool {
validKeys := []string{"f0e1dffd-0ff0-4ac8-92a3-22d44a1464e4"}
return slices.Contains(validKeys, apiKey)
}
func main() {
app := gofr.New()
app.EnableAPIKeyAuthWithValidator(apiKeyValidator)
app.Run()
}
```
## 3. OAuth 2.0
{% new-tab-link title="OAuth" href="https://www.rfc-editor.org/rfc/rfc6749" /%} 2.0 is the industry-standard protocol for authorization.
It involves sending the prefix `Bearer` trailed by the encoded token within the standard `Authorization` header.
### Usage in GoFr
Enable OAuth 2.0 to authenticate requests. Use `EnableOAuth(jwks-endpoint, refresh_interval, options ...jwt.ParserOption)` to configure GoFr.
```go
func main() {
app := gofr.New()
app.EnableOAuth("http://jwks-endpoint", 3600)
app.Run()
}
```
### Available JWT Claim Validations
- **Expiration (`exp`)**: Validated by default if present. Use `jwt.WithExpirationRequired()` to make it mandatory.
- **Audience (`aud`)**: `jwt.WithAudience("https://api.example.com")`
- **Issuer (`iss`)**: `jwt.WithIssuer("https://auth.example.com")`
- **Subject (`sub`)**: `jwt.WithSubject("user@example.com")`
## Accessing Auth Info in Handlers
Once authenticated, you can retrieve the authentication information from the context using the `GetAuthInfo()` method. This works identically for both HTTP and gRPC handlers.
```go
func MyHandler(ctx *gofr.Context) (any, error) {
authInfo := ctx.GetAuthInfo()
// For Basic Auth
username := authInfo.GetUsername()
// For API Key
apiKey := authInfo.GetAPIKey()
// For OAuth
claims := authInfo.GetClaims()
if claims != nil {
// Access specific claims (typecasting is required for specific claim values)
userID := claims["sub"].(string)
}
return "Success", nil
}
```
## Security Best Practices
* **Timing Attacks**: GoFr's Basic Auth and API Key interceptors use `subtle.ConstantTimeCompare` to prevent timing attacks.
* **TLS**: Always use TLS in production to encrypt the authentication credentials and tokens transmitted over the network.
================================================
FILE: docs/advanced-guide/building-cli-applications/page.md
================================================
# Building CLI Applications
GoFr provides a simple way to build command-line applications using `app.NewCMD()`. This creates standalone CLI tools without starting an HTTP server.
## Configuration
To configure logging for CLI applications, set the following environment variable:
- `CMD_LOGS_FILE`: The file path where CLI logs will be written. If not set, logs are discarded.
## Getting Started
Create a basic CLI application with subcommands:
```go
package main
import (
"fmt"
"gofr.dev/pkg/gofr"
)
func main() {
app := gofr.NewCMD()
// Simple hello command
app.SubCommand("hello", func(c *gofr.Context) (any, error) {
return "Hello World!", nil
}, gofr.AddDescription("Print hello message"))
// Command with parameters
app.SubCommand("greet", func(c *gofr.Context) (any, error) {
name := c.Param("name")
if name == "" {
name = "World"
}
return fmt.Sprintf("Hello, %s!", name), nil
})
app.Run()
}
```
## Key GoFr CLI Methods
- **`app.NewCMD()`**: Initialize a CLI application
- **`app.SubCommand(name, handler, options...)`**: Add a subcommand
- **`gofr.AddDescription(desc)`**: Add help description
- **`gofr.AddHelp(help)`**: Add detailed help text
- **`ctx.Param(name)`**: Get command parameters
- **`ctx.Out.Println()`**: Print to stdout
- **`ctx.Logger`**: Access logging
## Running CLI Applications
Build and run your CLI:
```bash
go build -o mycli
./mycli hello
./mycli greet --name John
./mycli --help
```
## Example Commands
```bash
# Basic command
./mycli hello
# Output: Hello World!
# Command with parameter
./mycli greet --name Alice
# Output: Hello, Alice!
# Help
./mycli --help
```
For more details, see the [sample-cmd example](../../../examples/sample-cmd).
================================================
FILE: docs/advanced-guide/circuit-breaker/page.md
================================================
# Circuit Breaker in HTTP Communication
Calls to remote resources and services can fail due to temporary issues like slow network connections or timeouts, service unavailability. While transient faults can be mitigated using the "Retry pattern", there are cases where continual retries are futile, such as during severe service failures.
In such scenarios, it's crucial for applications to recognize when an operation is unlikely to succeed and handle the failure appropriately rather than persistently retrying. Indiscriminate use of HTTP retries can even lead to unintentional denial-of-service attacks within the software itself, as multiple clients may flood a failing service with retry attempts.
To prevent this, a defense mechanism like the circuit breaker pattern is essential. Unlike the "Retry pattern" which aims to eventually succeed, the circuit breaker pattern focuses on preventing futile operations. While these patterns can be used together, it's vital for the retry logic to be aware of the circuit breaker's feedback and cease retries if the circuit breaker indicates a non-transient fault.
GoFr inherently provides the functionality, it can be enabled by passing circuit breaker configs as options to `AddHTTPService()` method.
## How It Works:
The circuit breaker tracks consecutive failed requests for a downstream service.
- **Threshold:** The number of consecutive failed requests after which the circuit breaker transitions to an open state. While open, all requests to that service will fail immediately without making any actual outbound calls, effectively preventing request overflow to an already failing service.
- **Interval:** Once the circuit is open, GoFr starts a background goroutine that periodically checks the health of the service by making requests to its aliveness endpoint (by default: `/.well-known/alive`) at the specified interval. When the service is deemed healthy again, the circuit breaker transitions directly from **Open** to **Closed**, allowing requests to resume.
> GoFr's circuit breaker implementation does not use a **Half-Open** state. Instead, it relies on periodic asynchronous health checks to determine service recovery.
## Failure Conditions
The Circuit Breaker counts a request as "failed" if:
1. An error occurs during the HTTP request (e.g., network timeout, connection refused).
2. The response status code is **greater than 500** (e.g., 502, 503, 504).
> **Note:** HTTP 500 Internal Server Error is **NOT** counted as a failure for the circuit breaker. This distinguishes between application bugs (500) and service availability issues (> 500).
## Health Check Requirement
For the Circuit Breaker to recover from an **Open** state, the downstream service **must** expose a health check endpoint that returns a `200 OK` status code.
- **Default Endpoint:** `/.well-known/alive`
- **Custom Endpoint:** Can be configured using `service.HealthConfig`.
> [!WARNING]
> If the downstream service does not have a valid health check endpoint (returns 404 or other errors), the Circuit Breaker will **never recover** and will remain permanently Open. Ensure your services implement the health endpoint correctly.
## Interaction with Retry
When using both Retry and Circuit Breaker patterns, the **order of wrapping** is critical for effective resilience:
- **Recommended: Retry as the Outer Layer**
In this configuration, the `Retry` layer wraps the `Circuit Breaker`. Every single retry attempt is tracked by the circuit breaker. If a request retries 5 times, the circuit breaker sees 5 failures. This allows the circuit to trip quickly during a "retry storm," protecting the downstream service from excessive load.
- **Non-Recommended: Circuit Breaker as the Outer Layer**
If the `Circuit Breaker` wraps the `Retry` layer, it only sees the **final result** of the entire retry loop. Even if a request retries 10 times internally, the circuit breaker only counts it as **1 failure**. This delays the circuit's reaction and can lead to hundreds of futile calls hitting a failing service before the breaker finally trips.
> [!IMPORTANT]
> Always ensure `Retry` is the outer layer by providing the `CircuitBreakerConfig` **before** the `RetryConfig` in the `AddHTTPService` options.
> NOTE: Retries only occur when the target service responds with a status code > 500 (e.g., 502 Bad Gateway, 503 Service Unavailable). 500 Internal Server Error and client errors (4xx) are considered non-transient or bug-related and will not trigger retries.
## Usage
```go
package main
import (
"time"
"gofr.dev/pkg/gofr"
"gofr.dev/pkg/gofr/service"
)
func main() {
// Create a new application
app := gofr.New()
app.AddHTTPService("order", "https://order-func",
&service.CircuitBreakerConfig{
// Number of consecutive failed requests after which circuit breaker will be enabled
Threshold: 4,
// Time interval at which circuit breaker will hit the health endpoint.
Interval: 1 * time.Second,
},
)
app.GET("/order", Get)
// Run the application
app.Run()
}
```
Circuit breaker state changes to open when number of consecutive failed requests increases the threshold.
When it is in open state, GoFr makes request to the health endpoint (default being - /.well-known/alive, or the custom endpoint if configured) at an equal interval of time provided in config.
GoFr publishes the following metric to track circuit breaker state:
- `app_http_circuit_breaker_state`: Current state of the circuit breaker (0 for Closed, 1 for Open). This metric is used to visualize a historical timeline of circuit transitions on the dashboard.
> ##### Check out the example of an inter-service HTTP communication along with circuit-breaker in GoFr: [Visit GitHub](https://github.com/gofr-dev/gofr/blob/main/examples/using-http-service/main.go)
================================================
FILE: docs/advanced-guide/custom-spans-in-tracing/page.md
================================================
# Custom Spans In Tracing
GoFr's built-in tracing provides valuable insights into application's behavior. However, sometimes we might need
even more granular details about specific operations within your application. This is where `custom spans` can be used.
## How it helps?
By adding custom spans in traces to our requests, we can:
- **Gain granular insights:** Custom spans allows us to track specific operations or functions within your application,
providing detailed performance data.
- **Identify bottlenecks:** Analyzing custom spans helps to pinpoint areas of your code that may be causing
performance bottlenecks or inefficiencies.
- **Improve debugging:** Custom spans enhance the ability to debug issues by providing visibility into the execution
flow of an application.
## Usage
To add a custom trace to a request, GoFr context provides `Trace()` method, which takes the name of the span as an argument
and returns a trace.Span.
```go
func MyHandler(c context.Context) error {
span := c.Trace("my-custom-span")
defer span.Close()
// Do some work here
return nil
}
```
In this example, **my-custom-span** is the name of the custom span that is added to the request.
The defer statement ensures that the span is closed even if an error occurs to ensure that the trace is properly recorded.
> ##### Check out the example of creating a custom span in GoFr: [Visit GitHub](https://github.com/gofr-dev/gofr/blob/main/examples/http-server/main.go#L58)
================================================
FILE: docs/advanced-guide/dealing-with-sql/page.md
================================================
# Dealing with SQL
GoFr simplifies the process of connecting to SQL databases where one needs to add respective configs in .env,
which allows connecting to different SQL dialects(MySQL, PostgreSQL, SQLite) without going into complexity of configuring connections.
With GoFr, connecting to different SQL databases is as straightforward as setting the DB_DIALECT environment variable to the respective dialect.
## Usage for PostgreSQL and MySQL
To connect with PostgreSQL, set `DB_DIALECT` to `postgres`. Similarly, To connect with MySQL, simply set `DB_DIALECT` to `mysql`.
```dotenv
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=root123
DB_NAME=test_db
DB_PORT=3306
DB_DIALECT=postgres
```
## Usage for SQLite
To connect with SQLite, set `DB_DIALECT` to `sqlite` and `DB_NAME` to the name of your DB File. If the DB file already exists then it will be used otherwise a new one will be created.
```dotenv
DB_NAME=test.db
DB_DIALECT=sqlite
```
## Setting Max open and Idle Connections
To set max open and idle connection for any MySQL, PostgreSQL, SQLite.
Add the following configs in `.env` file.
```dotenv
DB_MAX_IDLE_CONNECTION=5 // Default 2
DB_MAX_OPEN_CONNECTION=5 // Default unlimited
```
> ##### Check out the example on how to add configuration for SQL in GoFr: [Visit GitHub](https://github.com/gofr-dev/gofr/blob/main/examples/http-server/configs/.env)
================================================
FILE: docs/advanced-guide/debugging/page.md
================================================
# Using `pprof` in GoFr Applications
In GoFr applications, `pprof` profiling is automatically enabled. The profiling endpoints are served on the `METRICS_PORT`, which defaults to `2121` if not specified.
This guide explains how to enable and use `pprof` in GoFr applications.
---
## Enabling `pprof` in GoFr
### Prerequisites
Ensure the `METRICS_PORT` is set (default is `2121`):
```bash
METRICS_PORT=2121
```
GoFr automatically registers the following `pprof` routes:
- `/debug/pprof/cmdline`
- `/debug/pprof/profile`
- `/debug/pprof/symbol`
- `/debug/pprof/trace`
- `/debug/pprof/` (index)
---
## Accessing `pprof` Endpoints
Once `pprof` is enabled, you can access the profiling endpoints at `http://localhost:<METRICS_PORT>/debug/pprof/`. For example, if `METRICS_PORT` is `2121`, the endpoints will be available at:
- `http://localhost:2121/debug/pprof/`
### Available Endpoints
1. **`/debug/pprof/cmdline`**:
- Returns the command-line arguments of the running application.
2. **`/debug/pprof/profile`**:
- Generates a CPU profile for the application.
3. **`/debug/pprof/symbol`**:
- Resolves program counters into function names.
4. **`/debug/pprof/trace`**:
- Captures an execution trace of the application.
5. **`/debug/pprof/` (index)**:
- Provides an index page with links to all available profiling endpoints, including memory, goroutine, and blocking profiles.
---
## Collecting Profiling Data
### 1. **CPU Profiling**
To collect a CPU profile:
```bash
curl -o cpu.pprof http://localhost:2121/debug/pprof/profile
```
### 2. **Memory Profiling**
To collect a memory profile:
```bash
curl -o mem.pprof http://localhost:2121/debug/pprof/heap
```
### 3. **Goroutine Profiling**
To collect information about running goroutines:
```bash
curl -o goroutine.pprof http://localhost:2121/debug/pprof/goroutine
```
### 4. **Execution Trace**
To collect an execution trace:
```bash
curl -o trace.out http://localhost:2121/debug/pprof/trace
```
---
## Analyzing Profiling Data
### 1. Using go tool pprof
To analyze CPU, memory, or goroutine profiles:
```bash
go tool pprof <profile_file>
```
#### **`top`**
Shows the functions consuming the most resources (e.g., CPU or memory).
```bash
go tool pprof cpu.pprof
(pprof) top
```
#### **`list`**
Displays the source code of a specific function, along with resource usage.
```bash
(pprof) list <function_name>
```
Example:
```bash
(pprof) list main.myFunction
```
#### **`web`**
Generates a visual representation of the profile in your browser. This requires Graphviz to be installed.
```bash
(pprof) web
```
### 2. Using go tool trace
To analyze execution traces:
```bash
go tool trace trace.out
```
---
## Example Workflow
1. **Set Environment Variables**:
```bash
METRICS_PORT=2121
```
2. **Run Your GoFr Application**:
```bash
go run main.go
```
3. **Collect Profiling Data**:
- Collect a CPU profile:
```bash
curl -o cpu.pprof http://localhost:2121/debug/pprof/profile
```
- Collect a memory profile:
```bash
curl -o mem.pprof http://localhost:2121/debug/pprof/heap
```
4. **Analyze the Data**:
- Analyze the CPU profile:
```bash
go tool pprof cpu.pprof
(pprof) top
(pprof) list main.myFunction
(pprof) web
```
- Analyze the memory profile:
```bash
go tool pprof mem.pprof
(pprof) top
(pprof) list main.myFunction
(pprof) web
```
---
## References
- [Go `pprof` Documentation](https://pkg.go.dev/net/http/pprof)
- [Profiling Go Programs](https://blog.golang.org/profiling-go-programs)
- [Go Execution Tracer](https://golang.org/doc/diagnostics.html#tracing)
================================================
FILE: docs/advanced-guide/gofr-errors/page.md
================================================
# Error Handling
GoFr provides a structured error handling approach to simplify error management in your applications.
The errors package in GoFr provides functionality for handling errors in GoFr applications. It includes predefined HTTP
and database errors, as well as the ability to create custom errors with additional context.
## Pre-defined HTTP Errors
GoFr's `http` package offers several predefined error types to represent common HTTP error scenarios. These errors
automatically handle HTTP status code selection. These include:
{% table %}
- Error Type
- Description
- Status Code
---
- `ErrorInvalidParam`
- Represents an error due to an invalid parameter
- 400 (Bad Request)
---
- `ErrorMissingParam`
- Represents an error due to a missing parameter
- 400 (Bad Request)
---
- `ErrorEntityNotFound`
- Represents an error due to a not found entity
- 404 (Not Found)
---
- `ErrorEntityAlreadyExist`
- Represents an error due to creation of duplicate entity
- 409 (Conflict)
---
- `ErrorInvalidRoute`
- Represents an error for invalid route
- 404 (Not Found)
---
- `ErrorRequestTimeout`
- Represents an error for request which timed out
- 408 (Request Timeout)
---
- `ErrorPanicRecovery`
- Represents an error for request which panicked
- 500 (Internal Server Error)
{% /table %}
#### Usage:
To use the predefined HTTP errors, users need to import the GoFr http package and can simply call them:
```go
import "gofr.dev/pkg/gofr/http"
err := http.ErrorMissingParam{Params: []string{"id"}}
```
## Database Errors
Database errors in GoFr, represented in the `datasource` package, encapsulate errors related to database operations such
as database connection, query failure, availability etc. The `ErrorDB` struct can be used to populate `error` as well as
any custom message to it. **Status Code: 500 (Internal Server Error)**
#### Usage:
```go
import "gofr.dev/pkg/gofr/datasource"
// Creating a custom error wrapped in underlying error for database operations
dbErr := datasource.ErrorDB{Err: err, Message: "error from sql db"}
// Adding stack trace to the error
dbErr = dbErr.WithStack()
// Creating a custom error only with error message and no underlying error.
dbErr2 := datasource.ErrorDB{Message : "database connection timed out!"}
```
## Custom Errors
GoFr's error structs implements an interface with `Error() string` and `StatusCode() int` methods, users can override the
status code by implementing it for their custom error.
Users can optionally define a log level for your error with the `LogLevel() logging.Level` methods
#### Usage:
```go
type customError struct {
error string
}
func (c customError) Error() string {
return fmt.Sprintf("custom error: %s", c.error)
}
func (c customError) StatusCode() int {
return http.StatusMethodNotAllowed
}
func (c customError) LogLevel() logging.Level {
return logging.WARN
}
```
## Extended Error Responses
For [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457.html) style error responses with additional fields, implement the ResponseMarshaller interface:
```go
type ResponseMarshaller interface {
Response() map[string]any
}
```
#### Usage:
```go
type ValidationError struct {
Field string
Message string
Code int
}
func (e ValidationError) Error() string { return e.Message }
func (e ValidationError) StatusCode() int { return e.Code }
func (e ValidationError) Response() map[string]any {
return map[string]any{
"field": e.Field,
"type": "validation_error",
"details": "Invalid input format",
}
}
```
> [!NOTE]
> The `message` field is automatically populated from the `Error()` method. Custom fields with the name "message" in the `Response()` map should not be used as they will be ignored in favor of the `Error()` value.
================================================
FILE: docs/advanced-guide/graphql/page.md
================================================
# GraphQL in GoFr
GoFr provides a **Schema-First** approach to building GraphQL APIs. This means you define your API contract in a standard GraphQL schema file, and GoFr handles the execution, validation, and observability.
## Required Setup
To enable GraphQL, you MUST provide a schema file at the following location:
`./configs/schema.graphqls`
> **Note:** GoFr uses a single schema file. All Query and Mutation types must be defined in this one file.
> You can register multiple resolvers (one per field) using `GraphQLQuery` and `GraphQLMutation`, but
> they all resolve fields within this single schema.
If this file is missing or invalid, GoFr will log a fatal error and the application will fail to start. This fail-fast behavior ensures schema issues are caught at deployment rather than runtime.
## Core Concepts
### 1. [Query](https://graphql.org/learn/queries/)
Queries are used to fetch data. In GoFr, a Query resolver is a function that takes `*gofr.Context` and returns a data object (or `any`) and an error.
### 2. [Mutation](https://graphql.org/learn/queries/#mutations)
Mutations are used to modify data. They follow the same signature as Queries but are intended for side effects.
## The Unified Schema
GoFr aggregates every `GraphQLQuery` and `GraphQLMutation` you register and validates them against your `./configs/schema.graphqls`. The API is served at `/graphql`.
* **Single Endpoint**: All operations go through `POST /graphql`.
* **Playground**: Interactive documentation and testing at `/.well-known/graphql/ui`.
---
## Getting Started
### 1. Define your Schema
Create `configs/schema.graphqls`:
```graphql
type User {
id: Int
name: String
}
type Query {
user(id: Int): User
}
```
### 2. Register Resolvers
In GoFr, resolvers strictly take `*gofr.Context`. You use `c.Bind()` to extract arguments.
```go
type User struct {
ID int `json:"id"`
Name string `json:"name"`
}
func main() {
app := gofr.New()
app.GraphQLQuery("user", func(c *gofr.Context) (any, error) {
var args struct {
ID int `json:"id"`
}
if err := c.Bind(&args); err != nil {
return nil, err
}
// Return a struct - GoFr validates this against the schema at runtime
return User{
ID: args.ID,
Name: "Antigravity",
}, nil
})
app.Run()
}
```
---
## Schema-First Features
### 1. Returns `any`
Unlike standard HTTP handlers which allow `any` but lose structure, GraphQL handlers in GoFr return `any` while **maintaining the contract** defined in your `.graphqls` file.
- GoFr leverages the underlying `graphql-go` engine to validate the returned object against your defined schema.
- If the object does not match the schema types, GoFr returns an error in the `errors` array with partial data where applicable.
### 2. HTTP Status Codes
GoFr follows the standard GraphQL-over-HTTP convention by returning `200 OK` for all successfully processed requests, including those with resolver errors. This ensures that the response body is the source of truth for execution results.
| Status Code | Condition |
|---|---|
| `200 OK` | The request was processed (regardless of whether it returned data or errors). |
| `400 Bad Request` | The request body is not valid JSON. |
**Error response body**:
> **Note:** The GraphQL error format follows the [GraphQL specification](https://spec.graphql.org/October2021/#sec-Errors),
> which uses an `errors` array. This differs from GoFr's REST API format which uses a singular `error` object.
> This is intentional — each protocol follows its own standard.
```json
{
"data": null,
"errors": [
{
"message": "your error message here",
"locations": [{ "line": 1, "column": 3 }],
"path": ["fieldName"]
}
]
}
```
### 3. Argument Binding
Instead of declarative arguments in the function signature, you use the standard `c.Bind()` method. GoFr automatically maps the GraphQL `args` map to your struct using JSON tags.
### 4. Supported Types
GoFr supports all standard GraphQL types including scalars, objects, enums, and input types. For a complete reference on the GraphQL type system, see the [official GraphQL documentation](https://graphql.org/learn/schema/).
---
## Testing Your GraphQL API
### 1. Interactive Exploration
GoFr automatically hosts a **GraphQL Playground** at `/.well-known/graphql/ui` when GraphQL resolvers are registered.
### 2. Standard POST Requests
The `/graphql` endpoint accepts a JSON body with the following fields:
| Field | Type | Description |
|---|---|---|
| `query` | `string` | **Required.** The GraphQL query or mutation string. |
| `operationName` | `string` | Optional. The name of the operation to execute (used for metrics tagging). |
| `variables` | `object` | Optional. A map of variable values for the query. |
**Simple query:**
```bash
curl -X POST \
-H "Content-Type: application/json" \
-d '{"query": "{ user(id: 1) { name } }"}' \
http://localhost:9091/graphql
```
**Named operation with variables:**
```bash
curl -X POST \
-H "Content-Type: application/json" \
-d '{"query": "query GetUser($id: Int) { user(id: $id) { name } }", "operationName": "GetUser", "variables": {"id": 1}}' \
http://localhost:9091/graphql
```
---
## Observability
GoFr provides production-grade observability for GraphQL out of the box.
### 1. Tracing
GoFr automatically instruments your GraphQL API with OpenTelemetry traces:
- **Root Span**: Every request generates a `graphql-request` span.
- **Resolver Spans**: Each individual resolver call generates a nested span (e.g., `graphql-resolver-user`), allowing you to see the exact time spent in each field's business logic.
- **Attributes**: The `graphql.operation_name` and `graphql.operation_type` (query/mutation) are automatically added to the spans.
### 2. Metrics
GoFr exports several GraphQL-specific metrics, all tagged by `operation_name`, `type` (query/mutation), and `status` (success/error):
- **`app_graphql_operations_total`**: Total number of GraphQL operations received.
- **`app_graphql_error_total`**: Total operations that resulted in an error (resolver error or validation failure).
- **`app_graphql_request_duration`**: Histogram of the entire request lifecycle in seconds.
> **Note:** The `operation_name` tag is sourced from the `operationName` field in the POST body. For anonymous operations, it defaults to `"unknown"`. GraphQL requests are only recorded by the GraphQL-specific metrics above — they are excluded from `app_http_response` to avoid double-counting.
---
## Monitoring and Health Checks
### 1. Health Checks
Even when building a GraphQL-first application, GoFr's standard **RESTful health check endpoints** remain the primary way to monitor service availability. These are automatically registered and publicly accessible:
- **Aliveness**: `/.well-known/alive` (Returns `200 OK` if the server is running)
- **Health**: `/.well-known/health` (Returns detailed dependency status)
GoFr does **not** inject an automatic `health` query into your GraphQL schema. This avoids redundancy and keeps your GraphQL contract focused on business logic.
### 2. Status Metric Label
While traditional HTTP metrics (`app_http_response`) use numerical status codes (e.g., `200`, `500`) for the `status` label, GraphQL metrics (`app_graphql_*`) use a simplified `success` or `error` value.
- **`success`**: The request was processed and returned no errors in the `errors` array.
- **`error`**: The request was processed but one or more resolvers failed (returning a `200 OK` with an `errors` array), or the request itself was invalid (e.g., `400 Bad Request`).
This distinction is important because GraphQL often returns `200 OK` even when business logic fails. The `success`/`error` label provides immediate visibility into the health of your resolvers.
---
## Design and Limitations
GoFr's GraphQL implementation is designed for simplicity and strict adherence to standards while maintaining the framework's "sane defaults" philosophy.
### 1. Why `GraphQLQuery` / `GraphQLMutation` instead of `app.POST`?
GoFr provides dedicated `GraphQLQuery` and `GraphQLMutation` methods rather than reusing `app.POST("/graphql", ...)` because the framework handles schema validation, resolver dispatch, per-field tracing, and automatic metrics internally. A raw POST handler would require you to implement all of this manually.
### 2. Why POST-only?
Per the [GraphQL-over-HTTP specification](https://github.com/graphql/graphql-over-http), all GraphQL operations (including Queries) should be performed via `POST`.
- **Security**: Preventing Queries over `GET` avoids accidentally exposing sensitive parameters in server logs or browser history.
- **Consistency**: All operations use the same interaction model, simplifying middleware and observability.
### 3. Why only Query and Mutation?
Currently, GoFr supports the two most common operation types:
- **Query**: For read-only data fetching.
- **Mutation**: For operations that cause side effects.
**Subscriptions** (real-time updates) are currently not supported as they require a persistent stateful connection (like WebSockets), which deviates from the stateless, request-response model of GoFr's standard HTTP handlers.
### 4. Single Schema File
GoFr enforces a single `./configs/schema.graphqls` file to ensure a "Single Source of Truth" for your API contract. While you can register many resolvers, they must all belong to this single unified schema. This prevents fragmentation and makes the API easier to document and maintain.
---
## Best Practices
1. **Keep Schema and Logic in sync**: Since the schema is defined in a separate file, ensure field names in your Go maps/structs match the field names in `schema.graphqls`.
2. **Use c.Bind()**: Always use `c.Bind()` for accessing arguments to benefit from GoFr's internal mapping and validation.
3. **Error Handling**: Return errors from your handlers. GoFr will include them in the `errors` array of the GraphQL response while still returning `200 OK`.
4. **Name your operations**: Use `operationName` in your requests so that metrics are tagged meaningfully (e.g., `GetUser` instead of `unknown`).
================================================
FILE: docs/advanced-guide/grpc/page.md
================================================
# gRPC with Gofr
We have already seen how GoFr can help ease the development of HTTP servers, but there are cases where performance is primarily required sacrificing flexibility. In these types of scenarios gRPC protocol comes into picture. {% new-tab-link title="gRPC" href="https://grpc.io/docs/what-is-grpc/introduction/" /%} is an open-source RPC(Remote Procedure Call) framework initially developed by Google.
GoFr streamlines the creation of gRPC servers and clients with unified GoFr's context support.
It provides built-in tracing, metrics, and logging to ensure seamless performance monitoring for both gRPC servers and inter-service gRPC communication.
With GoFr's context, you can seamlessly define custom metrics and traces across gRPC handlers, ensuring consistent observability and streamlined debugging throughout
your system. Additionally, GoFr provides a built-in health check for all your services and supports inter-service
health checks, allowing gRPC services to monitor each other effortlessly.
## Prerequisites
**1. Protocol Buffer Compiler (`protoc`) Installation:**
- **Linux (using `apt` or `apt-get`):**
```bash
sudo apt install -y protobuf-compiler
protoc --version # Ensure compiler version is 3+
```
- **macOS (using Homebrew):**
```bash
brew install protobuf
protoc --version # Ensure compiler version is 3+
```
**2. Go Plugins for Protocol Compiler:**
a. Install protocol compiler plugins for Go:
```bash
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
```
b. Update `PATH` for `protoc` to locate the plugins:
```bash
export PATH="$PATH:$(go env GOPATH)/bin"
```
## Creating Protocol Buffers
For a detailed guide, refer to the official gRPC documentation's tutorial: {% new-tab-link title="Tutorial" href="https://grpc.io/docs/languages/go/basics/" /%} at official gRPC docs.
**1. Define Your Service and RPC Methods:**
Create a `.proto` file (e.g., `customer.proto`) to define your service and the RPC methods it provides:
```protobuf
// Indicates the protocol buffer version that is being used
syntax = "proto3";
// Indicates the go package where the generated file will be produced
option go_package = "path/to/your/proto/file";
service <SERVICE_NAME>Service {
rpc <SERVICE_METHOD> (<SERVICE_REQUEST>) returns (<SERVICE_RESPONSE>) {}
}
```
**2. Specify Request and Response Types:**
Users must define the type of message being exchanged between server and client, for protocol buffer to serialize them when making a remote
procedure call. Below is a generic representation for services' gRPC messages type.
```protobuf
message <SERVICE_REQUEST> {
int64 id = 1;
string name = 2;
// other fields that can be passed
}
message <SERVICE_RESPONSE> {
int64 id = 1;
string name = 2;
string address = 3;
// other customer related fields
}
```
**3. Generate Go Code:**
Run the following command to generate Go code using the Go gRPC plugins:
```bash
protoc \
--go_out=. \
--go_opt=paths=source_relative \
--go-grpc_out=. \
--go-grpc_opt=paths=source_relative \
<SERVICE_NAME>.proto
```
This command generates two files, `<SERVICE_NAME>.pb.go` and `<SERVICE_NAME>_grpc.pb.go`, containing the necessary code for performing RPC calls.
## Prerequisite: gofr-cli must be installed
To install the CLI -
```bash
go install gofr.dev/cli/gofr@latest
```
## Generating gRPC Server Handler Template using `gofr wrap grpc server`
**1. Use the `gofr wrap grpc server` Command:**
```bash
gofr wrap grpc server -proto=./path/your/proto/file
```
This command leverages the `gofr-cli` to generate a `<SERVICE_NAME>_server.go` file (e.g., `customer_server.go`)
containing a template for your gRPC server implementation, including context support, in the same directory as
that of the specified proto file.
**2. Modify the Generated Code:**
- Customize the `<SERVICE_NAME>GoFrServer` struct with required dependencies and fields.
- Implement the `<SERVICE_METHOD>` method to handle incoming requests, as required in this usecase:
- Bind the request payload using `ctx.Bind(&<SERVICE_REQUEST>)`.
- Process the request and generate a response.
## Registering the gRPC Service with Gofr
**1. Import Necessary Packages:**
```go
import (
"path/to/your/generated-grpc-server/packageName"
"gofr.dev/pkg/gofr"
)
```
**2. Register the Service in your `main.go`:**
```go
func main() {
app := gofr.New()
packageName.Register<SERVICE_NAME>ServerWithGofr(app, &<PACKAGE_NAME>.New<SERVICE_NAME>GoFrServer())
app.Run()
}
```
>Note: By default, gRPC server will run on port 9000, to customize the port users can set `GRPC_PORT` config in the .env
## Adding gRPC Server Options
To customize your gRPC server, use `AddGRPCServerOptions()`.
### Example: Enabling TLS & other ServerOptions
```go
func main() {
app := gofr.New()
// Add TLS credentials and connection timeout in one call
creds, _ := credentials.NewServerTLSFromFile("server-cert.pem", "server-key.pem")
app.AddGRPCServerOptions(
grpc.Creds(creds),
grpc.ConnectionTimeout(10 * time.Second),
)
packageName.Register<SERVICE_NAME>ServerWithGofr(app, &<PACKAGE_NAME>.New<SERVICE_NAME>GoFrServer())
app.Run()
}
```
## Adding Custom Unary Interceptors
Interceptors help in implementing authentication, validation, request transformation, and error handling.
### Example: Authentication Interceptor
```go
func main() {
app := gofr.New()
app.AddGRPCUnaryInterceptors(authInterceptor)
packageName.Register<SERVICE_NAME>ServerWithGofr(app, &<PACKAGE_NAME>.New<SERVICE_NAME>GoFrServer())
app.Run()
}
func authInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
if !isAuthenticated(ctx) {
return nil, status.Errorf(codes.Unauthenticated, "authentication failed")
}
return handler(ctx, req)
}
```
## Adding Custom Stream interceptors
For streaming RPCs (client-stream, server-stream, or bidirectional), GoFr allows you to add stream interceptors using `AddGRPCServerStreamInterceptors`. These are useful for handling logic that needs to span the entire lifetime of a stream.
```go
func main() {
app := gofr.New()
app.AddGRPCServerStreamInterceptors(streamAuthInterceptor)
// ... register your service
app.Run()
}
func streamAuthInterceptor(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
// Example: Validate metadata for the entire stream
md, ok := metadata.FromIncomingContext(ss.Context())
if !ok || !isValidToken(md["auth-token"]) {
return status.Errorf(codes.Unauthenticated, "invalid stream token")
}
// If valid, continue processing the stream
return handler(srv, ss)
}
```
For more details on adding additional interceptors and server options, refer to the [official gRPC Go package](https://pkg.go.dev/google.golang.org/grpc#ServerOption).
## Rate Limiter Interceptor for gRPC
GoFr provides built-in rate limiter interceptors for gRPC to protect your services from abuse and ensure fair resource distribution.
It uses the same token bucket algorithm and configuration as the HTTP rate limiter, applied to both unary and streaming RPCs.
### Features
- **Token Bucket Algorithm**: Allows smooth rate limiting with configurable burst capacity
- **Per-IP Rate Limiting**: Each client IP gets its own rate limit bucket (configurable)
- **Unary and Stream Support**: Separate interceptors for unary RPCs and streaming RPCs
- **Prometheus Metrics**: Track rate limit violations via `app_grpc_rate_limit_exceeded_total` counter
- **gRPC Status Code**: Returns `RESOURCE_EXHAUSTED` (gRPC code 8) with a `retry-after` metadata header when the limit is exceeded
### Configuration
```go
import (
"context"
"gofr.dev/pkg/gofr"
gofrGrpc "gofr.dev/pkg/gofr/grpc"
"gofr.dev/pkg/gofr/http/middleware"
)
func main() {
app := gofr.New()
// ctx controls the lifetime of the rate limiter's background cleanup goroutine.
// Cancelling this context stops cleanup gracefully, preventing goroutine leaks
// during rolling restarts. In production, tie this to your server's shutdown signal.
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// Configure rate limiter (shared config for both unary and stream)
cfg := middleware.RateLimiterConfig{
RequestsPerSecond: 5, // Average requests per second
Burst: 10, // Maximum burst size
PerIP: true, // Enable per-IP limiting
}
// IMPORTANT: create ONE shared store if you want a single budget
// for both unary and stream RPCs. If Store is left nil, each
// interceptor will create its own in-memory store and limits
// will be enforced independently.
store := middleware.NewMemoryRateLimiterStore(cfg)
cfg.Store = store
// Add rate limiter interceptors for gRPC
app.AddGRPCUnaryInterceptors(gofrGrpc.UnaryRateLimitInterceptor(ctx, cfg, app.Logger(), app.Metrics()))
app.AddGRPCServerStreamInterceptors(gofrGrpc.StreamRateLimitInterceptor(ctx, cfg, app.Logger(), app.Metrics()))
// Register your gRPC service
packageName.Register<SERVICE_NAME>ServerWithGofr(app, &packageName.New<SERVICE_NAME>GoFrServer())
app.Run()
}
```
> **Note**: The example above creates a single shared store so unary and stream RPCs draw from the **same** token bucket.
> If you want **independent limits** for each call type (e.g., high throughput for unary, tight limits for streams),
> omit the shared store and pass separate configs — see [Separate Limits for Unary and Stream RPCs](#separate-limits-for-unary-and-stream-rpcs) below.
> **Graceful Shutdown**: The `ctx` parameter controls the lifetime of the background cleanup goroutine that evicts expired token buckets.
> Cancel this context when the server shuts down to prevent goroutine leaks during rolling restarts.
### Parameters
The gRPC rate limiter uses the same `middleware.RateLimiterConfig` as the HTTP rate limiter:
- `RequestsPerSecond`: Average number of requests allowed per second
- `Burst`: Maximum number of requests that can be made in a burst (allows temporary spikes)
- `PerIP`: Set to `true` for per-IP limiting (recommended) or `false` for a global rate limit across all clients
- `TrustedProxies`: *(Optional)* Set to `true` to trust `X-Forwarded-For` and `X-Real-IP` gRPC metadata headers for IP extraction. Only enable when behind a trusted reverse proxy.
> **Security Warning**: Only set `TrustedProxies: true` if your application is behind a trusted reverse proxy (nginx, ALB, etc.).
> Without a trusted proxy, clients can spoof metadata headers to bypass rate limits.
### Behavior on Rate Limit Exceeded
When a client exceeds the rate limit:
1. The interceptor returns a gRPC error with status code `RESOURCE_EXHAUSTED`
2. A `retry-after` response metadata header is set, indicating how many seconds the client should wait before retrying
3. The `app_grpc_rate_limit_exceeded_total` Prometheus counter is incremented with `method` and `type` (`unary` or `stream`) labels
### Separate Limits for Unary and Stream RPCs
Unary calls and stream connections often have very different resource costs. You can pass independent configurations to each interceptor to enforce separate budgets — for example, allowing a high rate for lightweight unary calls while tightly limiting new stream connections:
```go
unaryCfg := middleware.RateLimiterConfig{
RequestsPerSecond: 100, // High throughput for lightweight unary calls
Burst: 50,
PerIP: true,
}
streamCfg := middleware.RateLimiterConfig{
RequestsPerSecond: 5, // Streams are long-lived and expensive
Burst: 3,
PerIP: true,
}
app.AddGRPCUnaryInterceptors(gofrGrpc.UnaryRateLimitInterceptor(ctx, unaryCfg, app.Logger(), app.Metrics()))
app.AddGRPCServerStreamInterceptors(gofrGrpc.StreamRateLimitInterceptor(ctx, streamCfg, app.Logger(), app.Metrics()))
```
Each config creates its own store (when `Store` is nil), so the limits are completely independent. If you instead want a **single shared budget** across both call types, create one store and assign it to both configs as shown in the [Configuration](#configuration) example above.
## Generating gRPC Client using `gofr wrap grpc client`
**1. Use the `gofr wrap grpc client` Command:**
```bash
gofr wrap grpc client -proto=./path/your/proto/file
```
This command leverages the `gofr-cli` to generate a `<SERVICE_NAME>_client.go` file (e.g., `customer_client.go`). This file must not be modified.
**2. Register the connection to your gRPC service inside your <SERVICE_METHOD> and make inter-service calls as follows :**
```go
// gRPC Handler with context support
func <SERVICE_METHOD>(ctx *gofr.Context) (*<SERVICE_RESPONSE>, error) {
// Create the gRPC client
srv, err := New<SERVICE_NAME>GoFrClient("your-grpc-server-host", ctx.Metrics())
if err != nil {
return nil, err
}
// Prepare the request
req := &<SERVICE_REQUEST>{
// populate fields as necessary
}
// Call the gRPC method with tracing/metrics enabled
res, err := srv.<SERVICE_METHOD>(ctx, req)
if err != nil {
return nil, err
}
return res, nil
}
```
## Error Handling and Validation
GoFr's gRPC implementation includes built-in error handling and validation:
**Port Validation**: Automatically validates that gRPC ports are within valid range (1-65535)
**Port Availability**: Checks if the specified port is available before starting the server
**Server Creation**: Validates server creation and provides detailed error messages
**Container Injection**: Validates container injection into gRPC services with detailed logging
Port Configuration
```bash
// Set custom gRPC port in .env file
GRPC_PORT=9001
// Or use default port 9000 if not specified
```
## gRPC Reflection
GoFr supports gRPC reflection for easier debugging and testing. Enable it using the configuration:
```bash
# In your .env file
GRPC_ENABLE_REFLECTION=true
```
When enabled, you can use tools like grpcurl to inspect and test your gRPC services:
```bash
# List available services
grpcurl -plaintext localhost:9000 list
# Describe a service
grpcurl -plaintext localhost:9000 describe YourService
# Make a test call
grpcurl -plaintext -d '{"name": "test"}' localhost:9000 YourService/YourMethod
```
## Built-in Metrics
GoFr automatically registers the following gRPC metrics:
+ **grpc_server_status**: Gauge indicating server status (1=running, 0=stopped)
+ **grpc_server_errors_total**: Counter for total gRPC server errors
+ **grpc_services_registered_total**: Counter for total registered gRPC services
These metrics are automatically available in your metrics endpoint and can be used for monitoring and alerting.
## Customizing gRPC Client with DialOptions
GoFr provides flexibility to customize your gRPC client connections using gRPC `DialOptions`. This allows users to configure aspects such as transport security, interceptors, and load balancing policies.
You can pass optional parameters while creating your gRPC client to tailor the connection to your needs. Here’s an example of a Unary Interceptor that sets metadata on outgoing requests:
```go
func main() {
app := gofr.New()
// Create a gRPC client for the service
gRPCClient, err := client.New<SERVICE_NAME>GoFrClient(
app.Config.Get("GRPC_SERVER_HOST"),
app.Metrics(),
grpc.WithChainUnaryInterceptor(MetadataUnaryInterceptor),
)
if err != nil {
app.Logger().Errorf("Failed to create gRPC client: %v", err)
return
}
greet := NewGreetHandler(gRPCClient)
app.GET("/hello", greet.Hello)
app.Run()
}
// MetadataUnaryInterceptor sets a custom metadata value on outgoing requests
func MetadataUnaryInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
md := metadata.Pairs("client-id", "GoFr-Client-123")
ctx = metadata.NewOutgoingContext(ctx, md)
err := invoker(ctx, method, req, reply, cc, opts...)
if err != nil {
return fmt.Errorf("Error in %s: %v", method, err)
}
return err
}
```
This interceptor sets a metadata key `client-id` with a value of `GoFr-Client-123` for each request. Metadata can be used for authentication, tracing, or custom behaviors.
### Using TLS Credentials and Advanced Service Config
By default, gRPC connections in GoFr are made over insecure connections, which is not recommended for production. You can override this behavior using TLS credentials. Additionally, a more comprehensive service configuration can define retry policies and other settings:
```go
import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
)
// The default serviceConfig in GoFr only sets the loadBalancingPolicy to "round_robin".
const serviceConfig = `{
"loadBalancingPolicy": "round_robin",
"methodConfig": [{
"name": [{"service": "HelloService"}],
"retryPolicy": {
"maxAttempts": 4,
"initialBackoff": "0.1s",
"maxBackoff": "1s",
"backoffMultiplier": 2.0,
"retryableStatusCodes": ["UNAVAILABLE", "RESOURCE_EXHAUSTED"]
}
}]
}`
func main() {
app := gofr.New()
creds, err := credentials.NewClientTLSFromFile("path/to/cert.pem", "")
if err != nil {
app.Logger().Errorf("Failed to load TLS certificate: %v", err)
return
}
gRPCClient, err := client.New<SERVICE_NAME>GoFrClient(
app.Config.Get("GRPC_SERVER_HOST"),
app.Metrics(),
grpc.WithTransportCredentials(creds),
grpc.WithDefaultServiceConfig(serviceConfig),
)
if err != nil {
app.Logger().Errorf("Failed to create gRPC client: %v", err)
return
}
greet := NewGreetHandler(gRPCClient)
app.GET("/hello", greet.Hello)
app.Run()
}
```
In this example:
- `WithTransportCredentials` sets up TLS security.
- `WithDefaultServiceConfig` defines retry policies with exponential backoff and specific retryable status codes.
### Further Reading
For more details on configurable DialOptions, refer to the [official gRPC package for Go](https://pkg.go.dev/google.golang.org/grpc#DialOption).
## HealthChecks in GoFr's gRPC Service/Clients
Health Checks in GoFr's gRPC Services
GoFr provides built-in health checks for gRPC services, enabling observability, monitoring, and inter-service health verification.
### Client Interface
```go
type <SERVICE_NAME>GoFrClient interface {
SayHello(*gofr.Context, *HelloRequest, ...grpc.CallOption) (*HelloResponse, error)
health
}
type health interface {
Check(ctx *gofr.Context, in *grpc_health_v1.HealthCheckRequest, opts ...grpc.CallOption) (*grpc_health_v1.HealthCheckResponse, error)
Watch(ctx *gofr.Context, in *grpc_health_v1.HealthCheckRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[grpc_health_v1.HealthCheckResponse], error)
}
```
### Server Integration
```go
type <SERVICE_NAME>GoFrServer struct {
health *healthServer
}
```
Supported Methods for HealthCheck :
```go
func (h *healthServer) Check(ctx *gofr.Context, req *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
func (h *healthServer) Watch(ctx *gofr.Context, in *grpc_health_v1.HealthCheckRequest, stream grpc_health_v1.Health_WatchServer) error
func (h *healthServer) SetServingStatus(ctx *gofr.Context, service string, status grpc_health_v1.HealthCheckResponse_ServingStatus)
func (h *healthServer) Shutdown(ctx *gofr.Context)
func (h *healthServer) Resume(ctx *gofr.Context)
```
> ##### Check out the example of setting up a gRPC server/client in GoFr: [Visit GitHub](https://github.com/gofr-dev/gofr/tree/main/examples/grpc)
================================================
FILE: docs/advanced-guide/grpc-streaming/page.md
================================================
# gRPC Streaming with GoFr
GoFr provides comprehensive support for gRPC streaming, enabling efficient real-time communication between services. Streaming is particularly useful for scenarios where you need to send or receive multiple messages over a single connection, such as chat applications, real-time data feeds, or large file transfers.
GoFr supports three types of gRPC streaming:
- **Server-side streaming**: The server sends multiple responses to a single client request
- **Client-side streaming**: The client sends multiple requests and receives a single response
- **Bidirectional streaming**: Both client and server can send multiple messages independently
All streaming methods in GoFr include built-in tracing, metrics, and logging support, ensuring seamless observability for your streaming operations.
## Prerequisites
Before implementing gRPC streaming, ensure you have:
1. **Protocol Buffer Compiler (`protoc`)** installed (version 3+)
2. **Go gRPC plugins** installed:
```bash
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
export PATH="$PATH:$(go env GOPATH)/bin"
```
3. **gofr-cli** installed:
```bash
go install gofr.dev/cli/gofr@latest
```
For detailed setup instructions, refer to the [gRPC with GoFr documentation](https://gofr.dev/docs/advanced-guide/grpc).
## Defining Streaming RPCs in Protocol Buffers
To use streaming in your gRPC service, define your RPC methods with the `stream` keyword in your `.proto` file:
```protobuf
syntax = "proto3";
option go_package = "path/to/your/proto/file";
message Request {
string message = 1;
}
message Response {
string message = 1;
}
service ChatService {
// Server-side streaming: client sends one request, server sends multiple responses
rpc ServerStream(Request) returns (stream Response);
// Client-side streaming: client sends multiple requests, server sends one response
rpc ClientStream(stream Request) returns (Response);
// Bidirectional streaming: both client and server can send multiple messages
rpc BiDiStream(stream Request) returns (stream Response);
}
```
## Generating gRPC Streaming Server Code
GoFr CLI automatically generates streaming-aware server templates. Use the `gofr wrap grpc server` command:
```bash
gofr wrap grpc server -proto=./path/to/your/proto/file
```
This command generates:
- `<SERVICE_NAME>_server.go`: Template file with streaming method signatures
- `<SERVICE_NAME>_gofr.go`: Generated wrapper with streaming instrumentation
- `request_gofr.go`: Request wrapper for context binding
- `health_gofr.go`: Health check server integration
### Server-Side Streaming Implementation
Server-side streaming allows the server to send multiple responses to a single client request. This is useful for scenarios like real-time notifications or progressive data delivery.
**Example Implementation:**
```go
func (s *ChatServiceGoFrServer) ServerStream(ctx *gofr.Context, stream ChatService_ServerStreamServer) error {
// Bind the initial request
req := Request{}
if err := ctx.Bind(&req); err != nil {
return status.Errorf(codes.InvalidArgument, "invalid request: %v", err)
}
// Send multiple responses
for i := 0; i < 5; i++ {
// Check if context is canceled
select {
case <-stream.Context().Done():
return status.Error(codes.Canceled, "client disconnected")
default:
}
resp := &Response{
Message: fmt.Sprintf("Server stream %d: %s", i, req.Message),
}
if err := stream.Send(resp); err != nil {
return status.Errorf(codes.Internal, "error sending stream: %v", err)
}
time.Sleep(1 * time.Second) // Simulate processing delay
}
return nil
}
```
**Key Points:**
- Use `ctx.Bind()` to extract the initial request
- Return appropriate gRPC status codes for binding errors
- Check for context cancellation before each send operation
- Call `stream.Send()` to send each response message
- Return `nil` when streaming is complete, or an error if something goes wrong
### Client-Side Streaming Implementation
Client-side streaming allows the client to send multiple requests before receiving a single response. This is useful for batch processing or aggregating data from the client.
**Example Implementation:**
```go
func (s *ChatServiceGoFrServer) ClientStream(ctx *gofr.Context, stream ChatService_ClientStreamServer) error {
var messageCount int
var finalMessage strings.Builder
// Receive multiple messages from client
for {
// Check if context is canceled before receiving
select {
case <-stream.Context().Done():
return status.Error(codes.Canceled, "client disconnected")
default:
}
req, err := stream.Recv()
if err == io.EOF {
// Client has finished sending, send final response
return stream.SendAndClose(&Response{
Message: fmt.Sprintf("Received %d messages. Final: %s",
messageCount, finalMessage.String()),
})
}
if err != nil {
return status.Errorf(codes.Internal, "error receiving stream: %v", err)
}
// Process each message
messageCount++
finalMessage.WriteString(req.Message + " ")
}
}
```
**Key Points:**
- Check for context cancellation before each receive operation
- Use `stream.Recv()` in a loop to receive messages
- Check for `io.EOF` to detect when the client has finished sending
- Return appropriate gRPC status codes for receive errors
- Call `stream.SendAndClose()` to send the final response and close the stream
- Process each message as it arrives
### Bidirectional Streaming Implementation
Bidirectional streaming allows both client and server to send messages independently. This is useful for real-time chat applications or interactive protocols.
**Example Implementation:**
```go
func (s *ChatServiceGoFrServer) BiDiStream(ctx *gofr.Context, stream ChatService_BiDiStreamServer) error {
errChan := make(chan error)
// Handle incoming messages in a goroutine
go func() {
for {
// Check if context is canceled
select {
case <-stream.Context().Done():
errChan <- status.Error(codes.Canceled, "client disconnected")
return
default:
}
req, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
errChan <- status.Errorf(codes.Internal, "error receiving stream: %v", err)
return
}
// Process request and send response
resp := &Response{Message: "Echo: " + req.Message}
if err := stream.Send(resp); err != nil {
errChan <- status.Errorf(codes.Internal, "error sending stream: %v", err)
return
}
}
errChan <- nil
}()
// Wait for completion or cancellation
select {
case err := <-errChan:
return err
case <-stream.Context().Done():
return status.Error(codes.Canceled, "client disconnected")
}
}
```
**Key Points:**
- Use goroutines to handle concurrent send/receive operations
- Check for context cancellation in the goroutine before receiving
- Use `stream.Recv()` to receive messages
- Use `stream.Send()` to send responses
- Return appropriate gRPC status codes for errors
- Monitor `stream.Context().Done()` to handle client disconnections
- Use channels to coordinate between goroutines
## Generating gRPC Streaming Client Code
Generate the client code using:
```bash
gofr wrap grpc client -proto=./path/to/your/proto/file
```
This generates `<SERVICE_NAME>_client.go` with streaming client interfaces.
### Server-Side Streaming Client Usage
**Example Implementation:**
```go
func (c *ChatHandler) ServerStreamHandler(ctx *gofr.Context) (any, error) {
// Initiate server stream
stream, err := c.chatClient.ServerStream(ctx, &client.Request{
Message: "stream request",
})
if err != nil {
return nil, fmt.Errorf("failed to initiate server stream: %v", err)
}
var responses []Response
// Receive all streamed responses
for {
res, err := stream.Recv()
if err != nil {
if errors.Is(err, io.EOF) {
break // Stream completed
}
return nil, fmt.Errorf("stream receive error: %v", err)
}
responses = append(responses, res)
ctx.Logger.Infof("Received: %s", res.Message)
}
return responses, nil
}
```
### Client-Side Streaming Client Usage
**Example Implementation:**
```go
func (c *ChatHandler) ClientStreamHandler(ctx *gofr.Context) (any, error) {
// Initiate client stream
stream, err := c.chatClient.ClientStream(ctx)
if err != nil {
return nil, fmt.Errorf("failed to initiate client stream: %v", err)
}
// Get messages from request body
var requests []*client.Request
if err := ctx.Bind(&requests); err != nil {
return nil, fmt.Errorf("failed to bind requests: %v", err)
}
// Send multiple messages
for _, req := range requests {
if err := stream.Send(req); err != nil {
return nil, fmt.Errorf("failed to send request: %v", err)
}
}
// Close stream and receive final response
response, err := stream.CloseAndRecv()
if err != nil {
return nil, fmt.Errorf("failed to receive final response: %v", err)
}
return response, nil
}
```
### Bidirectional Streaming Client Usage
**Example Implementation:**
```go
func (c *ChatHandler) BiDiStreamHandler(ctx *gofr.Context) (any, error) {
// Initiate bidirectional stream
stream, err := c.chatClient.BiDiStream(ctx)
if err != nil {
return nil, fmt.Errorf("failed to initiate bidirectional stream: %v", err)
}
respChan := make(chan Response)
errChan := make(chan error)
// Receive responses in a goroutine
go func() {
for {
res, err := stream.Recv()
if err != nil {
if errors.Is(err, io.EOF) {
errChan <- nil
} else {
errChan <- err
}
return
}
respChan <- res
}
}()
// Send messages
messages := []string{"message 1", "message 2", "message 3"}
for _, msg := range messages {
if err := stream.Send(&client.Request{Message: msg}); err != nil {
return nil, fmt.Errorf("failed to send message: %v", err)
}
}
// Close send side
if err := stream.CloseSend(); err != nil {
return nil, fmt.Errorf("failed to close send: %v", err)
}
// Collect responses
var responses []Response
for {
select {
case err := <-errChan:
return responses, err
case resp := <-respChan:
responses = append(responses, resp)
case <-time.After(5 * time.Second):
return nil, errors.New("timeout waiting for responses")
}
}
}
```
## Registering Streaming Services
Register your streaming service in `main.go` just like unary services:
```go
package main
import (
"gofr.dev/examples/grpc/grpc-streaming-server/server"
"gofr.dev/pkg/gofr"
)
func main() {
app := gofr.New()
// Register streaming service
server.RegisterChatServiceServerWithGofr(app, server.NewChatServiceGoFrServer())
app.Run()
}
```
## Built-in Observability
GoFr automatically provides observability for all streaming operations:
### Metrics
The following metrics are automatically registered:
- **app_gRPC-Stream_stats**: Histogram tracking stream operation duration (Send, Recv, SendAndClose, CloseSend)
- **app_gRPC-Client-Stream_stats**: Histogram for client-side streaming operations
### Tracing
Each streaming operation (Send, Recv, SendAndClose, CloseSend) automatically creates spans for distributed tracing, allowing you to track the flow of messages through your system.
### Logging
Streaming operations are automatically logged with:
- Operation type (Send, Recv, etc.)
- Method name
- Duration
- Error status (if any)
## Error Handling
### Common Streaming Errors
1. **`io.EOF`**: Indicates the stream has ended normally
- In client-side streaming: Server should call `SendAndClose()`
- In server-side/bidirectional streaming: Client has finished sending
2. **Context Cancellation**: Stream was canceled or timed out
- Check `stream.Context().Done()` for cancellation
- Return appropriate gRPC status codes
3. **Network Errors**: Connection issues during streaming
- Handle gracefully and return appropriate error status
**Example Error Handling:**
```go
func (s *ChatServiceGoFrServer) ServerStream(ctx *gofr.Context, stream ChatService_ServerStreamServer) error {
req := Request{}
if err := ctx.Bind(&req); err != nil {
return status.Errorf(codes.InvalidArgument, "invalid request: %v", err)
}
for i := 0; i < 5; i++ {
// Check if context is canceled
select {
case <-stream.Context().Done():
return status.Error(codes.Canceled, "client disconnected")
default:
}
resp := &Response{Message: fmt.Sprintf("Message %d", i)}
if err := stream.Send(resp); err != nil {
return status.Errorf(codes.Internal, "error sending stream: %v", err)
}
}
return nil
}
```
## Adding Custom Stream interceptors
For streaming RPCs (client-stream, server-stream, or bidirectional), GoFr allows you to add stream interceptors using `AddGRPCServerStreamInterceptors`. These are useful for handling logic that needs to span the entire lifetime of a stream.
```go
func main() {
app := gofr.New()
app.AddGRPCServerStreamInterceptors(streamAuthInterceptor)
// ... register your service
app.Run()
}
func streamAuthInterceptor(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
// Example: Validate metadata for the entire stream
md, ok := metadata.FromIncomingContext(ss.Context())
if !ok || !isValidToken(md["auth-token"]) {
return status.Errorf(codes.Unauthenticated, "invalid stream token")
}
// If valid, continue processing the stream
return handler(srv, ss)
}
```
For more details on adding additional interceptors and server options, refer to the [official gRPC Go package](https://pkg.go.dev/google.golang.org/grpc#ServerOption).
## Best Practices
1. **Always handle `io.EOF`**: This is the normal way streams end
2. **Monitor context cancellation**: Use `stream.Context().Done()` to detect client disconnections
3. **Use goroutines for bidirectional streams**: Allows concurrent send/receive operations
4. **Close streams properly**: Call `CloseSend()` when done sending in bidirectional streams
5. **Handle errors gracefully**: Return appropriate gRPC status codes
6. **Use timeouts**: Set reasonable timeouts for stream operations
7. **Log important events**: Use `ctx.Logger` to log stream lifecycle events
## Examples
Complete working examples are available in the GoFr repository:
- **Server Example**: `gofr/examples/grpc/grpc-streaming-server`
- **Client Example**: `gofr/examples/grpc/grpc-streaming-client`
These examples demonstrate all three types of streaming with detailed error handling and logging.
## Further Reading
- [gRPC with GoFr](https://gofr.dev/docs/advanced-guide/grpc) - General gRPC documentation
- [gRPC Official Documentation](https://grpc.io/docs/what-is-grpc/introduction/) - Learn more about gRPC streaming concepts
- [GoFr Examples](https://github.com/gofr-dev/gofr/tree/main/examples/grpc) - More gRPC examples
================================================
FILE: docs/advanced-guide/handling-data-migrations/page.md
================================================
# Handling Data Migrations
If you make manual changes to your database, you must inform other developers so they can apply the same changes. Additionally, you need to keep track of which changes should be applied to production machines in the next deployment.
GoFr supports data migrations for MySQL, Postgres, Redis, ClickHouse & Cassandra which allows you to modify database state — such as adding columns, changing data types, adding constraints, or managing keys.
## Usage
### Creating Migration Files
It is recommended to maintain a `migrations` directory in your project root to enhance readability and maintainability.
**Migration file names**
It is recommended that each migration file should be numbered in the format of _YYYYMMDDHHMMSS_ when the migration was created.
This prevents numbering conflicts and ensures migrations sort correctly across different filesystems.
Run the following commands to create a migration file
```shell
# Install GoFr CLI
go install gofr.dev/cli/gofr@latest
# Create migration
gofr migrate create -name=create_employee_table
```
Add the `createTableEmployee` function given below in the created file in `migrations` directory.
**Filename : 20240226153000_create_employee_table.go**
```go
package migrations
import "gofr.dev/pkg/gofr/migration"
const createTable = `CREATE TABLE IF NOT EXISTS employee
(
id int not null
primary key,
name varchar(50) not null,
gender varchar(6) not null,
contact_number varchar(10) not null
);`
func createTableEmployee() migration.Migrate {
return migration.Migrate{
UP: func(d migration.Datasource) error {
_, err := d.SQL.Exec(createTable)
if err != nil {
return err
}
return nil
},
}
}
```
`migration.Datasource` contains the supported datasources, i.e., Redis and SQL (MySQL and PostgreSQL).
All migrations run within a transaction.
For MySQL, use `IF EXISTS` and `IF NOT EXISTS` in DDL commands because MySQL implicitly commits these statements.
**Create a function which returns all the migrations in a map**
**Filename : all.go**
```go
package migrations
import "gofr.dev/pkg/gofr/migration"
func All() map[int64]migration.Migrate {
return map[int64]migration.Migrate{
20240226153000: createTableEmployee(),
}
}
```
Migrations run in ascending order of keys in this map.
> **Best Practice:** Before creating multiple migrations, learn about [organizing migrations by feature](#organizing-migrations-by-feature) to avoid creating one migration per table or operation.
### Initialization from main.go
```go
package main
import (
"gofr.dev/examples/using-migrations/migrations"
"gofr.dev/pkg/gofr"
)
func main() {
// Create a new application
a := gofr.New()
// Add migrations to run
a.Migrate(migrations.All())
// Run the application
a.Run()
}
```
When we run the app we will see the following logs for migrations which ran successfully.
```bash
INFO [16:55:46] Migration 20240226153000 ran successfully
```
GoFr maintains the records in the database itself which helps in tracking which migrations have already been executed and ensures that only migrations that have never been run are executed.
## Organizing Migrations by Feature
**Important:** Migrations should be organized by **feature**, not by individual database operations. The migration history should tell the story of feature evolution, not database operation granularity.
### Bad Practice: One Migration Per Operation
A common mistake is to create one migration for each table or operation, even when they're part of the same feature:
```go
func All() map[int64]migration.Migrate {
return map[int64]migration.Migrate{
20251114000001: createTableUsers(),
20251114000002: createTableMonitors(),
20251114000003: createTableCheckResults(),
20251114000004: createTableIncidents(),
}
}
```
**Why this is problematic:**
- When reverting a feature, you want to revert all related changes together
- When deploying, you want to deploy the entire feature atomically
- Having multiple migrations for a single feature creates unnecessary complexity and potential inconsistencies
### Good Practice: One Migration Per Feature
Instead, group all database operations related to a single feature into one migration:
```go
func All() map[int64]migration.Migrate {
return map[int64]migration.Migrate{
20251114000001: addMonitoringFeature(), // Creates all 4 tables together
}
}
func addMonitoringFeature() migration.Migrate {
return migration.Migrate{
UP: func(d migration.Datasource) error {
// Create all tables for the monitoring feature
if _, err := d.SQL.Exec(createTableUsers); err != nil {
return err
}
if _, err := d.SQL.Exec(createTableMonitors); err != nil {
return err
}
if _, err := d.SQL.Exec(createTableCheckResults); err != nil {
return err
}
if _, err := d.SQL.Exec(createTableIncidents); err != nil {
return err
}
return nil
},
}
}
```
**Benefits of this approach:**
- **Atomic deployment:** The entire feature is deployed or reverted together
- **Clear history:** Migration history reflects feature evolution, not granular operations
- **Easier rollback:** Reverting a feature means reverting one migration, not tracking multiple related migrations
- **Better organization:** Related changes stay together, making the codebase easier to understand
## Multi-Instance Deployments
When running multiple instances of your application (e.g., in Kubernetes or Docker Swarm), GoFr automatically coordinates migrations to ensure only one instance runs them at a time.
### How It Works
1. **Automatic Coordination:** When multiple instances start simultaneously, they coordinate using distributed locks
2. **One Runs, Others Wait:** The first instance to acquire the lock runs migrations, while others wait
3. **Fast Path:** If migrations are already complete, instances return immediately without acquiring locks
### Lock Mechanism
**SQL (MySQL/PostgreSQL/SQLite):**
- Uses a dedicated `gofr_migration_locks` table
- Lock TTL: 15 seconds
- Heartbeat: Refreshes every 5 seconds for long migrations
**Redis:**
- Uses `SETNX` with TTL
- Lock TTL: 15 seconds
- Heartbeat: Refreshes every 5 seconds for long migrations
**Retry Behavior:**
- Max retries: Indefinite (pods wait until migration is complete)
- Retry interval: 500ms
### What This Means for You
**✅ No code changes needed** - Locking happens automatically
**✅ Safe deployments** - Multiple instances won't corrupt data
**✅ Long migrations supported** - Locks are automatically extended via heartbeat
**✅ Crash recovery** - Locks auto-expire after 15 seconds if a pod crashes
### Example Deployment
\`\`\`yaml
# docker-compose.yaml or Kubernetes deployment
services:
app:
image: myapp:latest
replicas: 3 # All 3 instances coordinate automatically
\`\`\`
When you deploy:
- Instance 1: Acquires lock → Runs migrations → Releases lock
- Instance 2: Waits for lock → Sees migrations complete → Continues startup
- Instance 3: Waits for lock → Sees migrations complete → Continues startup
> **Note:** Single-instance deployments work exactly as before with no performance impact.
## Migration Records
**SQL**
Migration records are stored in **gofr_migrations** table which has the following schema:
{% table %}
- Field
- Type
---
- version
- bigint
---
- method
- varchar(4)
---
- start_time
- timestamp
---
- duration
- bigint
---
{% /table %}
**REDIS**
Migration records are stored and maintained in a Redis Hash named **gofr_migrations** where key is the version and value contains other details in JSON format.
Example :
Key: 20240226153000
Value: {"method":"UP","startTime":"2024-02-26T15:03:46.844558+05:30","duration":0}
Explanation:
**Version** : The migration version is the numeric key defined in the map.
**Start Time** : Time when the migration started in UTC.
**Duration** : Time taken by Migration since it started in milliseconds.
**Method** : It indicates whether the migration ran in UP or DOWN mode.
(For now only method UP is supported)
> **Note**: For Redis migration using **Streams mode**, a consumer group ID is mandatory. An empty group ID will result in an error during subscription, however, publishing will still succeed.
### Migrations in Cassandra
`GoFr` provides support for migrations in Cassandra but does not guarantee atomicity for individual DML commands. To achieve atomicity during migrations, users can leverage batch operations using the `NewBatch`, `BatchQuery`, and `ExecuteBatch` methods. These methods allow multiple queries to be executed as a single atomic operation.
Alternatively, users can construct their batch queries using the `BEGIN BATCH` and `APPLY BATCH` statements to ensure that all the commands within the batch are executed successfully or not at all. This is particularly useful for complex migrations involving multiple inserts, updates, or schema changes in a single transaction-like operation.
When using batch operations, consider using a `LoggedBatch` for atomicity or an `UnloggedBatch` for improved performance where atomicity isn't required. This approach helps maintain data consistency in complex migrations.
> Note: The following example assumes that users have already created the `KEYSPACE` in Cassandra. A `KEYSPACE` in Cassandra is a container for tables that defines data replication settings across the cluster.
```go
package migrations
import (
"gofr.dev/pkg/gofr/migration"
)
const (
createTableCassandra = `CREATE TABLE IF NOT EXISTS employee (
id int PRIMARY KEY,
name text,
gender text,
number text
);`
addCassandraRecords = `BEGIN BATCH
INSERT INTO employee (id, name, gender, number) VALUES (1, 'Alison', 'F', '1234567980');
INSERT INTO employee (id, name, gender, number) VALUES (2, 'Alice', 'F', '9876543210');
APPLY BATCH;
`
employeeDataCassandra = `INSERT INTO employee (id, name, gender, number) VALUES (?, ?, ?, ?);`
)
func createTableEmployeeCassandra() migration.Migrate {
return migration.Migrate{
UP: func(d migration.Datasource) error {
// Execute the create table statement
if err := d.Cassandra.Exec(createTableCassandra); err != nil {
return err
}
// Batch processes can also be executed in Exec as follows:
if err := d.Cassandra.Exec(addCassandraRecords); err != nil {
return err
}
// Create a new batch operation
batchName := "employeeBatch"
if err := d.Cassandra.NewBatch(batchName, 0); err != nil { // 0 for LoggedBatch
return err
}
// Add multiple queries to the batch
if err := d.Cassandra.BatchQuery(batchName, employeeDataCassandra, 1, "Harry", "M", "1234567980"); err != nil {
return err
}
if err := d.Cassandra.BatchQuery(batchName, employeeDataCassandra, 2, "John", "M", "9876543210"); err != nil {
return err
}
// Execute the batch operation
if err := d.Cassandra.ExecuteBatch(batchName); err != nil {
return err
}
return nil
},
}
}
```
## Migrations in Elasticsearch
GoFr supports Elasticsearch document migrations, including **single-document** and **bulk operations**.
### Single Document Migration
```go
func addSingleProduct() migration.Migrate {
return migration.Migrate{
UP: func(d migration.Datasource) error {
product := map[string]any{
"title": "Laptop",
"price": 999.99,
"category": "electronics",
}
return d.Elasticsearch.IndexDocument( context.Background(), "products", "1", product, ) }, }
}
```
### Bulk Operation Migration
```go
func bulkProducts() migration.Migrate {
return migration.Migrate{
UP: func(d migration.Datasource) error {
operations := []map[string]any{
{"index": map[string]any{"_index": "products", "_id": "1"}},
{"title": "Phone", "price": 699.99, "category": "electronics"},
{"index": map[string]any{"_index": "products", "_id": "2"}},
{"title": "Mug", "price": 12.99, "category": "kitchen"},
}
_, err := d.Elasticsearch.Bulk(context.Background(), operations) return err },}
}
```
## PubSub in Migrations
GoFr provides support for interacting with PubSub systems during migrations. This is particularly useful for setting up your infrastructure (e.g., creating or deleting topics) before your application logic starts using them.
GoFr does not store migration records in PubSub. Migration version tracking is handled exclusively by primary data stores (SQL or Redis) that support atomicity and locking. This is because many PubSub backends (like Redis Streams or Kafka) persist messages even after they are consumed. If the PubSub bus were used as a source of truth for migration versions, stale data from previous runs or other environments could interfere with the migration process, causing legitimate migrations to be skipped.
### Configuration Requirements
When using PubSub in migrations, keep in mind the configuration requirements of your backend:
- **Publishing**: Generally only requires connection details (brokers, host, etc.).
- **Subscribing**: Requires a **Consumer Group ID** (e.g., `CONSUMER_ID` for Kafka or `REDIS_STREAMS_CONSUMER_GROUP` for Redis Streams). An empty or missing value will cause an error when attempting to subscribe, whereas publishing will still function correctly.
### Usage Examples
You can use the `PubSub` data source inside your `UP` migrations just like any other driver.
**Creating a topic during migration:**
```go
func setupMessagingFeature() migration.Migrate {
return migration.Migrate{
UP: func(d migration.Datasource) error {
// Create a topic required for the new feature
if err := d.PubSub.CreateTopic(context.Background(), "user-registrations"); err != nil {
return err
}
return nil
},
}
}
```
**Publishing a message to an existing topic (topic not created by migration):**
```go
func seedInitialEvents() migration.Migrate {
return migration.Migrate{
UP: func(d migration.Datasource) error {
// Publish a seed message to a pre-existing topic
return d.PubSub.Publish(context.Background(), "order-events", []byte(`{"event":"system-initialized"}`))
},
}
}
```
> ##### Check out the example to add and run migrations in GoFr: [Visit GitHub](https://github.com/gofr-dev/gofr/blob/main/examples/using-migrations/main.go)
================================================
FILE: docs/advanced-guide/handling-file/page.md
================================================
# Handling File
GoFr simplifies the complexity of working with different file stores by offering a uniform API. This allows developers to interact with different storage systems using the same set of methods, without needing to understand the underlying implementation details of each file store.
## USAGE
By default, local file-store is initialized and user can access it from the context.
GoFr also supports FTP/SFTP file-store. Developers can also connect and use their cloud storage bucket as a file-store. Following cloud storage options are currently supported:
- **AWS S3**
- **Google Cloud Storage (GCS)**
- **Azure File Storage**
The file-store can be initialized as follows:
### FTP file-store
```go
package main
import (
"gofr.dev/pkg/gofr"
"gofr.dev/pkg/gofr/datasource/file/ftp"
)
func main() {
app := gofr.New()
app.AddFileStore(ftp.New(&ftp.Config{
Host: "127.0.0.1",
User: "user",
Password: "password",
Port: 21,
RemoteDir: "/ftp/user",
}))
app.Run()
}
```
### SFTP file-store
```go
package main
import (
"gofr.dev/pkg/gofr"
"gofr.dev/pkg/gofr/datasource/file/sftp"
)
func main() {
app := gofr.New()
app.AddFileStore(sftp.New(&sftp.Config{
Host: "127.0.0.1",
User: "user",
Password: "password",
Port: 22,
}))
app.Run()
}
```
### AWS S3 Bucket as File-Store
To run S3 File-Store locally we can use localstack,
`docker run --rm -it -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack`
```go
package main
import (
"gofr.dev/pkg/gofr"
"gofr.dev/pkg/gofr/datasource/file/s3"
)
func main() {
app := gofr.New()
// Note that currently we do not handle connections through session token.
// BaseEndpoint is not necessary while connecting to AWS as it automatically resolves it on the basis of region.
// However, in case we are using any other AWS compatible service, such like running or testing locally, then this needs to be set.
// Note that locally, AccessKeyID & SecretAccessKey is not checked if we use localstack.
app.AddFileStore(s3.New(&s3.Config{
EndPoint: "http://localhost:4566",
BucketName: "gofr-bucket-2",
Region: "us-east-1",
AccessKeyID: app.Config.Get("AWS_ACCESS_KEY_ID"),
SecretAccessKey: app.Config.Get("AWS_SECRET_ACCESS_KEY"),
}))
app.Run()
}
```
> Note: The current implementation supports handling only one bucket at a time,
> as shown in the example with `gofr-bucket-2`. Bucket switching mid-operation is not supported.
### Google Cloud Storage (GCS) Bucket as File-Store
**Local Setup with fake-gcs-server:**
1. Start fake-gcs-server with HTTP:
```bash
docker run -d --name fake-gcs-server -p 4443:4443 \
fsouza/fake-gcs-server -scheme http -port 4443
```
2. Create a bucket:
```bash
curl -X POST http://localhost:4443/storage/v1/b?project=my-project-id \
-H "Content-Type: application/json" \
-d '{"name":"my-bucket"}'
```
3. Set environment variable in your `configs/.env` file:
```bash
STORAGE_EMULATOR_HOST=localhost:4443
```
4. Connect to GCS in your application:
```go
package main
import (
"gofr.dev/pkg/gofr"
"gofr.dev/pkg/gofr/datasource/file/gcs"
)
func main() {
app := gofr.New()
// Local setup with fake-gcs-server (uses STORAGE_EMULATOR_HOST)
app.AddFileStore(gcs.New(&gcs.Config{
BucketName: "my-bucket",
ProjectID: "my-project-id",
}))
app.Run()
app.Run()
}
```
**Production Setup:**
For production, authenticate using one of these methods:
```go
// Option 1: Using GOOGLE_APPLICATION_CREDENTIALS environment variable
// Set: export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
app.AddFileStore(gcs.New(&gcs.Config{
BucketName: "my-bucket",
ProjectID: "my-project-id",
}))
// Option 2: Using CredentialsJSON directly
credJSON, _ := os.ReadFile("gcs-credentials.json")
app.AddFileStore(gcs.New(&gcs.Config{
BucketName: "my-bucket",
CredentialsJSON: string(credJSON),
ProjectID: "my-project-id",
}))
```
> **Note:**
> - When `STORAGE_EMULATOR_HOST` is set, the client automatically connects to the local emulator without authentication.
> - For production, use either `GOOGLE_APPLICATION_CREDENTIALS` environment variable or `CredentialsJSON` config field
> - Currently supports one bucket per file-store instance
### Azure File Storage as File-Store
Azure File Storage provides fully managed file shares in the cloud. To use Azure File Storage with GoFr:
```go
package main
import (
"gofr.dev/pkg/gofr"
"gofr.dev/pkg/gofr/datasource/file/azure"
)
func main() {
app := gofr.New()
// Create Azure File Storage filesystem
fs, err := azure.New(&azure.Config{
AccountName: "mystorageaccount",
AccountKey: "myaccountkey",
ShareName: "myshare",
// Endpoint is optional, defaults to https://{AccountName}.file.core.windows.net
// Endpoint: "https://custom-endpoint.file.core.windows.net",
})
if err != nil {
app.Logger().Fatalf("Failed to initialize Azure File Storage: %v", err)
}
app.AddFileStore(fs)
app.Run()
}
```
> **Note:**
> - Azure File Storage uses file shares (similar to S3 buckets or GCS buckets)
> - Authentication requires both `AccountName` and `AccountKey`
> - The `Endpoint` field is optional and defaults to `https://{AccountName}.file.core.windows.net`
> - Currently supports one file share per file-store instance
> - The implementation automatically retries connection if the initial connection fails
> - **Automatic parent directory creation**: When creating files in nested paths (e.g., `dir1/subdir/file.txt`), parent directories are automatically created, matching local filesystem behavior
> - **Content type detection**: Content types are automatically detected based on file extensions (e.g., `.json` → `application/json`, `.txt` → `text/plain`)
## Cloud-Specific Operations
Beyond the standard filesystem interface, some cloud storage providers support richer capabilities — setting file metadata on upload and generating secure, time-limited download URLs. These are available through the `CloudFileSystem` interface.
> **Note:** These operations are currently supported only for **Google Cloud Storage (GCS)**. Other cloud providers may gain support in future releases.
### Checking Cloud Support
Use `file.AsCloud()` to safely check whether the configured file store supports cloud-specific operations. This avoids a raw type assertion and returns a typed interface:
```go
import "gofr.dev/pkg/gofr/datasource/file"
cfs, ok := file.AsCloud(c.File)
if !ok {
return nil, file.ErrSignedURLsNotSupported
}
```
### Uploading a File with Metadata
`CreateWithOptions` works like `Create` but lets you set a `Content-Type`, `Content-Disposition`, and arbitrary key-value metadata on the object at upload time:
```go
f, err := cfs.CreateWithOptions(c, "reports/q1.csv", &file.FileOptions{
ContentType: "text/csv",
ContentDisposition: `attachment; filename="q1.csv"`,
Metadata: map[string]string{
"uploaded-by": "invoice-service",
"report-quarter": "Q1-2026",
},
})
if err != nil {
return nil, err
}
defer f.Close()
_, err = f.Write(csvData)
```
Setting `ContentDisposition` ensures browsers download the file as an attachment rather than attempting to render it inline. Custom `Metadata` fields are stored on the GCS object and visible in the GCS console and `gsutil` output.
### Generating a Signed URL
`GenerateSignedURL` creates a time-limited, pre-authenticated URL that allows anyone with the link to download the file — no GCS credentials required on the client side:
```go
url, err := cfs.GenerateSignedURL(c, "reports/q1.csv", 15*time.Minute, nil)
if err != nil {
return nil, err
}
return url, nil
```
Pass `FileOptions` as the last argument to override the `Content-Disposition` header that the signed URL serves — useful when the object was uploaded without a disposition header but you want the browser to treat it as a download:
```go
url, err := cfs.GenerateSignedURL(c, "reports/q1.csv", 1*time.Hour, &file.FileOptions{
ContentDisposition: `attachment; filename="report.csv"`,
})
```
> **Note:**
> - Signed URLs require the GCS service account to have the `iam.serviceAccounts.signBlob` IAM permission.
> - The URL is pre-authenticated — anyone who has it can download the file until it expires.
> - Expiry is measured from the moment `GenerateSignedURL` is called.
> - `file.AsCloud` returns `(nil, false)` for local, FTP, and SFTP file stores — always check the `ok` result.
### Creating Directory
To create a single directory
```go
err := ctx.File.Mkdir("my_dir",os.ModePerm)
```
To create subdirectories as well
```go
err := ctx.File.MkdirAll("my_dir/sub_dir", os.ModePerm)
```
### Get current Directory
```go
currentDir, err := ctx.File.Getwd()
```
### Change current Directory
To switch to parent directory
```go
currentDir, err := ctx.File.Chdir("..")
```
To switch to another directory in same parent directory
```go
currentDir, err := ctx.File.Chdir("../my_dir2")
```
To switch to a subfolder of the current directory
```go
currentDir, err := ctx.File.Chdir("sub_dir")
```
> Note: This method attempts to change the directory, but S3's flat structure and fixed bucket
> make this operation inapplicable. Similarly, GCS uses a flat structure where directories are simulated through object prefixes.
> Azure File Storage supports directory operations natively, so `Chdir` works as expected.
### Read a Directory
The ReadDir function reads the specified directory and returns a sorted list of its entries as FileInfo objects. Each FileInfo object provides access to its associated methods, eliminating the need for additional stat calls.
If an error occurs during the read operation, ReadDir returns the successfully read entries up to the point of the error along with the error itself. Passing "." as the directory argument returns the entries for the current directory.
```go
entries, err := ctx.File.ReadDir("../testdir")
for _, entry := range entries {
entryType := "File"
if entry.IsDir() {
entryType = "Dir"
}
fmt.Printf("%v: %v Size: %v Last Modified Time : %v\n", entryType, entry.Name(), entry.Size(), entry.ModTime())
}
```
> Note: In S3 and GCS, directories are represented as prefixes of file keys/object names. This method retrieves file
> entries only from the immediate level within the specified directory. Azure File Storage supports native directory
> structures, so `ReadDir` works with actual directories.
### Creating and Save a File with Content
```go
file, _ := ctx.File.Create("my_file.text")
_, _ = file.Write([]byte("Hello World!"))
// Closes and saves the file.
file.Close()
```
> **Note for Azure File Storage:**
> - Files can be created in nested directories (e.g., `dir1/subdir/file.txt`). Parent directories are automatically created if they don't exist
> - Content types are automatically detected based on file extensions (e.g., `.json`, `.txt`, `.csv`, `.xml`, `.html`, `.pdf`)
> - This behavior matches local filesystem operations for consistency
### Reading file as CSV/JSON/TEXT
GoFr support reading CSV/JSON/TEXT files line by line.
```go
reader, err := file.ReadAll()
for reader.Next() {
var b string
// For reading CSV/TEXT files user need to pass pointer to string to SCAN.
// In case of JSON user should pass structs with JSON tags as defined in encoding/json.
err = reader.Scan(&b)
fmt.Println(b)
}
```
### Opening and Reading Content from a File
To open a file with default settings, use the `Open` command, which provides read and seek permissions only. For write permissions, use `OpenFile` with the appropriate file modes.
> Note: In FTP, file permissions are not differentiated; both `Open` and `OpenFile` allow all file operations regardless of specified permissions.
```go
csvFile, _ := ctx.File.Open("my_file.csv")
b := make([]byte, 200)
// Read reads up to len(b) bytes into b.
_, _ = file.Read(b)
csvFile.Close()
csvFile, err = ctx.File.OpenFile("my_file.csv", os.O_RDWR, os.ModePerm)
// WriteAt writes the buffer content at the specified offset.
_, err = csvFile.WriteAt([]byte("test content"), 4)
if err != nil {
return nil, err
}
```
### Getting Information of the file/directory
Stat retrieves details of a file or directory, including its name, size, last modified time, and type (such as whether it is a file or folder)
```go
file, _ := ctx.File.Stat("my_file.text")
entryType := "File"
if entry.IsDir() {
entryType = "Dir"
}
fmt.Printf("%v: %v Size: %v Last Modified Time : %v\n", entryType, entry.Name(), entry.Size(), entry.ModTime())
```
> Note: In S3 and GCS:
>
> - Names without a file extension are treated as directories by default.
> - Names starting with "0" are interpreted as binary files, with the "0" prefix removed (S3 specific behavior).
>
> For directories, the method calculates the total size of all contained objects and returns the most recent modification time. For files, it directly returns the file's size and last modified time.
>
> Azure File Storage supports native file and directory structures, so `Stat` returns accurate metadata for both files and directories.
### Rename/Move a File
To rename or move a file, provide source and destination fields.
In case of renaming a file provide current name as source, new_name in destination.
To move file from one location to another provide current location as source and new location as destination.
```go
err := ctx.File.Rename("old_name.text", "new_name.text")
```
### Deleting Files
`Remove` deletes a single file
> Note: Currently, the S3 package supports the deletion of unversioned files from general-purpose buckets only. Directory buckets and versioned files are not supported for deletion by this method. GCS supports deletion of both files and empty directories. Azure File Storage supports deletion of both files and empty directories.
```go
err := ctx.File.Remove("my_dir")
```
The `RemoveAll` command deletes all subdirectories as well. If you delete the current working directory, such as "../currentDir", the working directory will be reset to its parent directory.
> Note: In S3, RemoveAll only supports deleting directories and will return an error if a file path (as indicated by a file extension) is provided for S3.
> GCS and Azure File Storage handle both files and directories.
```go
err := ctx.File.RemoveAll("my_dir/my_text")
```
> GoFr supports relative paths, allowing locations to be referenced relative to the current working directory. However, since S3 and GCS use
> a flat file structure, all methods require a full path relative to the bucket. Azure File Storage supports native directory structures,
> so relative paths work as expected with directory navigation.
> Errors have been skipped in the example to focus on the core logic, it is recommended to handle all the errors.
================================================
FILE: docs/advanced-guide/http-communication/page.md
================================================
# Inter-Service HTTP Calls
GoFr promotes microservice architecture and to facilitate the same, it provides the support to initialize HTTP services
at application level using `AddHTTPService()` method.
Support for inter-service HTTP calls provide the following benefits:
1. Access to the methods from container - GET, PUT, POST, PATCH, DELETE.
2. Logs and traces for the request.
3. {% new-tab-link newtab=false title="Circuit breaking" href="/docs/advanced-guide/circuit-breaker" /%} for enhanced resilience and fault tolerance.
4. {% new-tab-link newtab=false title="Custom Health Check" href="/docs/advanced-guide/monitoring-service-health" /%} Endpoints
## Usage
### Registering a simple HTTP Service
GoFr allows registering a new HTTP service using the application method `AddHTTPService()`.
It takes in a service name and service address argument to register the dependent service at application level.
Registration of multiple dependent services is quite easier, which is a common use case in a microservice architecture.
> The services instances are maintained by the container.
Other provided options can be added additionally to coat the basic HTTP client with features like circuit-breaker and
custom health check and add to the functionality of the HTTP service.
The design choice for this was made such as many options as required can be added and are order agnostic,
i.e. the order of the options is not important.
> Service names are to be kept unique to one service.
```go
app.AddHTTPService(<service_name>, <service_address>)
```
#### Example
```go
package main
import (
"gofr.dev/pkg/gofr"
)
func main() {
// Create a new application
app := gofr.New()
// register a payment service which is hosted at http://localhost:9000
app.AddHTTPService("payment", "http://localhost:9000")
app.GET("/customer", Customer)
// Run the application
app.Run()
}
```
### Accessing HTTP Service in handler
The HTTP service client is accessible anywhere from `gofr.Context` that gets passed on from the handler.
Using the `GetHTTPService` method with the service name that was given at the time of registering the service,
the client can be retrieved as shown below:
```go
svc := ctx.GetHTTPService(<service_name>)
```
#### Available Methods
The HTTP service client provides methods for making requests to downstream services:
- `Get(ctx, path, queryParams)`
- `Post(ctx, path, queryParams, body)`
- `Put(ctx, path, queryParams, body)`
- `Patch(ctx, path, queryParams, body)`
- `Delete(ctx, path, body)`
**For scenarios requiring custom header propagation (authentication, multi-tenancy, user identity propagation), use the `WithHeaders` variants:**
- `GetWithHeaders(ctx, path, queryParams, headers)`
- `PostWithHeaders(ctx, path, queryParams, body, headers)`
- `PutWithHeaders(ctx, path, queryParams, body, headers)`
- `PatchWithHeaders(ctx, path, queryParams, body, headers)`
- `DeleteWithHeaders(ctx, path, body, headers)`
```go
func Customer(ctx *gofr.Context) (any, error) {
// Get the payment service client
paymentSvc := ctx.GetHTTPService("payment")
// Use the Get method to call the GET /user endpoint of payments service
resp, err := paymentSvc.Get(ctx, "user", nil)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
return string(body), nil
}
// For microservice patterns involving authentication (ex: JWT Token Forwarding), use WithHeaders methods to forward custom headers.
func GatewayHandler(ctx *gofr.Context) (any, error) {
authInfo := ctx.GetAuthInfo()
claims := authInfo.GetClaims()
userID, _ := claims.GetSubject()
headers := map[string]string{
"X-User-ID": userID,
}
userSvc := ctx.GetHTTPService("user-service")
resp, err := userSvc.GetWithHeaders(ctx, "api/user/profile", nil, headers)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
return string(body), nil
}
```
### Additional Configurational Options
GoFr provides its user with additional configurational options while registering HTTP service for communication. These are:
- **ConnectionPoolConfig** - This option allows the user to configure HTTP connection pool settings to optimize performance for high-frequency requests. The default Go HTTP client has `MaxIdleConnsPerHost: 2`, which is often insufficient for microservices making frequent requests to the same host. This configuration allows customizing:
- `MaxIdleConns`: Maximum idle connections across all hosts. If not explicitly set (0), a default of 100 will be used.
- `MaxIdleConnsPerHost`: Maximum idle connections per host (critical for performance). If set to 0, Go's DefaultMaxIdleConnsPerHost (2) will be used. Negative values will cause validation error.
- `IdleConnTimeout`: How long to keep idle connections alive. If not explicitly set (0), a default of 90 seconds will be used.
**Important**: `ConnectionPoolConfig` must be applied **first** when using multiple options, as it needs access to the underlying HTTP client transport.
- **APIKeyConfig** - This option allows the user to set the `API-Key` Based authentication as the default auth for downstream HTTP Service.
- **BasicAuthConfig** - This option allows the user to set basic auth (username and password) as the default auth for downstream HTTP Service.
**Important:** The password must be base64 encoded in your configuration/environment variables. GoFr will decode it internally before creating the Authorization header.
**Example:**
```bash
# Generate base64 encoded password
echo -n "your-password" | base64
# Output: eW91ci1wYXNzd29yZA==
```
- **OAuthConfig** - This option allows the user to add `OAuth` as default auth for downstream HTTP Service.
- **CircuitBreakerConfig** - This option allows the user to configure the GoFr Circuit Breaker's `threshold` and `interval` for the failing downstream HTTP Service calls. If the failing calls exceeds the threshold the circuit breaker will automatically be enabled.
- **DefaultHeaders** - This option allows the user to set some default headers that will be propagated to the downstream HTTP Service every time it is being called.
- **HealthConfig** - This option allows the user to add the `HealthEndpoint` along with `Timeout` to enable and perform the timely health checks for downstream HTTP Service.
- **RetryConfig** - This option allows the user to add the maximum number of retry count before returning error if any downstream HTTP Service fails. Retries are triggered for network errors and status codes **> 500** (e.g., 503 Service Unavailable). HTTP 500 is not retried.
- **RateLimiterConfig** - This option allows the user to configure rate limiting for downstream service calls using token bucket algorithm. It controls the request rate to prevent overwhelming dependent services and supports both in-memory and Redis-based implementations.
**Rate Limiter Store: Customization**
GoFr allows you to use a custom rate limiter store by implementing the RateLimiterStore interface. This enables integration with any backend (e.g., Redis, database, or custom logic)
**Interface:**
```go
type RateLimiterStore interface {
Allow(ctx context.Context, key string, config RateLimiterConfig) (allowed bool, retryAfter time.Duration, err error)
StartCleanup(ctx context.Context)
StopCleanup()
}
```
#### Usage:
```go
rc := redis.NewClient(a.Config, a.Logger(), a.Metrics())
a.AddHTTPService("cat-facts", "https://catfact.ninja",
// ConnectionPoolConfig must be applied FIRST
&service.ConnectionPoolConfig{
MaxIdleConns: 100, // Maximum idle connections across all hosts
MaxIdleConnsPerHost: 20, // Maximum idle connections per host (increased from default 2)
IdleConnTimeout: 90 * time.Second, // Keep connections alive for 90 seconds
},
// Other options can follow in any order
service.NewAPIKeyConfig("some-random-key"),
service.NewBasicAuthConfig("username", "password"),
&service.CircuitBreakerConfig{
Threshold: 4,
Interval: 1 * time.Second,
},
&service.DefaultHeaders{Headers: map[string]string{"key": "value"}},
&service.HealthConfig{
HealthEndpoint: "breeds",
},
service.NewOAuthConfig("clientID", "clientSecret",
"https://tokenurl.com", nil, nil, 0),
&service.RetryConfig{
MaxRetries: 5,
},
&service.RateLimiterConfig{
Requests: 5,
Window: time.Minute,
Burst: 10,
Store: service.NewRedisRateLimiterStore(rc), // Skip this field to use in-memory store
},
)
```
**Best Practices:**
- For distributed systems: It is strongly recommended to use Redis-based store (`NewRedisRateLimiterStore`) to ensure consistent rate limiting across multiple instances of your application.
- For single-instance applications: The default in-memory store (`NewLocalRateLimiterStore`) is sufficient and provides better performance.
- Rate configuration: Set Burst higher than Requests to allow short traffic bursts while maintaining average rate limits.
## Metrics
GoFr publishes the following metrics for HTTP service communication:
- `app_http_retry_count`: Total number of retry events. (labels: `service`)
- `app_http_circuit_breaker_state`: Current state of the circuit breaker (0 for Closed, 1 for Open). (labels: `service`)
- `app_http_service_response`: Response time of HTTP service requests in seconds (histogram). (labels: `service`, `path`, `method`, `status`)
================================================
FILE: docs/advanced-guide/injecting-databases-drivers/page.md
================================================
# Injecting Database Drivers
Keeping in mind the size of the framework in the final build, it felt counter-productive to keep all the database drivers within
the framework itself. Keeping only the most used MySQL and Redis within the framework, users can now inject databases
in the server that satisfies the base interface defined by GoFr. This helps in reducing the build size and in turn build time
as unnecessary database drivers are not being compiled and added to the build.
> We are planning to provide custom drivers for most common databases, and is in the pipeline for upcoming releases!
## Supported Databases
{% table %}
- Datasource
- Health-Check
- Logs
- Metrics
- Traces
- Version-Migrations
---
- MySQL
- ✅
- ✅
- ✅
- ✅
- ✅
---
- REDIS
- ✅
- ✅
- ✅
- ✅
- ✅
---
- PostgreSQL
- ✅
- ✅
- ✅
- ✅
- ✅
---
- ArangoDB
- ✅
- ✅
- ✅
- ✅
- ✅
---
- BadgerDB
- ✅
- ✅
- ✅
- ✅
-
---
- Cassandra
- ✅
- ✅
- ✅
- ✅
- ✅
---
- ClickHouse
-
- ✅
- ✅
- ✅
- ✅
---
- DGraph
- ✅
- ✅
- ✅
- ✅
-
---
- MongoDB
- ✅
- ✅
- ✅
- ✅
- ✅
---
- NATS KV
- ✅
- ✅
- ✅
- ✅
-
---
- OpenTSDB
- ✅
- ✅
-
- ✅
-
---
- ScyllaDB
- ✅
- ✅
- ✅
- ✅
-
---
- Solr
-
- ✅
- ✅
- ✅
-
---
- SQLite
- ✅
- ✅
- ✅
- ✅
- ✅
---
- SurrealDB
- ✅
- ✅
-
- ✅
-
---
================================================
FILE: docs/advanced-guide/key-value-store/page.md
================================================
# Key Value Store
A key-value store is a type of NoSQL database that uses a simple data model: each item is stored as a pair consisting of a unique key and a value.
This simplicity offers high performance and scalability, making key-value stores ideal for applications requiring fast and efficient data retrieval and storage.
GoFr supports multiple key-value stores including BadgerDB, NATS-KV, and DynamoDB. Support for other key-value stores will be added in the future.
Keeping in mind the size of the application in the final build, it felt counter-productive to keep the drivers within
the framework itself. GoFr provide the following functionalities for its key-value store.
```go
type KVStore interface {
Get(ctx context.Context, key string) (string, error)
Set(ctx context.Context, key, value string) error
Delete(ctx context.Context, key string) error
}
```
## BadgerDB
GoFr supports injecting BadgerDB that supports the following interface. Any driver that implements the interface can be added
using `app.AddKVStore()` method, and user's can use BadgerDB across application with `gofr.Context`.
User's can easily inject a driver that supports this interface, this provides usability without
compromising the extensibility to use multiple databases.
Import the gofr's external driver for BadgerDB:
```go
go get gofr.dev/pkg/gofr/datasource/kv-store/badger
```
### Example
```go
package main
import (
"fmt"
"gofr.dev/pkg/gofr"
"gofr.dev/pkg/gofr/datasource/kv-store/badger"
)
type User struct {
ID string
Name string
Age string
}
func main() {
app := gofr.New()
app.AddKVStore(badger.New(badger.Configs{DirPath: "badger-example"}))
app.POST("/user", Post)
app.GET("/user", Get)
app.DELETE("/user", Delete)
app.Run()
}
func Post(ctx *gofr.Context) (any, error) {
err := ctx.KVStore.Set(ctx, "name", "gofr")
if err != nil {
return nil, err
}
return "Insertion to Key Value Store Successful", nil
}
func Get(ctx *gofr.Context) (any, error) {
value, err := ctx.KVStore.Get(ctx, "name")
if err != nil {
return nil, err
}
return value, nil
}
func Delete(ctx *gofr.Context) (any, error) {
err := ctx.KVStore.Delete(ctx, "name")
if err != nil {
return nil, err
}
return fmt.Sprintf("Deleted Successfully key %v from Key-Value Store", "name"), nil
}
```
## NATS-KV
GoFr supports injecting NATS-KV that supports the above KVStore interface. Any driver that implements the interface can be added
using `app.AddKVStore()` method, and user's can use NATS-KV across application with `gofr.Context`.
User's can easily inject a driver that supports this interface, this provides usability without
compromising the extensibility to use multiple databases.
Import the gofr's external driver for NATS-KV:
```go
go get gofr.dev/pkg/gofr/datasource/kv-store/nats
```
### Example
```go
package main
import (
"encoding/json"
"fmt"
"github.com/google/uuid"
"gofr.dev/pkg/gofr"
"gofr.dev/pkg/gofr/datasource/kv-store/nats"
"gofr.dev/pkg/gofr/http"
)
type Person struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Age int `json:"age"`
Email string `json:"email,omitempty"`
}
func main() {
app := gofr.New()
app.AddKVStore(nats.New(nats.Configs{
Server: "nats://localhost:4222",
Bucket: "persons",
}))
app.POST("/person", CreatePerson)
app.GET("/person/{id}", GetPerson)
app.PUT("/person/{id}", UpdatePerson)
app.DELETE("/person/{id}", DeletePerson)
app.Run()
}
func CreatePerson(ctx *gofr.Context) (any, error) {
var person Person
if err := ctx.Bind(&person); err != nil {
return nil, http.ErrorInvalidParam{Params: []string{"body"}}
}
person.ID = uuid.New().String()
personData, err := json.Marshal(person)
if err != nil {
return nil, fmt.Errorf("failed to serialize person")
}
if err := ctx.KVStore.Set(ctx, person.ID, string(personData)); err != nil {
return nil, err
}
return person, nil
}
func GetPerson(ctx *gofr.Context) (any, error) {
id := ctx.PathParam("id")
if id == "" {
return nil, http.ErrorInvalidParam{Params: []string{"id"}}
}
value, err := ctx.KVStore.Get(ctx, id)
if err != nil {
return nil, fmt.Errorf("person not found")
}
var person Person
if err := json.Unmarshal([]byte(value), &person); err != nil {
return nil, fmt.Errorf("failed to parse person data")
}
return person, nil
}
func UpdatePerson(ctx *gofr.Context) (any, error) {
id := ctx.PathParam("id")
if id == "" {
return nil, http.ErrorInvalidParam{Params: []string{"id"}}
}
var person Person
if err := ctx.Bind(&person); err != nil {
return nil, http.ErrorInvalidParam{Params: []string{"body"}}
}
person.ID = id
personData, err := json.Marshal(person)
if err != nil {
return nil, fmt.Errorf("failed to serialize person")
}
if err := ctx.KVStore.Set(ctx, id, string(personData)); err != nil {
return nil, err
}
return person, nil
}
func DeletePerson(ctx *gofr.Context) (any, error) {
id := ctx.PathParam("id")
if id == "" {
return nil, http.ErrorInvalidParam{Params: []string{"id"}}
}
if err := ctx.KVStore.Delete(ctx, id); err != nil {
return nil, fmt.Errorf("person not found")
}
return map[string]string{"message": "Person deleted successfully"}, nil
}
```
## DynamoDB
GoFr supports injecting DynamoDB as a key-value store that implements the standard KVStore interface. Any driver that implements the interface can be added using `app.AddKVStore()` method, and users can use DynamoDB across application with `gofr.Context`.
DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. It's ideal for applications that need consistent, single-digit millisecond latency at any scale.
Import the gofr's external driver for DynamoDB:
```shell
go get gofr.dev/pkg/gofr/datasource/kv-store/dynamodb@latest
```
### Configuration
```go
type Configs struct {
Table string // DynamoDB table name
Region string // AWS region (e.g., "us-east-1")
Endpoint string // Leave empty for real AWS; set for local DynamoDB
PartitionKeyName string // Default is "pk" if not specified
}
```
### Local Development Setup
For local development, you can use DynamoDB Local with Docker:
```bash
# Start DynamoDB Local
docker run --name dynamodb-local -d -p 8000:8000 amazon/dynamodb-local
# Create a table
aws dynamodb create-table \
--table-name gofr-kv-store \
--attribute-definitions AttributeName=pk,AttributeType=S \
--key-schema AttributeName=pk,KeyType=HASH \
--billing-mode PAY_PER_REQUEST \
--endpoint-url http://localhost:8000 \
--region us-east-1
```
### JSON Helper Functions
The DynamoDB package provides helper functions for JSON serialization/deserialization that work with the standard KVStore interface:
```go
// ToJSON converts any struct to JSON string
func ToJSON(value any) (string, error)
// FromJSON converts JSON string to struct
func FromJSON(jsonData string, dest any) error
```
### Example
```go
package main
import (
"fmt"
"time"
"gofr.dev/pkg/gofr"
"gofr.dev/pkg/gofr/datasource/kv-store/dynamodb"
)
type User struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
CreatedAt time.Time `json:"created_at"`
}
func main() {
app := gofr.New()
// Create DynamoDB client with configuration
db := dynamodb.New(dynamodb.Configs{
Table: "gofr-kv-store",
Region: "us-east-1",
Endpoint: "http://localhost:8000", // For local DynamoDB
PartitionKeyName: "pk",
})
// Connect to DynamoDB
db.Connect()
// Inject the DynamoDB into gofr
app.AddKVStore(db)
app.POST("/user", CreateUser)
app.GET("/user/{id}", GetUser)
app.PUT("/user/{id}", UpdateUser)
app.DELETE("/user/{id}", DeleteUser)
app.Run()
}
func CreateUser(ctx *gofr.Context) (any, error) {
var user User
if err := ctx.Bind(&user); err != nil {
return nil, err
}
user.ID = fmt.Sprintf("user_%d", time.Now().UnixNano())
user.CreatedAt = time.Now()
// Convert struct to JSON string using helper function
userData, err := dynamodb.ToJSON(user)
if err != nil {
return nil, fmt.Errorf("failed to serialize user: %w", err)
}
// Store using standard KVStore interface
if err := ctx.KVStore.Set(ctx, user.ID, userData); err != nil {
return nil, fmt.Errorf("failed to create user: %w", err)
}
return user, nil
}
func GetUser(ctx *gofr.Context) (any, error) {
id := ctx.PathParam("id")
if id == "" {
return nil, fmt.Errorf("user ID is required")
}
// Get JSON string from KVStore
userData, err := ctx.KVStore.Get(ctx, id)
if err != nil {
return nil, fmt.Errorf("user not found: %w", err)
}
// Convert JSON string to struct using helper function
var user User
if err := dynamodb.FromJSON(userData, &user); err != nil {
return nil, fmt.Errorf("failed to parse user data: %w", err)
}
return user, nil
}
func UpdateUser(ctx *gofr.Context) (any, error) {
id := ctx.PathParam("id")
if id == "" {
return nil, fmt.Errorf("user ID is required")
}
var user User
if err := ctx.Bind(&user); err != nil {
return nil, err
}
user.ID = id
// Convert struct to JSON string using helper function
userData, err := dynamodb.ToJSON(user)
if err != nil {
return nil, fmt.Errorf("failed to serialize user: %w", err)
}
// Update in DynamoDB using standard KVStore interface
if err := ctx.KVStore.Set(ctx, id, userData); err != nil {
return nil, fmt.Errorf("failed to update user: %w", err)
}
return user, nil
}
func DeleteUser(ctx *gofr.Context) (any, error) {
id := ctx.PathParam("id")
if id == "" {
return nil, fmt.Errorf("user ID is required")
}
// Delete from DynamoDB using standard KVStore interface
if err := ctx.KVStore.Delete(ctx, id); err != nil {
return nil, fmt.Errorf("failed to delete user: %w", err)
}
return map[string]string{"message": "User deleted successfully"}, nil
}
```
### Production Configuration
For production use, remove the `Endpoint` field to connect to real AWS DynamoDB:
```go
db := dynamodb.New(dynamodb.Configs{
Table: "gofr-kv-store",
Region: "us-east-1",
// Endpoint: "", // Remove this for production
PartitionKeyName: "pk",
})
```
### AWS Credentials
For production, ensure your AWS credentials are configured through:
- AWS IAM roles (recommended for EC2/ECS/Lambda)
- AWS credentials file (`~/.aws/credentials`)
- Environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`)
================================================
FILE: docs/advanced-guide/middlewares/page.md
================================================
# Middleware in GoFr
Middleware allows you intercepting and manipulating HTTP requests and responses flowing through your application's
router. Middlewares can perform tasks such as authentication, authorization, caching etc. before
or after the request reaches your application's handler.
## CORS Middleware in GoFr
GoFr includes built-in CORS (Cross-Origin Resource Sharing) middleware to handle CORS-related headers.
This middleware allows you to control access to your API from different origins. It automatically adds the necessary
headers to responses, allowing or restricting cross-origin requests. User can also override the default response headers
sent by GoFr by providing the suitable CORS configs.
The CORS middleware provides the following overridable configs:
- `ACCESS_CONTROL_ALLOW_ORIGIN`: Set the allowed origin(s) for cross-origin requests. By default, it allows all origins (*).
- `ACCESS_CONTROL_ALLOW_HEADERS`: Define the allowed request headers (e.g., Authorization, Content-Type).
- `ACCESS_CONTROL_ALLOW_CREDENTIALS`: Set to true to allow credentials (cookies, HTTP authentication) in requests.
- `ACCESS_CONTROL_EXPOSE_HEADERS`: Specify additional headers exposed to the client.
- `ACCESS_CONTROL_MAX_AGE`: Set the maximum time (in seconds) for preflight request caching.
> Note: GoFr automatically interprets the registered route methods and based on that sets the value of `ACCESS_CONTROL_ALLOW_METHODS`
## Adding Custom Middleware in GoFr
By adding custom middleware to your GoFr application, user can easily extend its functionality and implement
cross-cutting concerns in a modular and reusable way.
User can use the `UseMiddleware` or `UseMiddlewareWithContainer` method on your GoFr application instance to register your custom middleware.
### Using UseMiddleware method for Custom Middleware
The UseMiddleware method is ideal for simple middleware that doesn't need direct access to the application's container.
#### Example:
```go
import (
"net/http"
gofrHTTP "gofr.dev/pkg/gofr/http"
)
// Define your custom middleware function
func customMiddleware() gofrHTTP.Middleware {
return func(inner http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Your custom logic here
// For example, logging, authentication, etc.
// Call the next handler in the chain
inner.ServeHTTP(w, r)
})
}
}
func main() {
// Create a new instance of your GoFr application
app := gofr.New()
// Add your custom middleware to the application
app.UseMiddleware(customMiddleware())
// Define your application routes and handlers
// ...
// Run your GoFr application
app.Run()
}
```
## Rate Limiter Middleware in GoFr
GoFr provides a built-in rate limiter middleware to protect your API from abuse and ensure fair resource distribution.
It uses a token bucket algorithm for smooth rate limiting with configurable burst capacity.
### Features
- **Token Bucket Algorithm**: Allows smooth rate limiting with configurable burst capacity
- **Per-IP Rate Limiting**: Each client IP gets its own rate limit (configurable)
- **Health Check Exemption**: `/.well-known/alive` and `/.well-known/health` endpoints are automatically exempt
- **Prometheus Metrics**: Track rate limit violations via `app_http_rate_limit_exceeded_total` counter
- **429 Status Code**: Returns standard HTTP 429 (Too Many Requests) when limit is exceeded
### Configuration
```go
import (
"gofr.dev/pkg/gofr"
"gofr.dev/pkg/gofr/http/middleware"
)
func main() {
app := gofr.New()
// Configure rate limiter
rateLimiterConfig := middleware.RateLimiterConfig{
RequestsPerSecond: 5, // Average requests per second
Burst: 10, // Maximum burst size
PerIP: true, // Enable per-IP limiting
}
// Add rate limiter middleware
app.UseMiddleware(middleware.RateLimiter(rateLimiterConfig, app.Metrics()))
app.GET("/api/resource", handler)
app.Run()
}
```
### Parameters
- `RequestsPerSecond`: Average number of requests allowed per second
- `Burst`: Maximum number of requests that can be made in a burst (allows temporary spikes)
- `PerIP`: Set to `true` for per-IP limiting (recommended) or `false` for global rate limit across all clients
- `TrustedProxies`: *(Optional)* Set to `true` to trust `X-Forwarded-For` and `X-Real-IP` headers for IP extraction. Only enable when behind a trusted reverse proxy.
> **Security Warning**: Only set `TrustedProxies: true` if your application is behind a trusted reverse proxy (nginx, ALB, etc.).
> Without a trusted proxy, clients can spoof headers to bypass rate limits.
================================================
FILE: docs/advanced-guide/monitoring-service-health/page.md
================================================
# Monitoring Service Health
Health check in microservices refers to a mechanism or process implemented within each service to assess its operational status
and readiness to handle requests. It involves regularly querying the service to determine if it is functioning correctly,
typically by evaluating its responsiveness and ability to perform essential tasks. Health checks play a critical role in ensuring service availability,
detecting failures, preventing cascading issues, and facilitating effective traffic routing in distributed systems.
## GoFr by default registers two endpoints which are:
### 1. Aliveness - /.well-known/alive
It is an endpoint which returns the following response with a 200 status code, when the service is UP.
```json
{
"data": {
"status": "UP"
}
}
```
It is also used when state of {% new-tab-link newtab=false title="circuit breaker" href="/docs/advanced-guide/circuit-breaker" /%} is open.
To override this endpoint, pass the following option while registering HTTP Service:
```go
&service.HealthConfig{
HealthEndpoint: "breeds",
}
```
### 2. Health-Check - /.well-known/health
It is an endpoint which returns whether the service is UP or DOWN along with stats, host, status about the dependent datasources an
gitextract_4eff3cym/ ├── .codeclimate.yml ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ ├── feature_request.md │ │ └── question.md │ ├── dependabot.yml │ ├── pull_request_template.md │ └── workflows/ │ ├── go.yml │ ├── typos.yml │ ├── website-prod.yml │ └── website-stage.yml ├── .gitignore ├── .golangci.yml ├── .ls-lint.yml ├── .qlty/ │ ├── .gitignore │ ├── configs/ │ │ ├── .hadolint.yaml │ │ └── .yamllint.yaml │ └── qlty.toml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── README.md ├── SECURITY.md ├── docs/ │ ├── Dockerfile │ ├── advanced-guide/ │ │ ├── authentication/ │ │ │ └── page.md │ │ ├── building-cli-applications/ │ │ │ └── page.md │ │ ├── circuit-breaker/ │ │ │ └── page.md │ │ ├── custom-spans-in-tracing/ │ │ │ └── page.md │ │ ├── dealing-with-sql/ │ │ │ └── page.md │ │ ├── debugging/ │ │ │ └── page.md │ │ ├── gofr-errors/ │ │ │ └── page.md │ │ ├── graphql/ │ │ │ └── page.md │ │ ├── grpc/ │ │ │ └── page.md │ │ ├── grpc-streaming/ │ │ │ └── page.md │ │ ├── handling-data-migrations/ │ │ │ └── page.md │ │ ├── handling-file/ │ │ │ └── page.md │ │ ├── http-communication/ │ │ │ └── page.md │ │ ├── injecting-databases-drivers/ │ │ │ └── page.md │ │ ├── key-value-store/ │ │ │ └── page.md │ │ ├── middlewares/ │ │ │ └── page.md │ │ ├── monitoring-service-health/ │ │ │ └── page.md │ │ ├── overriding-default/ │ │ │ └── page.md │ │ ├── publishing-custom-metrics/ │ │ │ └── page.md │ │ ├── rbac/ │ │ │ └── page.md │ │ ├── remote-log-level-change/ │ │ │ └── page.md │ │ ├── serving-static-files/ │ │ │ └── page.md │ │ ├── setting-custom-response-headers/ │ │ │ └── page.md │ │ ├── startup-hooks/ │ │ │ └── page.md │ │ ├── swagger-documentation/ │ │ │ └── page.md │ │ ├── using-cron/ │ │ │ └── page.md │ │ ├── using-publisher-subscriber/ │ │ │ └── page.md │ │ └── websocket/ │ │ └── page.md │ ├── datasources/ │ │ ├── arangodb/ │ │ │ └── page.md │ │ ├── cassandra/ │ │ │ └── page.md │ │ ├── clickhouse/ │ │ │ └── page.md │ │ ├── cockroachdb/ │ │ │ └── page.md │ │ ├── couchbase/ │ │ │ └── page.md │ │ ├── dgraph/ │ │ │ └── page.md │ │ ├── elasticsearch/ │ │ │ └── page.md │ │ ├── getting-started/ │ │ │ └── page.md │ │ ├── influxdb/ │ │ │ └── page.md │ │ ├── migrations/ │ │ │ └── elasticsearch/ │ │ │ └── page.md │ │ ├── mongodb/ │ │ │ └── page.md │ │ ├── opentsdb/ │ │ │ └── page.md │ │ ├── oracle/ │ │ │ └── page.md │ │ ├── scylladb/ │ │ │ └── page.md │ │ ├── solr/ │ │ │ └── page.md │ │ └── surrealdb/ │ │ └── page.md │ ├── events.json │ ├── navigation.js │ ├── page.md │ ├── quick-start/ │ │ ├── add-rest-handlers/ │ │ │ └── page.md │ │ ├── cli/ │ │ │ └── page.md │ │ ├── configuration/ │ │ │ └── page.md │ │ ├── connecting-mysql/ │ │ │ └── page.md │ │ ├── connecting-redis/ │ │ │ └── page.md │ │ ├── introduction/ │ │ │ └── page.md │ │ └── observability/ │ │ └── page.md │ ├── references/ │ │ ├── configs/ │ │ │ └── page.md │ │ ├── context/ │ │ │ └── page.md │ │ ├── gofrcli/ │ │ │ └── page.md │ │ └── testing/ │ │ └── page.md │ └── testimonials.json ├── examples/ │ ├── grpc/ │ │ ├── grpc-streaming-client/ │ │ │ ├── README.md │ │ │ ├── client/ │ │ │ │ ├── chat.pb.go │ │ │ │ ├── chat.proto │ │ │ │ ├── chat_grpc.pb.go │ │ │ │ ├── chatservice_client.go │ │ │ │ └── health_client.go │ │ │ └── main.go │ │ ├── grpc-streaming-server/ │ │ │ ├── README.md │ │ │ ├── main.go │ │ │ ├── main_test.go │ │ │ └── server/ │ │ │ ├── chat.pb.go │ │ │ ├── chat.proto │ │ │ ├── chat_grpc.pb.go │ │ │ ├── chatservice_gofr.go │ │ │ ├── chatservice_server.go │ │ │ ├── health_gofr.go │ │ │ └── request_gofr.go │ │ ├── grpc-unary-client/ │ │ │ ├── README.md │ │ │ ├── client/ │ │ │ │ ├── health_client.go │ │ │ │ ├── health_test.go │ │ │ │ ├── hello.pb.go │ │ │ │ ├── hello.proto │ │ │ │ ├── hello_client.go │ │ │ │ ├── hello_grpc.pb.go │ │ │ │ └── hello_test.go │ │ │ ├── main.go │ │ │ └── main_test.go │ │ └── grpc-unary-server/ │ │ ├── README.md │ │ ├── main.go │ │ ├── main_test.go │ │ └── server/ │ │ ├── health_gofr.go │ │ ├── health_test.go │ │ ├── hello.pb.go │ │ ├── hello.proto │ │ ├── hello_gofr.go │ │ ├── hello_grpc.pb.go │ │ ├── hello_server.go │ │ ├── hello_server_test.go │ │ ├── hello_test.go │ │ ├── request_gofr.go │ │ └── request_test.go │ ├── http-server/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── docker/ │ │ │ ├── docker-compose.yaml │ │ │ ├── prometheus/ │ │ │ │ └── prometheus.yml │ │ │ └── provisioning/ │ │ │ ├── dashboards/ │ │ │ │ ├── dashboards.yaml │ │ │ │ └── gofr-dashboard/ │ │ │ │ └── dashboards.json │ │ │ └── datasources/ │ │ │ └── datasource.yaml │ │ ├── main.go │ │ ├── main_test.go │ │ └── static/ │ │ └── openapi.json │ ├── http-server-using-redis/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── main.go │ │ └── main_test.go │ ├── sample-cmd/ │ │ ├── README.md │ │ ├── configs/ │ │ │ └── .test.env │ │ ├── main.go │ │ └── main_test.go │ ├── using-add-filestore/ │ │ ├── README.md │ │ ├── go.mod │ │ ├── go.sum │ │ ├── main.go │ │ └── main_test.go │ ├── using-add-rest-handlers/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── main.go │ │ ├── main_test.go │ │ └── migrations/ │ │ ├── 1721816030_create_user_table.go │ │ ├── 1721816030_create_user_table_test.go │ │ ├── all.go │ │ └── all_test.go │ ├── using-cron-jobs/ │ │ ├── Readme.md │ │ ├── main.go │ │ └── main_test.go │ ├── using-custom-metrics/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── main.go │ │ └── main_test.go │ ├── using-file-bind/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── main.go │ │ └── main_test.go │ ├── using-graphql/ │ │ ├── configs/ │ │ │ └── schema.graphqls │ │ ├── main.go │ │ ├── main_test.go │ │ └── migrations/ │ │ ├── 20240205125300_create_users_table.go │ │ └── all.go │ ├── using-html-template/ │ │ ├── README.md │ │ ├── main.go │ │ ├── main_test.go │ │ ├── static/ │ │ │ ├── 404.html │ │ │ ├── index.html │ │ │ └── style.css │ │ └── templates/ │ │ └── todo.html │ ├── using-http-auth-middleware/ │ │ ├── ReadMe.md │ │ ├── main.go │ │ └── main_test.go │ ├── using-http-service/ │ │ ├── Dockerfile │ │ ├── main.go │ │ ├── main_test.go │ │ └── readme.md │ ├── using-migrations/ │ │ ├── Dockerfile │ │ ├── go.sum │ │ ├── main.go │ │ ├── main_test.go │ │ ├── migrations/ │ │ │ ├── 1722507126_create_employee_table.go │ │ │ ├── 1722507126_create_employee_table_test.go │ │ │ ├── 1722507180_redis_add_employee_name.go │ │ │ ├── 1722507180_redis_add_employee_name_test.go │ │ │ ├── all.go │ │ │ └── all_test.go │ │ └── readme.md │ ├── using-publisher/ │ │ ├── Dockerfile │ │ ├── main.go │ │ ├── main_test.go │ │ ├── migrations/ │ │ │ ├── 1721801313_create_topics.go │ │ │ ├── 1721801313_create_topics_test.go │ │ │ ├── all.go │ │ │ └── all_test.go │ │ └── readme.md │ ├── using-subscriber/ │ │ ├── Dockerfile │ │ ├── main.go │ │ ├── main_test.go │ │ ├── migrations/ │ │ │ ├── 1721800255_create_topics.go │ │ │ ├── 1721800255_create_topics_test.go │ │ │ ├── all.go │ │ │ └── all_test.go │ │ └── readme.md │ └── using-web-socket/ │ ├── Readme.md │ ├── main.go │ └── main_test.go ├── go.mod ├── go.sum ├── go.work ├── go.work.sum ├── pkg/ │ └── gofr/ │ ├── auth.go │ ├── cmd/ │ │ ├── request.go │ │ ├── request_test.go │ │ ├── responder.go │ │ ├── responder_test.go │ │ └── terminal/ │ │ ├── colors.go │ │ ├── output.go │ │ ├── output_test.go │ │ ├── printers.go │ │ ├── printers_test.go │ │ ├── progress.go │ │ ├── progress_test.go │ │ ├── spinner.go │ │ └── spinner_test.go │ ├── cmd.go │ ├── cmd_test.go │ ├── config/ │ │ ├── config.go │ │ ├── godotenv.go │ │ ├── godotenv_test.go │ │ ├── mock_config.go │ │ └── mock_config_test.go │ ├── constants.go │ ├── container/ │ │ ├── container.go │ │ ├── container_test.go │ │ ├── datasources.go │ │ ├── health.go │ │ ├── health_test.go │ │ ├── metrics.go │ │ ├── mock_container.go │ │ ├── mock_datasources.go │ │ ├── mock_logger.go │ │ ├── mock_metrics.go │ │ ├── mockcontainer_test.go │ │ └── sql_mock.go │ ├── context.go │ ├── context_test.go │ ├── cron.go │ ├── cron_scheduler.go │ ├── cron_test.go │ ├── crud_handlers.go │ ├── crud_handlers_test.go │ ├── crud_helpers.go │ ├── datasource/ │ │ ├── README.md │ │ ├── arangodb/ │ │ │ ├── arango.go │ │ │ ├── arango_db.go │ │ │ ├── arango_db_test.go │ │ │ ├── arango_document.go │ │ │ ├── arango_document_test.go │ │ │ ├── arango_graph.go │ │ │ ├── arango_graph_test.go │ │ │ ├── arango_helper.go │ │ │ ├── arango_helper_test.go │ │ │ ├── arango_test.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── interface.go │ │ │ ├── logger.go │ │ │ ├── logger_test.go │ │ │ ├── metrics.go │ │ │ ├── mock_collection.go │ │ │ ├── mock_database.go │ │ │ ├── mock_graph.go │ │ │ ├── mock_interfaces.go │ │ │ ├── mock_logger.go │ │ │ ├── mock_metrics.go │ │ │ └── mock_user.go │ │ ├── cassandra/ │ │ │ ├── cassandra.go │ │ │ ├── cassandra_batch.go │ │ │ ├── cassandra_batch_test.go │ │ │ ├── cassandra_test.go │ │ │ ├── errors.go │ │ │ ├── errors_test.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── interfaces.go │ │ │ ├── internal.go │ │ │ ├── logger.go │ │ │ ├── logger_test.go │ │ │ ├── metrics.go │ │ │ ├── mock_interfaces.go │ │ │ ├── mock_logger.go │ │ │ └── mock_metrics.go │ │ ├── clickhouse/ │ │ │ ├── clickhouse.go │ │ │ ├── clickhouse_test.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── interface.go │ │ │ ├── logger.go │ │ │ ├── logger_test.go │ │ │ ├── metrics.go │ │ │ ├── mock_interface.go │ │ │ ├── mock_logger.go │ │ │ └── mock_metrics.go │ │ ├── couchbase/ │ │ │ ├── couchbase.go │ │ │ ├── couchbase_test.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── interfaces.go │ │ │ ├── logger.go │ │ │ ├── metrics.go │ │ │ ├── mock_interfaces.go │ │ │ ├── mock_logger.go │ │ │ ├── mock_metrics.go │ │ │ └── wrappers.go │ │ ├── datasource.go │ │ ├── dbresolver/ │ │ │ ├── circuit_breaker.go │ │ │ ├── factory.go │ │ │ ├── factory_test.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── logger.go │ │ │ ├── metrics.go │ │ │ ├── mock_db.go │ │ │ ├── mock_logger.go │ │ │ ├── mock_metrics.go │ │ │ ├── mock_strategy.go │ │ │ ├── options.go │ │ │ ├── resolver.go │ │ │ ├── resolver_test.go │ │ │ ├── strategy.go │ │ │ └── strategy_test.go │ │ ├── dgraph/ │ │ │ ├── dgraph.go │ │ │ ├── dgraph_test.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── interfaces.go │ │ │ ├── logger.go │ │ │ ├── logger_test.go │ │ │ ├── metrics.go │ │ │ ├── mock_interfaces.go │ │ │ ├── mock_logger.go │ │ │ └── mock_metrics.go │ │ ├── elasticsearch/ │ │ │ ├── documents.go │ │ │ ├── elasticsearch.go │ │ │ ├── elasticsearch_test.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── logger.go │ │ │ ├── metrics.go │ │ │ ├── mock_logger.go │ │ │ └── mock_metrics.go │ │ ├── errors.go │ │ ├── errors_test.go │ │ ├── file/ │ │ │ ├── azure/ │ │ │ │ ├── fs.go │ │ │ │ ├── fs_test.go │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ ├── storage_adapter.go │ │ │ │ └── storage_adapter_test.go │ │ │ ├── common_file.go │ │ │ ├── common_file_test.go │ │ │ ├── common_fs.go │ │ │ ├── common_fs_signedurl_test.go │ │ │ ├── common_fs_test.go │ │ │ ├── ftp/ │ │ │ │ ├── fs.go │ │ │ │ ├── fs_test.go │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ ├── storage_adapter.go │ │ │ │ └── storage_adapter_test.go │ │ │ ├── gcs/ │ │ │ │ ├── fs.go │ │ │ │ ├── fs_test.go │ │ │ │ ├── gcs_cloud_test.go │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ ├── storage_adapter.go │ │ │ │ └── storage_adapter_test.go │ │ │ ├── helper.go │ │ │ ├── interface.go │ │ │ ├── local_fs.go │ │ │ ├── local_fs_test.go │ │ │ ├── logger.go │ │ │ ├── mock_interface.go │ │ │ ├── observability.go │ │ │ ├── row_reader.go │ │ │ ├── row_reader_test.go │ │ │ ├── s3/ │ │ │ │ ├── file.go │ │ │ │ ├── file_parse.go │ │ │ │ ├── file_test.go │ │ │ │ ├── fs.go │ │ │ │ ├── fs_dir.go │ │ │ │ ├── fs_test.go │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ ├── interface.go │ │ │ │ ├── logger.go │ │ │ │ ├── logger_test.go │ │ │ │ └── mock_interface.go │ │ │ └── sftp/ │ │ │ ├── file.go │ │ │ ├── fs.go │ │ │ ├── fs_test.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── interface.go │ │ │ ├── logger.go │ │ │ ├── logger_test.go │ │ │ └── mock_interface.go │ │ ├── health.go │ │ ├── influxdb/ │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── influxdb.go │ │ │ ├── influxdb_test.go │ │ │ ├── interface.go │ │ │ ├── internal.go │ │ │ ├── logger.go │ │ │ ├── metrics.go │ │ │ ├── metrics_logger.go │ │ │ ├── mock_interface.go │ │ │ └── mock_logger.go │ │ ├── interface.go │ │ ├── kv-store/ │ │ │ ├── badger/ │ │ │ │ ├── badger.go │ │ │ │ ├── badger_test.go │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ ├── logger.go │ │ │ │ ├── logger_test.go │ │ │ │ ├── metrics.go │ │ │ │ ├── mock_logger.go │ │ │ │ └── mock_metrics.go │ │ │ ├── dynamodb/ │ │ │ │ ├── dynamo.go │ │ │ │ ├── dynamo_test.go │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ ├── logger.go │ │ │ │ ├── metrics.go │ │ │ │ ├── mock_dynamodb.go │ │ │ │ ├── mock_logger.go │ │ │ │ └── mock_metrics.go │ │ │ └── nats/ │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── interface.go │ │ │ ├── logger.go │ │ │ ├── metrics.go │ │ │ ├── mock_interface.go │ │ │ ├── mock_logger.go │ │ │ ├── mock_metrics.go │ │ │ ├── nats.go │ │ │ └── nats_test.go │ │ ├── logger.go │ │ ├── mongo/ │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── logger.go │ │ │ ├── logger_test.go │ │ │ ├── metrics.go │ │ │ ├── mock_logger.go │ │ │ ├── mock_metrics.go │ │ │ ├── mongo.go │ │ │ └── mongo_test.go │ │ ├── opentsdb/ │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── interface.go │ │ │ ├── mock_interface.go │ │ │ ├── observability.go │ │ │ ├── opentsdb.go │ │ │ ├── opentsdb_test.go │ │ │ ├── preprocess.go │ │ │ └── response.go │ │ ├── oracle/ │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── interface.go │ │ │ ├── logger.go │ │ │ ├── logger_test.go │ │ │ ├── metrics.go │ │ │ ├── mock_interface.go │ │ │ ├── mock_logger.go │ │ │ ├── mock_metrics.go │ │ │ ├── oracle.go │ │ │ └── oracle_test.go │ │ ├── pubsub/ │ │ │ ├── eventhub/ │ │ │ │ ├── eventhub.go │ │ │ │ ├── eventhub_test.go │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ ├── helper.go │ │ │ │ ├── helper_test.go │ │ │ │ ├── logger.go │ │ │ │ ├── logger_test.go │ │ │ │ ├── message.go │ │ │ │ ├── metrics.go │ │ │ │ ├── mock_logger.go │ │ │ │ └── mock_metrics.go │ │ │ ├── google/ │ │ │ │ ├── google.go │ │ │ │ ├── google_test.go │ │ │ │ ├── health.go │ │ │ │ ├── helper.go │ │ │ │ ├── interfaces.go │ │ │ │ ├── message.go │ │ │ │ ├── message_test.go │ │ │ │ ├── metrics.go │ │ │ │ ├── mock_interfaces.go │ │ │ │ ├── mock_metrics.go │ │ │ │ ├── tracing.go │ │ │ │ └── tracing_test.go │ │ │ ├── interface.go │ │ │ ├── kafka/ │ │ │ │ ├── conn.go │ │ │ │ ├── errors.go │ │ │ │ ├── health.go │ │ │ │ ├── health_test.go │ │ │ │ ├── helper.go │ │ │ │ ├── interfaces.go │ │ │ │ ├── kafka.go │ │ │ │ ├── kafka_sasl.go │ │ │ │ ├── kafka_sasl_test.go │ │ │ │ ├── kafka_test.go │ │ │ │ ├── message.go │ │ │ │ ├── message_test.go │ │ │ │ ├── metrics.go │ │ │ │ ├── mock_interfaces.go │ │ │ │ ├── mock_metrics.go │ │ │ │ ├── tls.go │ │ │ │ ├── tls_test.go │ │ │ │ ├── tracing.go │ │ │ │ └── tracing_test.go │ │ │ ├── log.go │ │ │ ├── message.go │ │ │ ├── message_test.go │ │ │ ├── mqtt/ │ │ │ │ ├── default_client.go │ │ │ │ ├── helper.go │ │ │ │ ├── interface.go │ │ │ │ ├── message.go │ │ │ │ ├── message_test.go │ │ │ │ ├── mock_client.go │ │ │ │ ├── mock_interfaces.go │ │ │ │ ├── mock_token.go │ │ │ │ ├── mqtt.go │ │ │ │ └── mqtt_test.go │ │ │ ├── nats/ │ │ │ │ ├── client.go │ │ │ │ ├── client_helper.go │ │ │ │ ├── client_test.go │ │ │ │ ├── committer.go │ │ │ │ ├── committer_test.go │ │ │ │ ├── config.go │ │ │ │ ├── connection_manager.go │ │ │ │ ├── connection_manager_test.go │ │ │ │ ├── connectors.go │ │ │ │ ├── connectors_test.go │ │ │ │ ├── errors.go │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ ├── health.go │ │ │ │ ├── health_test.go │ │ │ │ ├── interfaces.go │ │ │ │ ├── message.go │ │ │ │ ├── message_test.go │ │ │ │ ├── metrics.go │ │ │ │ ├── mock_client.go │ │ │ │ ├── mock_jetstream.go │ │ │ │ ├── mock_metrics.go │ │ │ │ ├── mock_tracer.go │ │ │ │ ├── pubsub_wrapper.go │ │ │ │ ├── stream_manager.go │ │ │ │ ├── stream_manager_test.go │ │ │ │ ├── subscription_manager.go │ │ │ │ ├── subscription_manager_test.go │ │ │ │ ├── tracing.go │ │ │ │ ├── tracing_test.go │ │ │ │ └── wrapper_test.go │ │ │ └── sqs/ │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── health.go │ │ │ ├── health_test.go │ │ │ ├── interfaces.go │ │ │ ├── message.go │ │ │ ├── message_test.go │ │ │ ├── mock_client.go │ │ │ ├── sqs.go │ │ │ ├── sqs_test.go │ │ │ ├── tracing.go │ │ │ └── tracing_test.go │ │ ├── redis/ │ │ │ ├── config.go │ │ │ ├── config_test.go │ │ │ ├── health.go │ │ │ ├── health_test.go │ │ │ ├── hook.go │ │ │ ├── hook_test.go │ │ │ ├── messages.go │ │ │ ├── messages_test.go │ │ │ ├── metrics.go │ │ │ ├── mock_metrics.go │ │ │ ├── pubsub.go │ │ │ ├── pubsub_test.go │ │ │ ├── redis.go │ │ │ └── redis_test.go │ │ ├── scylladb/ │ │ │ ├── errors.go │ │ │ ├── errors_test.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── interface.go │ │ │ ├── internal.go │ │ │ ├── logger.go │ │ │ ├── logger_test.go │ │ │ ├── mock_interface.go │ │ │ ├── mock_logger.go │ │ │ ├── scylladb.go │ │ │ └── scylladb_test.go │ │ ├── solr/ │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── logger.go │ │ │ ├── metrics.go │ │ │ ├── mock_logger.go │ │ │ ├── mock_metrics.go │ │ │ ├── solr.go │ │ │ └── solr_test.go │ │ ├── sql/ │ │ │ ├── bind.go │ │ │ ├── bind_test.go │ │ │ ├── db.go │ │ │ ├── db_test.go │ │ │ ├── health.go │ │ │ ├── health_test.go │ │ │ ├── metrics.go │ │ │ ├── mock_metrics.go │ │ │ ├── query_builder.go │ │ │ ├── query_builder_test.go │ │ │ ├── sql.go │ │ │ ├── sql_mock.go │ │ │ ├── sql_test.go │ │ │ ├── supabase.go │ │ │ └── supabase_test.go │ │ └── surrealdb/ │ │ ├── go.mod │ │ ├── go.sum │ │ ├── interface.go │ │ ├── mock_interface.go │ │ ├── surrealdb.go │ │ ├── surrealdb_test.go │ │ ├── utils.go │ │ └── wrapper.go │ ├── default.go │ ├── exporter.go │ ├── exporter_test.go │ ├── external_db.go │ ├── external_db_test.go │ ├── factory.go │ ├── file/ │ │ ├── file.go │ │ ├── file_test.go │ │ ├── zip.go │ │ └── zip_test.go │ ├── gofr.go │ ├── gofr_test.go │ ├── graphql.go │ ├── graphql_test.go │ ├── grpc/ │ │ ├── log.go │ │ ├── log_test.go │ │ ├── middleware/ │ │ │ ├── apikey_auth.go │ │ │ ├── auth_test.go │ │ │ ├── basic_auth.go │ │ │ ├── common.go │ │ │ ├── oauth.go │ │ │ └── oauth_integration_test.go │ │ ├── rate_limiter.go │ │ └── rate_limiter_test.go │ ├── grpc.go │ ├── grpc_test.go │ ├── handler.go │ ├── handler_test.go │ ├── http/ │ │ ├── errors.go │ │ ├── errors_test.go │ │ ├── form_data_binder.go │ │ ├── form_data_binder_test.go │ │ ├── metrics.go │ │ ├── middleware/ │ │ │ ├── apikey_auth.go │ │ │ ├── apikey_auth_test.go │ │ │ ├── auth.go │ │ │ ├── auth_test.go │ │ │ ├── basic_auth.go │ │ │ ├── basic_auth_test.go │ │ │ ├── config.go │ │ │ ├── config_test.go │ │ │ ├── cors.go │ │ │ ├── cors_test.go │ │ │ ├── errors.go │ │ │ ├── errors_test.go │ │ │ ├── logger.go │ │ │ ├── logger_test.go │ │ │ ├── metrics.go │ │ │ ├── metrics_test.go │ │ │ ├── oauth.go │ │ │ ├── oauth_test.go │ │ │ ├── rate_limiter.go │ │ │ ├── rate_limiter_store.go │ │ │ ├── rate_limiter_test.go │ │ │ ├── tracer.go │ │ │ ├── tracer_test.go │ │ │ ├── validate.go │ │ │ ├── validate_test.go │ │ │ ├── web_socket.go │ │ │ └── web_socket_test.go │ │ ├── multipart_file_bind.go │ │ ├── multipart_file_bind_test.go │ │ ├── request.go │ │ ├── request_test.go │ │ ├── responder.go │ │ ├── responder_test.go │ │ ├── response/ │ │ │ ├── file.go │ │ │ ├── raw.go │ │ │ ├── redirect.go │ │ │ ├── response.go │ │ │ ├── template.go │ │ │ └── xml.go │ │ ├── router.go │ │ └── router_test.go │ ├── http_server.go │ ├── http_server_test.go │ ├── logging/ │ │ ├── ctx_logger.go │ │ ├── ctx_logger_test.go │ │ ├── level.go │ │ ├── level_test.go │ │ ├── logger.go │ │ ├── logger_test.go │ │ ├── mock_logger.go │ │ ├── mock_logger_test.go │ │ └── remotelogger/ │ │ ├── dynamic_level_logger.go │ │ ├── dynamic_level_logger_test.go │ │ └── mock_buffer_logger.go │ ├── metrics/ │ │ ├── errors.go │ │ ├── exporters/ │ │ │ ├── exporter.go │ │ │ ├── telemetry.go │ │ │ └── telemetry_test.go │ │ ├── handler.go │ │ ├── handler_test.go │ │ ├── register.go │ │ ├── register_test.go │ │ ├── store.go │ │ └── store_test.go │ ├── metrics_server.go │ ├── migration/ │ │ ├── arango.go │ │ ├── arango_test.go │ │ ├── cassandra.go │ │ ├── cassandra_test.go │ │ ├── clickhouse.go │ │ ├── clickhouse_test.go │ │ ├── datasource.go │ │ ├── datasource_test.go │ │ ├── dgraph.go │ │ ├── dgraph_test.go │ │ ├── elasticsearch.go │ │ ├── elasticsearch_test.go │ │ ├── interface.go │ │ ├── logger.go │ │ ├── migration.go │ │ ├── migration_test.go │ │ ├── mock_interface.go │ │ ├── mongo.go │ │ ├── mongo_test.go │ │ ├── opentsdb.go │ │ ├── opentsdb_test.go │ │ ├── oracle.go │ │ ├── oracle_test.go │ │ ├── pubsub.go │ │ ├── pubsub_test.go │ │ ├── redis.go │ │ ├── redis_test.go │ │ ├── scylla_db.go │ │ ├── scylla_db_test.go │ │ ├── sql.go │ │ ├── sql_test.go │ │ ├── surreal_db.go │ │ └── surreal_db_test.go │ ├── otel.go │ ├── otel_test.go │ ├── rbac/ │ │ ├── config.go │ │ ├── config_test.go │ │ ├── endpoint_matcher.go │ │ ├── endpoint_matcher_test.go │ │ ├── middleware.go │ │ └── middleware_test.go │ ├── rbac.go │ ├── rbac_test.go │ ├── request.go │ ├── responder.go │ ├── rest.go │ ├── run.go │ ├── service/ │ │ ├── apikey_auth.go │ │ ├── apikey_auth_test.go │ │ ├── auth.go │ │ ├── auth_test.go │ │ ├── basic_auth.go │ │ ├── basic_auth_test.go │ │ ├── circuit_breaker.go │ │ ├── circuit_breaker_test.go │ │ ├── connection_pool.go │ │ ├── connection_pool_test.go │ │ ├── custom_header.go │ │ ├── custom_header_test.go │ │ ├── errors.go │ │ ├── errors_test.go │ │ ├── health.go │ │ ├── health_config.go │ │ ├── health_config_test.go │ │ ├── health_test.go │ │ ├── logger.go │ │ ├── logger_test.go │ │ ├── metrics.go │ │ ├── mock_http_service.go │ │ ├── mock_metrics.go │ │ ├── mock_oauth_server.go │ │ ├── new.go │ │ ├── new_test.go │ │ ├── oauth.go │ │ ├── oauth_test.go │ │ ├── options.go │ │ ├── rate_limiter.go │ │ ├── rate_limiter_config.go │ │ ├── rate_limiter_config_test.go │ │ ├── rate_limiter_store.go │ │ ├── rate_limiter_store_test.go │ │ ├── rate_limiter_test.go │ │ ├── response.go │ │ ├── response_test.go │ │ ├── retry.go │ │ └── retry_test.go │ ├── shutdown.go │ ├── shutdown_test.go │ ├── static/ │ │ ├── files.go │ │ ├── index.css │ │ ├── index.html │ │ ├── oauth2-redirect.html │ │ ├── swagger-ui-bundle.js │ │ ├── swagger-ui-standalone-preset.js │ │ ├── swagger-ui.css │ │ └── swagger-ui.js │ ├── subscriber.go │ ├── subscriber_test.go │ ├── swagger.go │ ├── swagger_test.go │ ├── telemetry.go │ ├── testutil/ │ │ ├── error.go │ │ ├── error_test.go │ │ ├── os.go │ │ ├── os_test.go │ │ ├── port.go │ │ └── port_test.go │ ├── version/ │ │ └── version.go │ ├── websocket/ │ │ ├── interfaces.go │ │ ├── mock_interfaces.go │ │ ├── options.go │ │ ├── websocket.go │ │ └── websocket_test.go │ ├── websocket.go │ └── websocket_test.go └── typos.toml
Showing preview only (1,543K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (15011 symbols across 665 files)
FILE: examples/grpc/grpc-streaming-client/client/chat.pb.go
constant _ (line 18) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 20) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type Request (line 23) | type Request struct
method Reset (line 31) | func (x *Request) Reset() {
method String (line 40) | func (x *Request) String() string {
method ProtoMessage (line 44) | func (*Request) ProtoMessage() {}
method ProtoReflect (line 46) | func (x *Request) ProtoReflect() protoreflect.Message {
method Descriptor (line 59) | func (*Request) Descriptor() ([]byte, []int) {
method GetMessage (line 63) | func (x *Request) GetMessage() string {
type Response (line 70) | type Response struct
method Reset (line 78) | func (x *Response) Reset() {
method String (line 87) | func (x *Response) String() string {
method ProtoMessage (line 91) | func (*Response) ProtoMessage() {}
method ProtoReflect (line 93) | func (x *Response) ProtoReflect() protoreflect.Message {
method Descriptor (line 106) | func (*Response) Descriptor() ([]byte, []int) {
method GetMessage (line 110) | func (x *Response) GetMessage() string {
function file_chat_proto_rawDescGZIP (line 145) | func file_chat_proto_rawDescGZIP() []byte {
function init (line 171) | func init() { file_chat_proto_init() }
function file_chat_proto_init (line 172) | func file_chat_proto_init() {
FILE: examples/grpc/grpc-streaming-client/client/chat_grpc.pb.go
constant _ (line 19) | _ = grpc.SupportPackageIsVersion7
type ChatServiceClient (line 24) | type ChatServiceClient interface
type chatServiceClient (line 30) | type chatServiceClient struct
method ServerStream (line 38) | func (c *chatServiceClient) ServerStream(ctx context.Context, in *Requ...
method ClientStream (line 70) | func (c *chatServiceClient) ClientStream(ctx context.Context, opts ......
method BiDiStream (line 104) | func (c *chatServiceClient) BiDiStream(ctx context.Context, opts ...gr...
function NewChatServiceClient (line 34) | func NewChatServiceClient(cc grpc.ClientConnInterface) ChatServiceClient {
type ChatService_ServerStreamClient (line 53) | type ChatService_ServerStreamClient interface
type chatServiceServerStreamClient (line 58) | type chatServiceServerStreamClient struct
method Recv (line 62) | func (x *chatServiceServerStreamClient) Recv() (*Response, error) {
type ChatService_ClientStreamClient (line 79) | type ChatService_ClientStreamClient interface
type chatServiceClientStreamClient (line 85) | type chatServiceClientStreamClient struct
method Send (line 89) | func (x *chatServiceClientStreamClient) Send(m *Request) error {
method CloseAndRecv (line 93) | func (x *chatServiceClientStreamClient) CloseAndRecv() (*Response, err...
type ChatService_BiDiStreamClient (line 113) | type ChatService_BiDiStreamClient interface
type chatServiceBiDiStreamClient (line 119) | type chatServiceBiDiStreamClient struct
method Send (line 123) | func (x *chatServiceBiDiStreamClient) Send(m *Request) error {
method Recv (line 127) | func (x *chatServiceBiDiStreamClient) Recv() (*Response, error) {
type ChatServiceServer (line 138) | type ChatServiceServer interface
type UnimplementedChatServiceServer (line 146) | type UnimplementedChatServiceServer struct
method ServerStream (line 149) | func (UnimplementedChatServiceServer) ServerStream(*Request, ChatServi...
method ClientStream (line 152) | func (UnimplementedChatServiceServer) ClientStream(ChatService_ClientS...
method BiDiStream (line 155) | func (UnimplementedChatServiceServer) BiDiStream(ChatService_BiDiStrea...
method mustEmbedUnimplementedChatServiceServer (line 158) | func (UnimplementedChatServiceServer) mustEmbedUnimplementedChatServic...
type UnsafeChatServiceServer (line 163) | type UnsafeChatServiceServer interface
function RegisterChatServiceServer (line 167) | func RegisterChatServiceServer(s grpc.ServiceRegistrar, srv ChatServiceS...
function _ChatService_ServerStream_Handler (line 171) | func _ChatService_ServerStream_Handler(srv interface{}, stream grpc.Serv...
type ChatService_ServerStreamServer (line 179) | type ChatService_ServerStreamServer interface
type chatServiceServerStreamServer (line 184) | type chatServiceServerStreamServer struct
method Send (line 188) | func (x *chatServiceServerStreamServer) Send(m *Response) error {
function _ChatService_ClientStream_Handler (line 192) | func _ChatService_ClientStream_Handler(srv interface{}, stream grpc.Serv...
type ChatService_ClientStreamServer (line 196) | type ChatService_ClientStreamServer interface
type chatServiceClientStreamServer (line 202) | type chatServiceClientStreamServer struct
method SendAndClose (line 206) | func (x *chatServiceClientStreamServer) SendAndClose(m *Response) error {
method Recv (line 210) | func (x *chatServiceClientStreamServer) Recv() (*Request, error) {
function _ChatService_BiDiStream_Handler (line 218) | func _ChatService_BiDiStream_Handler(srv interface{}, stream grpc.Server...
type ChatService_BiDiStreamServer (line 222) | type ChatService_BiDiStreamServer interface
type chatServiceBiDiStreamServer (line 228) | type chatServiceBiDiStreamServer struct
method Send (line 232) | func (x *chatServiceBiDiStreamServer) Send(m *Response) error {
method Recv (line 236) | func (x *chatServiceBiDiStreamServer) Recv() (*Request, error) {
FILE: examples/grpc/grpc-streaming-client/client/chatservice_client.go
type ChatServiceGoFrClient (line 15) | type ChatServiceGoFrClient interface
type ChatServiceClientWrapper (line 22) | type ChatServiceClientWrapper struct
method ServerStream (line 51) | func (h *ChatServiceClientWrapper) ServerStream(ctx *gofr.Context, req...
method ClientStream (line 61) | func (h *ChatServiceClientWrapper) ClientStream(ctx *gofr.Context, opt...
method BiDiStream (line 71) | func (h *ChatServiceClientWrapper) BiDiStream(ctx *gofr.Context, opts ...
function NewChatServiceGoFrClient (line 27) | func NewChatServiceGoFrClient(host string, metrics metrics.Manager, dial...
FILE: examples/grpc/grpc-streaming-client/client/health_client.go
type HealthClient (line 28) | type HealthClient interface
type HealthClientWrapper (line 34) | type HealthClientWrapper struct
method Check (line 83) | func (h *HealthClientWrapper) Check(ctx *gofr.Context, in *grpc_health...
method Watch (line 95) | func (h *HealthClientWrapper) Watch(ctx *gofr.Context, in *grpc_health...
function NewHealthClient (line 38) | func NewHealthClient(conn *grpc.ClientConn) HealthClient {
function createGRPCConn (line 44) | func createGRPCConn(host string, serviceName string, dialOptions ...grpc...
function invokeRPC (line 65) | func invokeRPC(ctx *gofr.Context, rpcName string, rpcFunc func() (interf...
FILE: examples/grpc/grpc-streaming-client/main.go
function main (line 13) | func main() {
type ChatHandler (line 31) | type ChatHandler struct
method ServerStreamHandler (line 46) | func (c *ChatHandler) ServerStreamHandler(ctx *gofr.Context) (any, err...
method ClientStreamHandler (line 93) | func (c *ChatHandler) ClientStreamHandler(ctx *gofr.Context) (any, err...
method BiDiStreamHandler (line 147) | func (c *ChatHandler) BiDiStreamHandler(ctx *gofr.Context) (any, error) {
method receiveBiDiResponses (line 185) | func (c *ChatHandler) receiveBiDiResponses(ctx *gofr.Context, stream c...
method sendBiDiMessages (line 207) | func (c *ChatHandler) sendBiDiMessages(ctx *gofr.Context, stream clien...
method collectBiDiResponses (line 227) | func (c *ChatHandler) collectBiDiResponses(respChan <-chan StreamRespo...
function NewChatHandler (line 35) | func NewChatHandler(chatClient client.ChatServiceGoFrClient) *ChatHandler {
type StreamResponse (line 39) | type StreamResponse struct
FILE: examples/grpc/grpc-streaming-server/main.go
function main (line 8) | func main() {
FILE: examples/grpc/grpc-streaming-server/main_test.go
function TestMain (line 20) | func TestMain(m *testing.M) {
function TestServerStream (line 29) | func TestServerStream(t *testing.T) {
function TestClientStream (line 63) | func TestClientStream(t *testing.T) {
function TestBiDiStream (line 94) | func TestBiDiStream(t *testing.T) {
function TestServerStream_ContextCancellation (line 140) | func TestServerStream_ContextCancellation(t *testing.T) {
function TestClientStream_ContextCancellation (line 195) | func TestClientStream_ContextCancellation(t *testing.T) {
function TestClientStream_EOFHandling (line 239) | func TestClientStream_EOFHandling(t *testing.T) {
function TestBiDiStream_ContextCancellation (line 275) | func TestBiDiStream_ContextCancellation(t *testing.T) {
function TestServerStream_ErrorHandling (line 332) | func TestServerStream_ErrorHandling(t *testing.T) {
function TestBiDiStream_ErrorHandling (line 367) | func TestBiDiStream_ErrorHandling(t *testing.T) {
function TestServerStream_Timeout (line 414) | func TestServerStream_Timeout(t *testing.T) {
FILE: examples/grpc/grpc-streaming-server/server/chat.pb.go
constant _ (line 18) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 20) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type Request (line 23) | type Request struct
method Reset (line 31) | func (x *Request) Reset() {
method String (line 40) | func (x *Request) String() string {
method ProtoMessage (line 44) | func (*Request) ProtoMessage() {}
method ProtoReflect (line 46) | func (x *Request) ProtoReflect() protoreflect.Message {
method Descriptor (line 59) | func (*Request) Descriptor() ([]byte, []int) {
method GetMessage (line 63) | func (x *Request) GetMessage() string {
type Response (line 70) | type Response struct
method Reset (line 78) | func (x *Response) Reset() {
method String (line 87) | func (x *Response) String() string {
method ProtoMessage (line 91) | func (*Response) ProtoMessage() {}
method ProtoReflect (line 93) | func (x *Response) ProtoReflect() protoreflect.Message {
method Descriptor (line 106) | func (*Response) Descriptor() ([]byte, []int) {
method GetMessage (line 110) | func (x *Response) GetMessage() string {
function file_chat_proto_rawDescGZIP (line 145) | func file_chat_proto_rawDescGZIP() []byte {
function init (line 171) | func init() { file_chat_proto_init() }
function file_chat_proto_init (line 172) | func file_chat_proto_init() {
FILE: examples/grpc/grpc-streaming-server/server/chat_grpc.pb.go
constant _ (line 19) | _ = grpc.SupportPackageIsVersion7
type ChatServiceClient (line 24) | type ChatServiceClient interface
type chatServiceClient (line 30) | type chatServiceClient struct
method ServerStream (line 38) | func (c *chatServiceClient) ServerStream(ctx context.Context, in *Requ...
method ClientStream (line 70) | func (c *chatServiceClient) ClientStream(ctx context.Context, opts ......
method BiDiStream (line 104) | func (c *chatServiceClient) BiDiStream(ctx context.Context, opts ...gr...
function NewChatServiceClient (line 34) | func NewChatServiceClient(cc grpc.ClientConnInterface) ChatServiceClient {
type ChatService_ServerStreamClient (line 53) | type ChatService_ServerStreamClient interface
type chatServiceServerStreamClient (line 58) | type chatServiceServerStreamClient struct
method Recv (line 62) | func (x *chatServiceServerStreamClient) Recv() (*Response, error) {
type ChatService_ClientStreamClient (line 79) | type ChatService_ClientStreamClient interface
type chatServiceClientStreamClient (line 85) | type chatServiceClientStreamClient struct
method Send (line 89) | func (x *chatServiceClientStreamClient) Send(m *Request) error {
method CloseAndRecv (line 93) | func (x *chatServiceClientStreamClient) CloseAndRecv() (*Response, err...
type ChatService_BiDiStreamClient (line 113) | type ChatService_BiDiStreamClient interface
type chatServiceBiDiStreamClient (line 119) | type chatServiceBiDiStreamClient struct
method Send (line 123) | func (x *chatServiceBiDiStreamClient) Send(m *Request) error {
method Recv (line 127) | func (x *chatServiceBiDiStreamClient) Recv() (*Response, error) {
type ChatServiceServer (line 138) | type ChatServiceServer interface
type UnimplementedChatServiceServer (line 146) | type UnimplementedChatServiceServer struct
method ServerStream (line 149) | func (UnimplementedChatServiceServer) ServerStream(*Request, ChatServi...
method ClientStream (line 152) | func (UnimplementedChatServiceServer) ClientStream(ChatService_ClientS...
method BiDiStream (line 155) | func (UnimplementedChatServiceServer) BiDiStream(ChatService_BiDiStrea...
method mustEmbedUnimplementedChatServiceServer (line 158) | func (UnimplementedChatServiceServer) mustEmbedUnimplementedChatServic...
type UnsafeChatServiceServer (line 163) | type UnsafeChatServiceServer interface
function RegisterChatServiceServer (line 167) | func RegisterChatServiceServer(s grpc.ServiceRegistrar, srv ChatServiceS...
function _ChatService_ServerStream_Handler (line 171) | func _ChatService_ServerStream_Handler(srv interface{}, stream grpc.Serv...
type ChatService_ServerStreamServer (line 179) | type ChatService_ServerStreamServer interface
type chatServiceServerStreamServer (line 184) | type chatServiceServerStreamServer struct
method Send (line 188) | func (x *chatServiceServerStreamServer) Send(m *Response) error {
function _ChatService_ClientStream_Handler (line 192) | func _ChatService_ClientStream_Handler(srv interface{}, stream grpc.Serv...
type ChatService_ClientStreamServer (line 196) | type ChatService_ClientStreamServer interface
type chatServiceClientStreamServer (line 202) | type chatServiceClientStreamServer struct
method SendAndClose (line 206) | func (x *chatServiceClientStreamServer) SendAndClose(m *Response) error {
method Recv (line 210) | func (x *chatServiceClientStreamServer) Recv() (*Request, error) {
function _ChatService_BiDiStream_Handler (line 218) | func _ChatService_BiDiStream_Handler(srv interface{}, stream grpc.Server...
type ChatService_BiDiStreamServer (line 222) | type ChatService_BiDiStreamServer interface
type chatServiceBiDiStreamServer (line 228) | type chatServiceBiDiStreamServer struct
method Send (line 232) | func (x *chatServiceBiDiStreamServer) Send(m *Response) error {
method Recv (line 236) | func (x *chatServiceBiDiStreamServer) Recv() (*Request, error) {
FILE: examples/grpc/grpc-streaming-server/server/chatservice_gofr.go
function NewChatServiceGoFrServer (line 22) | func NewChatServiceGoFrServer() *ChatServiceGoFrServer {
type ChatServiceServerWithGofr (line 29) | type ChatServiceServerWithGofr interface
type ChatServiceServerWrapper (line 36) | type ChatServiceServerWrapper struct
method ServerStream (line 216) | func (h *ChatServiceServerWrapper) ServerStream(req *Request, stream C...
method ClientStream (line 230) | func (h *ChatServiceServerWrapper) ClientStream(stream ChatService_Cli...
method BiDiStream (line 244) | func (h *ChatServiceServerWrapper) BiDiStream(stream ChatService_BiDiS...
method mustEmbedUnimplementedChatServiceServer (line 259) | func (h *ChatServiceServerWrapper) mustEmbedUnimplementedChatServiceSe...
method getGofrContext (line 276) | func (h *ChatServiceServerWrapper) getGofrContext(ctx context.Context,...
type instrumentedStream (line 44) | type instrumentedStream struct
method Context (line 50) | func (s *instrumentedStream) Context() context.Context {
method SendMsg (line 54) | func (s *instrumentedStream) SendMsg(m interface{}) error {
method RecvMsg (line 68) | func (s *instrumentedStream) RecvMsg(m interface{}) error {
type serverStreamWrapperServerStream (line 83) | type serverStreamWrapperServerStream struct
method Send (line 87) | func (w *serverStreamWrapperServerStream) Send(m *Response) error {
type clientStreamWrapperClientStream (line 101) | type clientStreamWrapperClientStream struct
method SendAndClose (line 105) | func (w *clientStreamWrapperClientStream) SendAndClose(m *Response) er...
method Recv (line 119) | func (w *clientStreamWrapperClientStream) Recv() (*Request, error) {
type clientStreamWrapperBiDiStream (line 134) | type clientStreamWrapperBiDiStream struct
method SendAndClose (line 138) | func (w *clientStreamWrapperBiDiStream) SendAndClose(m *Response) error {
method Recv (line 152) | func (w *clientStreamWrapperBiDiStream) Recv() (*Request, error) {
type bidiStreamWrapperBiDiStream (line 167) | type bidiStreamWrapperBiDiStream struct
method Send (line 171) | func (w *bidiStreamWrapperBiDiStream) Send(m *Response) error {
method Recv (line 185) | func (w *bidiStreamWrapperBiDiStream) Recv() (*Request, error) {
method CloseSend (line 200) | func (w *bidiStreamWrapperBiDiStream) CloseSend() error {
function RegisterChatServiceServerWithGofr (line 262) | func RegisterChatServiceServerWithGofr(app *gofr.App, srv ChatServiceSer...
FILE: examples/grpc/grpc-streaming-server/server/chatservice_server.go
type ChatServiceGoFrServer (line 27) | type ChatServiceGoFrServer struct
method ServerStream (line 31) | func (s *ChatServiceGoFrServer) ServerStream(ctx *gofr.Context, stream...
method ClientStream (line 55) | func (s *ChatServiceGoFrServer) ClientStream(ctx *gofr.Context, stream...
method BiDiStream (line 83) | func (s *ChatServiceGoFrServer) BiDiStream(ctx *gofr.Context, stream C...
FILE: examples/grpc/grpc-streaming-server/server/health_gofr.go
type healthServer (line 21) | type healthServer struct
method Check (line 55) | func (h *healthServer) Check(ctx *gofr.Context, req *healthpb.HealthCh...
method Watch (line 66) | func (h *healthServer) Watch(ctx *gofr.Context, in *healthpb.HealthChe...
method SetServingStatus (line 77) | func (h *healthServer) SetServingStatus(ctx *gofr.Context, service str...
method Shutdown (line 87) | func (h *healthServer) Shutdown(ctx *gofr.Context) {
method Resume (line 97) | func (h *healthServer) Resume(ctx *gofr.Context) {
function getOrCreateHealthServer (line 29) | func getOrCreateHealthServer() *healthServer {
function registerServerWithGofr (line 36) | func registerServerWithGofr(app *gofr.App, srv any, registerFunc func(gr...
FILE: examples/grpc/grpc-streaming-server/server/request_gofr.go
type RequestWrapper (line 16) | type RequestWrapper struct
method Context (line 21) | func (h *RequestWrapper) Context() context.Context {
method Param (line 25) | func (h *RequestWrapper) Param(s string) string {
method PathParam (line 29) | func (h *RequestWrapper) PathParam(s string) string {
method Bind (line 33) | func (h *RequestWrapper) Bind(p interface{}) error {
method HostName (line 56) | func (h *RequestWrapper) HostName() string {
method Params (line 60) | func (h *RequestWrapper) Params(s string) []string {
FILE: examples/grpc/grpc-unary-client/client/health_client.go
type HealthClient (line 28) | type HealthClient interface
type HealthClientWrapper (line 34) | type HealthClientWrapper struct
method Check (line 83) | func (h *HealthClientWrapper) Check(ctx *gofr.Context, in *grpc_health...
method Watch (line 95) | func (h *HealthClientWrapper) Watch(ctx *gofr.Context, in *grpc_health...
function NewHealthClient (line 38) | func NewHealthClient(conn *grpc.ClientConn) HealthClient {
function createGRPCConn (line 44) | func createGRPCConn(host string, serviceName string, dialOptions ...grpc...
function invokeRPC (line 65) | func invokeRPC(ctx *gofr.Context, rpcName string, rpcFunc func() (interf...
FILE: examples/grpc/grpc-unary-client/client/health_test.go
function TestGoFrHealthClientWrapper_Creation (line 16) | func TestGoFrHealthClientWrapper_Creation(t *testing.T) {
function TestGoFrHealthClientWrapper_Methods (line 52) | func TestGoFrHealthClientWrapper_Methods(t *testing.T) {
function TestGoFrHealthClientWrapper_ContextIntegration (line 88) | func TestGoFrHealthClientWrapper_ContextIntegration(t *testing.T) {
function TestGoFrHealthClientWrapper_ErrorHandling (line 132) | func TestGoFrHealthClientWrapper_ErrorHandling(t *testing.T) {
FILE: examples/grpc/grpc-unary-client/client/hello.pb.go
constant _ (line 18) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 20) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type HelloRequest (line 23) | type HelloRequest struct
method Reset (line 31) | func (x *HelloRequest) Reset() {
method String (line 40) | func (x *HelloRequest) String() string {
method ProtoMessage (line 44) | func (*HelloRequest) ProtoMessage() {}
method ProtoReflect (line 46) | func (x *HelloRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 59) | func (*HelloRequest) Descriptor() ([]byte, []int) {
method GetName (line 63) | func (x *HelloRequest) GetName() string {
type HelloResponse (line 70) | type HelloResponse struct
method Reset (line 78) | func (x *HelloResponse) Reset() {
method String (line 87) | func (x *HelloResponse) String() string {
method ProtoMessage (line 91) | func (*HelloResponse) ProtoMessage() {}
method ProtoReflect (line 93) | func (x *HelloResponse) ProtoReflect() protoreflect.Message {
method Descriptor (line 106) | func (*HelloResponse) Descriptor() ([]byte, []int) {
method GetMessage (line 110) | func (x *HelloResponse) GetMessage() string {
function file_hello_proto_rawDescGZIP (line 140) | func file_hello_proto_rawDescGZIP() []byte {
function init (line 162) | func init() { file_hello_proto_init() }
function file_hello_proto_init (line 163) | func file_hello_proto_init() {
FILE: examples/grpc/grpc-unary-client/client/hello_client.go
type HelloGoFrClient (line 15) | type HelloGoFrClient interface
type HelloClientWrapper (line 20) | type HelloClientWrapper struct
method SayHello (line 48) | func (h *HelloClientWrapper) SayHello(ctx *gofr.Context, req *HelloReq...
function NewHelloGoFrClient (line 25) | func NewHelloGoFrClient(host string, metrics metrics.Manager, dialOption...
FILE: examples/grpc/grpc-unary-client/client/hello_grpc.pb.go
constant _ (line 19) | _ = grpc.SupportPackageIsVersion7
type HelloClient (line 24) | type HelloClient interface
type helloClient (line 28) | type helloClient struct
method SayHello (line 36) | func (c *helloClient) SayHello(ctx context.Context, in *HelloRequest, ...
function NewHelloClient (line 32) | func NewHelloClient(cc grpc.ClientConnInterface) HelloClient {
type HelloServer (line 48) | type HelloServer interface
type UnimplementedHelloServer (line 54) | type UnimplementedHelloServer struct
method SayHello (line 57) | func (UnimplementedHelloServer) SayHello(context.Context, *HelloReques...
method mustEmbedUnimplementedHelloServer (line 60) | func (UnimplementedHelloServer) mustEmbedUnimplementedHelloServer() {}
type UnsafeHelloServer (line 65) | type UnsafeHelloServer interface
function RegisterHelloServer (line 69) | func RegisterHelloServer(s grpc.ServiceRegistrar, srv HelloServer) {
function _Hello_SayHello_Handler (line 73) | func _Hello_SayHello_Handler(srv interface{}, ctx context.Context, dec f...
FILE: examples/grpc/grpc-unary-client/client/hello_test.go
function createTestContext (line 18) | func createTestContext() *gofr.Context {
function TestGoFrHelloClientWrapper_Creation (line 26) | func TestGoFrHelloClientWrapper_Creation(t *testing.T) {
function TestGoFrHelloClientWrapper_Methods (line 64) | func TestGoFrHelloClientWrapper_Methods(t *testing.T) {
function TestGoFrHelloClientWrapper_ContextIntegration (line 91) | func TestGoFrHelloClientWrapper_ContextIntegration(t *testing.T) {
function TestGoFrHelloClientWrapper_MultipleInstances (line 129) | func TestGoFrHelloClientWrapper_MultipleInstances(t *testing.T) {
function TestGoFrHelloClientWrapper_ErrorHandling (line 148) | func TestGoFrHelloClientWrapper_ErrorHandling(t *testing.T) {
function TestGoFrHelloClientWrapper_ConcurrentAccess (line 185) | func TestGoFrHelloClientWrapper_ConcurrentAccess(t *testing.T) {
FILE: examples/grpc/grpc-unary-client/main.go
function main (line 8) | func main() {
type GreetHandler (line 25) | type GreetHandler struct
method Hello (line 35) | func (g GreetHandler) Hello(ctx *gofr.Context) (any, error) {
function NewGreetHandler (line 29) | func NewGreetHandler(helloClient client.HelloGoFrClient) *GreetHandler {
FILE: examples/grpc/grpc-unary-client/main_test.go
type SimpleHelloServer (line 24) | type SimpleHelloServer struct
method SayHello (line 29) | func (s *SimpleHelloServer) SayHello(ctx context.Context, req *client....
function TestMain (line 35) | func TestMain(m *testing.M) {
function TestIntegration_UnaryClient (line 40) | func TestIntegration_UnaryClient(t *testing.T) {
function TestIntegration_UnaryClient_Concurrent (line 99) | func TestIntegration_UnaryClient_Concurrent(t *testing.T) {
function TestIntegration_UnaryClient_ErrorHandling (line 152) | func TestIntegration_UnaryClient_ErrorHandling(t *testing.T) {
FILE: examples/grpc/grpc-unary-server/main.go
function main (line 8) | func main() {
FILE: examples/grpc/grpc-unary-server/main_test.go
function TestMain (line 23) | func TestMain(m *testing.M) {
function TestIntegration_UnaryServer (line 28) | func TestIntegration_UnaryServer(t *testing.T) {
function TestIntegration_UnaryServer_Concurrent (line 63) | func TestIntegration_UnaryServer_Concurrent(t *testing.T) {
function TestIntegration_UnaryServer_ErrorHandling (line 96) | func TestIntegration_UnaryServer_ErrorHandling(t *testing.T) {
function TestHelloProtoMethods (line 132) | func TestHelloProtoMethods(t *testing.T) {
function TestIntegration_UnaryServer_RateLimited (line 144) | func TestIntegration_UnaryServer_RateLimited(t *testing.T) {
FILE: examples/grpc/grpc-unary-server/server/health_gofr.go
type healthServer (line 21) | type healthServer struct
method Check (line 55) | func (h *healthServer) Check(ctx *gofr.Context, req *healthpb.HealthCh...
method Watch (line 66) | func (h *healthServer) Watch(ctx *gofr.Context, in *healthpb.HealthChe...
method SetServingStatus (line 77) | func (h *healthServer) SetServingStatus(ctx *gofr.Context, service str...
method Shutdown (line 87) | func (h *healthServer) Shutdown(ctx *gofr.Context) {
method Resume (line 97) | func (h *healthServer) Resume(ctx *gofr.Context) {
function getOrCreateHealthServer (line 29) | func getOrCreateHealthServer() *healthServer {
function registerServerWithGofr (line 36) | func registerServerWithGofr(app *gofr.App, srv any, registerFunc func(gr...
FILE: examples/grpc/grpc-unary-server/server/health_test.go
function createTestContext (line 17) | func createTestContext() *gofr.Context {
function TestGoFrHealthServer_Creation (line 25) | func TestGoFrHealthServer_Creation(t *testing.T) {
function TestGoFrHealthServer_Methods (line 45) | func TestGoFrHealthServer_Methods(t *testing.T) {
function TestGoFrHealthServer_SetServingStatus (line 78) | func TestGoFrHealthServer_SetServingStatus(t *testing.T) {
function TestGoFrHealthServer_Shutdown (line 112) | func TestGoFrHealthServer_Shutdown(t *testing.T) {
function TestGoFrHealthServer_Resume (line 135) | func TestGoFrHealthServer_Resume(t *testing.T) {
function TestGoFrHealthServer_MultipleInstances (line 158) | func TestGoFrHealthServer_MultipleInstances(t *testing.T) {
FILE: examples/grpc/grpc-unary-server/server/hello.pb.go
constant _ (line 18) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 20) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type HelloRequest (line 23) | type HelloRequest struct
method Reset (line 31) | func (x *HelloRequest) Reset() {
method String (line 40) | func (x *HelloRequest) String() string {
method ProtoMessage (line 44) | func (*HelloRequest) ProtoMessage() {}
method ProtoReflect (line 46) | func (x *HelloRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 59) | func (*HelloRequest) Descriptor() ([]byte, []int) {
method GetName (line 63) | func (x *HelloRequest) GetName() string {
type HelloResponse (line 70) | type HelloResponse struct
method Reset (line 78) | func (x *HelloResponse) Reset() {
method String (line 87) | func (x *HelloResponse) String() string {
method ProtoMessage (line 91) | func (*HelloResponse) ProtoMessage() {}
method ProtoReflect (line 93) | func (x *HelloResponse) ProtoReflect() protoreflect.Message {
method Descriptor (line 106) | func (*HelloResponse) Descriptor() ([]byte, []int) {
method GetMessage (line 110) | func (x *HelloResponse) GetMessage() string {
function file_hello_proto_rawDescGZIP (line 140) | func file_hello_proto_rawDescGZIP() []byte {
function init (line 162) | func init() { file_hello_proto_init() }
function file_hello_proto_init (line 163) | func file_hello_proto_init() {
FILE: examples/grpc/grpc-unary-server/server/hello_gofr.go
function NewHelloGoFrServer (line 24) | func NewHelloGoFrServer() *HelloGoFrServer {
type HelloServerWithGofr (line 31) | type HelloServerWithGofr interface
type HelloServerWrapper (line 36) | type HelloServerWrapper struct
method SayHello (line 85) | func (h *HelloServerWrapper) SayHello(ctx context.Context, req *HelloR...
method mustEmbedUnimplementedHelloServer (line 102) | func (h *HelloServerWrapper) mustEmbedUnimplementedHelloServer() {}
method getGofrContext (line 119) | func (h *HelloServerWrapper) getGofrContext(ctx context.Context, req g...
type instrumentedStream (line 44) | type instrumentedStream struct
method Context (line 50) | func (s *instrumentedStream) Context() context.Context {
method SendMsg (line 54) | func (s *instrumentedStream) SendMsg(m interface{}) error {
method RecvMsg (line 68) | func (s *instrumentedStream) RecvMsg(m interface{}) error {
function RegisterHelloServerWithGofr (line 105) | func RegisterHelloServerWithGofr(app *gofr.App, srv HelloServerWithGofr) {
FILE: examples/grpc/grpc-unary-server/server/hello_grpc.pb.go
constant _ (line 19) | _ = grpc.SupportPackageIsVersion7
type HelloClient (line 24) | type HelloClient interface
type helloClient (line 28) | type helloClient struct
method SayHello (line 36) | func (c *helloClient) SayHello(ctx context.Context, in *HelloRequest, ...
function NewHelloClient (line 32) | func NewHelloClient(cc grpc.ClientConnInterface) HelloClient {
type HelloServer (line 48) | type HelloServer interface
type UnimplementedHelloServer (line 54) | type UnimplementedHelloServer struct
method SayHello (line 57) | func (UnimplementedHelloServer) SayHello(context.Context, *HelloReques...
method mustEmbedUnimplementedHelloServer (line 60) | func (UnimplementedHelloServer) mustEmbedUnimplementedHelloServer() {}
type UnsafeHelloServer (line 65) | type UnsafeHelloServer interface
function RegisterHelloServer (line 69) | func RegisterHelloServer(s grpc.ServiceRegistrar, srv HelloServer) {
function _Hello_SayHello_Handler (line 73) | func _Hello_SayHello_Handler(srv interface{}, ctx context.Context, dec f...
FILE: examples/grpc/grpc-unary-server/server/hello_server.go
type HelloGoFrServer (line 21) | type HelloGoFrServer struct
method SayHello (line 25) | func (s *HelloGoFrServer) SayHello(ctx *gofr.Context) (any, error) {
FILE: examples/grpc/grpc-unary-server/server/hello_server_test.go
function TestServer_SayHello (line 13) | func TestServer_SayHello(t *testing.T) {
FILE: examples/grpc/grpc-unary-server/server/hello_test.go
function TestGoFrHelloServer_Creation (line 19) | func TestGoFrHelloServer_Creation(t *testing.T) {
function TestGoFrHelloServer_Methods (line 48) | func TestGoFrHelloServer_Methods(t *testing.T) {
function TestGoFrHelloServer_ContextIntegration (line 93) | func TestGoFrHelloServer_ContextIntegration(t *testing.T) {
function TestGoFrHelloServer_Registration (line 133) | func TestGoFrHelloServer_Registration(t *testing.T) {
function TestGoFrHelloServer_HealthIntegration (line 149) | func TestGoFrHelloServer_HealthIntegration(t *testing.T) {
function TestGoFrHelloServer_MultipleInstances (line 178) | func TestGoFrHelloServer_MultipleInstances(t *testing.T) {
function TestNewHelloGoFrServer (line 200) | func TestNewHelloGoFrServer(t *testing.T) {
function TestHelloServerWrapper_SayHello (line 215) | func TestHelloServerWrapper_SayHello(t *testing.T) {
function TestHelloServerWrapper_getGofrContext (line 285) | func TestHelloServerWrapper_getGofrContext(t *testing.T) {
function TestInstrumentedStream (line 309) | func TestInstrumentedStream(t *testing.T) {
type mockHelloServer (line 371) | type mockHelloServer struct
method SayHello (line 373) | func (m *mockHelloServer) SayHello(ctx *gofr.Context) (any, error) {
type mockHelloServerWithError (line 382) | type mockHelloServerWithError struct
method SayHello (line 384) | func (m *mockHelloServerWithError) SayHello(ctx *gofr.Context) (any, e...
type mockHelloServerWrongType (line 388) | type mockHelloServerWrongType struct
method SayHello (line 390) | func (m *mockHelloServerWrongType) SayHello(ctx *gofr.Context) (any, e...
type mockServerStream (line 394) | type mockServerStream struct
method SendMsg (line 399) | func (m *mockServerStream) SendMsg(msg interface{}) error {
method RecvMsg (line 404) | func (m *mockServerStream) RecvMsg(msg interface{}) error {
method SetHeader (line 409) | func (m *mockServerStream) SetHeader(metadata.MD) error {
method SendHeader (line 413) | func (m *mockServerStream) SendHeader(metadata.MD) error {
method SetTrailer (line 417) | func (m *mockServerStream) SetTrailer(metadata.MD) {
method Context (line 420) | func (m *mockServerStream) Context() context.Context {
FILE: examples/grpc/grpc-unary-server/server/request_gofr.go
type HelloRequestWrapper (line 17) | type HelloRequestWrapper struct
method Context (line 22) | func (h *HelloRequestWrapper) Context() context.Context {
method Param (line 26) | func (h *HelloRequestWrapper) Param(s string) string {
method PathParam (line 30) | func (h *HelloRequestWrapper) PathParam(s string) string {
method Bind (line 34) | func (h *HelloRequestWrapper) Bind(p interface{}) error {
method HostName (line 57) | func (h *HelloRequestWrapper) HostName() string {
method Params (line 61) | func (h *HelloRequestWrapper) Params(s string) []string {
FILE: examples/grpc/grpc-unary-server/server/request_test.go
function TestHelloRequestWrapper_Context (line 13) | func TestHelloRequestWrapper_Context(t *testing.T) {
function TestHelloRequestWrapper_Param (line 30) | func TestHelloRequestWrapper_Param(t *testing.T) {
function TestHelloRequestWrapper_PathParam (line 45) | func TestHelloRequestWrapper_PathParam(t *testing.T) {
function TestHelloRequestWrapper_HostName (line 60) | func TestHelloRequestWrapper_HostName(t *testing.T) {
function TestHelloRequestWrapper_Params (line 75) | func TestHelloRequestWrapper_Params(t *testing.T) {
function TestHelloRequestWrapper_Bind (line 90) | func TestHelloRequestWrapper_Bind(t *testing.T) {
FILE: examples/http-server-using-redis/main.go
constant redisExpiryTime (line 9) | redisExpiryTime = 5
function main (line 11) | func main() {
function RedisSetHandler (line 46) | func RedisSetHandler(c *gofr.Context) (any, error) {
function RedisGetHandler (line 64) | func RedisGetHandler(c *gofr.Context) (any, error) {
function RedisPipelineHandler (line 79) | func RedisPipelineHandler(c *gofr.Context) (any, error) {
FILE: examples/http-server-using-redis/main_test.go
function TestMain (line 25) | func TestMain(m *testing.M) {
function TestHTTPServerUsingRedis (line 30) | func TestHTTPServerUsingRedis(t *testing.T) {
function TestRedisSetHandler (line 65) | func TestRedisSetHandler(t *testing.T) {
function TestRedisPipelineHandler (line 90) | func TestRedisPipelineHandler(t *testing.T) {
FILE: examples/http-server/main.go
function main (line 17) | func main() {
function HelloHandler (line 35) | func HelloHandler(c *gofr.Context) (any, error) {
function ErrorHandler (line 45) | func ErrorHandler(c *gofr.Context) (any, error) {
function RedisHandler (line 49) | func RedisHandler(c *gofr.Context) (any, error) {
function TraceHandler (line 58) | func TraceHandler(c *gofr.Context) (any, error) {
function MysqlHandler (line 103) | func MysqlHandler(c *gofr.Context) (any, error) {
FILE: examples/http-server/main_test.go
function TestMain (line 44) | func TestMain(m *testing.M) {
function TestIntegration_SimpleAPIServer (line 49) | func TestIntegration_SimpleAPIServer(t *testing.T) {
function TestIntegration_SimpleAPIServer_Errors (line 99) | func TestIntegration_SimpleAPIServer_Errors(t *testing.T) {
function TestIntegration_SimpleAPIServer_Health (line 164) | func TestIntegration_SimpleAPIServer_Health(t *testing.T) {
function TestRedisHandler (line 198) | func TestRedisHandler(t *testing.T) {
type MockRequest (line 224) | type MockRequest struct
method HostName (line 229) | func (m *MockRequest) HostName() string {
method Params (line 237) | func (m *MockRequest) Params(s string) []string {
method Param (line 261) | func (m *MockRequest) Param(key string) string {
method PathParam (line 266) | func (m *MockRequest) PathParam(key string) string {
method Bind (line 271) | func (m *MockRequest) Bind(i any) error {
function NewMockRequest (line 245) | func NewMockRequest(req *http.Request) *MockRequest {
function createTestContext (line 280) | func createTestContext(method, url string, mockContainer *container.Cont...
function TestHelloHandler (line 305) | func TestHelloHandler(t *testing.T) {
function TestErrorHandler (line 319) | func TestErrorHandler(t *testing.T) {
function TestMysqlHandler (line 328) | func TestMysqlHandler(t *testing.T) {
function TestTraceHandler (line 342) | func TestTraceHandler(t *testing.T) {
FILE: examples/sample-cmd/main.go
function main (line 11) | func main() {
function spinner (line 36) | func spinner(ctx *gofr.Context) (any, error) {
function progress (line 52) | func progress(ctx *gofr.Context) (any, error) {
FILE: examples/sample-cmd/main_test.go
function TestMain (line 19) | func TestMain(m *testing.M) {
function TestCMDRunWithNoArg (line 25) | func TestCMDRunWithNoArg(t *testing.T) {
function TestCMDRunWithProperArg (line 32) | func TestCMDRunWithProperArg(t *testing.T) {
function TestCMDRunWithParams (line 41) | func TestCMDRunWithParams(t *testing.T) {
function TestCMDRun_Spinner (line 59) | func TestCMDRun_Spinner(t *testing.T) {
function TestCMDRun_SpinnerContextCancelled (line 69) | func TestCMDRun_SpinnerContextCancelled(t *testing.T) {
function TestCMDRun_Progress (line 85) | func TestCMDRun_Progress(t *testing.T) {
function TestCMDRun_ProgressContextCancelled (line 97) | func TestCMDRun_ProgressContextCancelled(t *testing.T) {
function TestCMDRunWithInvalidCommand (line 119) | func TestCMDRunWithInvalidCommand(t *testing.T) {
function TestCMDRunWithEmptyParams (line 128) | func TestCMDRunWithEmptyParams(t *testing.T) {
function TestCMDRunHelpCommand (line 137) | func TestCMDRunHelpCommand(t *testing.T) {
function TestCMDRunHelpForSpecificCommand (line 158) | func TestCMDRunHelpForSpecificCommand(t *testing.T) {
FILE: examples/using-add-filestore/main.go
type FileServerType (line 13) | type FileServerType
constant FTP (line 16) | FTP FileServerType = iota
constant SFTP (line 17) | SFTP
function main (line 20) | func main() {
function pwdCommandHandler (line 36) | func pwdCommandHandler(c *gofr.Context) (any, error) {
function lsCommandHandler (line 42) | func lsCommandHandler(c *gofr.Context) (any, error) {
function grepCommandHandler (line 55) | func grepCommandHandler(c *gofr.Context) (any, error) {
function createFileCommandHandler (line 70) | func createFileCommandHandler(c *gofr.Context) (any, error) {
function rmCommandHandler (line 81) | func rmCommandHandler(c *gofr.Context) (any, error) {
function configureFileServer (line 93) | func configureFileServer(app *gofr.App) file.FileSystemProvider {
function printFiles (line 105) | func printFiles(files []file.FileInfo) {
function grepFiles (line 111) | func grepFiles(files []file.FileInfo, keyword string) {
FILE: examples/using-add-filestore/main_test.go
type mockFileInfo (line 21) | type mockFileInfo struct
method Name (line 25) | func (m mockFileInfo) Name() string { return m.name }
method Size (line 26) | func (mockFileInfo) Size() int64 { return 0 }
method Mode (line 27) | func (mockFileInfo) Mode() os.FileMode { return 0 }
method ModTime (line 28) | func (mockFileInfo) ModTime() time.Time { return time.Now() }
method IsDir (line 29) | func (mockFileInfo) IsDir() bool { return false }
method Sys (line 30) | func (mockFileInfo) Sys() any { return nil }
function getContext (line 32) | func getContext(request gofr.Request, fileMock file.FileSystem) *gofr.Co...
function TestPwdCommandHandler (line 40) | func TestPwdCommandHandler(t *testing.T) {
function TestLSCommandHandler (line 57) | func TestLSCommandHandler(t *testing.T) {
function TestGrepCommandHandler (line 94) | func TestGrepCommandHandler(t *testing.T) {
function TestCreateFileCommand (line 130) | func TestCreateFileCommand(t *testing.T) {
function TestRmCommand (line 150) | func TestRmCommand(t *testing.T) {
FILE: examples/using-add-rest-handlers/main.go
type user (line 8) | type user struct
method GetAll (line 16) | func (u *user) GetAll(c *gofr.Context) (any, error) {
function main (line 20) | func main() {
FILE: examples/using-add-rest-handlers/main_test.go
function TestMain (line 16) | func TestMain(m *testing.M) {
function TestIntegration_AddRESTHandlers (line 21) | func TestIntegration_AddRESTHandlers(t *testing.T) {
FILE: examples/using-add-rest-handlers/migrations/1721816030_create_user_table.go
constant createTable (line 7) | createTable = `CREATE TABLE IF NOT EXISTS user (
function createTableUser (line 14) | func createTableUser() migration.Migrate {
FILE: examples/using-add-rest-handlers/migrations/1721816030_create_user_table_test.go
function TestCreateTableUser (line 14) | func TestCreateTableUser(t *testing.T) {
FILE: examples/using-add-rest-handlers/migrations/all.go
function All (line 7) | func All() map[int64]migration.Migrate {
FILE: examples/using-add-rest-handlers/migrations/all_test.go
function TestAll (line 11) | func TestAll(t *testing.T) {
FILE: examples/using-cron-jobs/main.go
constant duration (line 14) | duration = 3
function main (line 16) | func main() {
function count (line 25) | func count(c *gofr.Context) {
FILE: examples/using-cron-jobs/main_test.go
function TestMain (line 13) | func TestMain(m *testing.M) {
function Test_UserPurgeCron (line 18) | func Test_UserPurgeCron(t *testing.T) {
FILE: examples/using-custom-metrics/main.go
constant transactionSuccessful (line 12) | transactionSuccessful = "transaction_success"
constant transactionTime (line 13) | transactionTime = "transaction_time"
constant totalCreditDaySales (line 14) | totalCreditDaySales = "total_credit_day_sale"
constant productStock (line 15) | productStock = "product_stock"
function main (line 18) | func main() {
function TransactionHandler (line 36) | func TransactionHandler(c *gofr.Context) (any, error) {
function ReturnHandler (line 52) | func ReturnHandler(c *gofr.Context) (any, error) {
FILE: examples/using-custom-metrics/main_test.go
function TestMain (line 16) | func TestMain(m *testing.M) {
function TestIntegration (line 21) | func TestIntegration(t *testing.T) {
FILE: examples/using-file-bind/main.go
function main (line 13) | func main() {
type Data (line 22) | type Data struct
function UploadHandler (line 36) | func UploadHandler(c *gofr.Context) (any, error) {
FILE: examples/using-file-bind/main_test.go
function TestMain (line 18) | func TestMain(m *testing.M) {
function TestMain_BindError (line 23) | func TestMain_BindError(t *testing.T) {
function generateMultiPartBody (line 47) | func generateMultiPartBody(t *testing.T) (*bytes.Buffer, string) {
FILE: examples/using-graphql/main.go
type User (line 9) | type User struct
function main (line 15) | func main() {
FILE: examples/using-graphql/main_test.go
function waitForReady (line 19) | func waitForReady(t *testing.T, host string) {
function newTestApp (line 38) | func newTestApp(t *testing.T) (*gofr.App, string) {
function TestIntegration_GraphQL (line 85) | func TestIntegration_GraphQL(t *testing.T) {
FILE: examples/using-graphql/migrations/20240205125300_create_users_table.go
function CreateUsersTable (line 7) | func CreateUsersTable() migration.Migrate {
FILE: examples/using-graphql/migrations/all.go
function All (line 7) | func All() map[int64]migration.Migrate {
FILE: examples/using-html-template/main.go
function main (line 8) | func main() {
type Todo (line 15) | type Todo struct
type TodoPageData (line 20) | type TodoPageData struct
function listHandler (line 25) | func listHandler(*gofr.Context) (any, error) {
FILE: examples/using-html-template/main_test.go
function TestMain (line 18) | func TestMain(m *testing.M) {
function Test_ListHandler (line 23) | func Test_ListHandler(t *testing.T) {
function Test_IndexHTML (line 60) | func Test_IndexHTML(t *testing.T) {
function Test_404HTML (line 89) | func Test_404HTML(t *testing.T) {
FILE: examples/using-http-auth-middleware/main.go
function main (line 8) | func main() {
function testHandler (line 24) | func testHandler(_ *gofr.Context) (any, error) {
function setupBasicAuth (line 28) | func setupBasicAuth(a *gofr.App) {
function setupAPIKeyAuth (line 44) | func setupAPIKeyAuth(a *gofr.App) {
FILE: examples/using-http-auth-middleware/main_test.go
function Test_setupAPIKeyAuthFailed (line 11) | func Test_setupAPIKeyAuthFailed(t *testing.T) {
function Test_setupAPIKeyAuthSuccess (line 38) | func Test_setupAPIKeyAuthSuccess(t *testing.T) {
FILE: examples/using-http-service/main.go
function main (line 12) | func main() {
function Handler (line 54) | func Handler(c *gofr.Context) (any, error) {
FILE: examples/using-http-service/main_test.go
function TestMain (line 28) | func TestMain(m *testing.M) {
function Test_main (line 33) | func Test_main(t *testing.T) {
function TestHTTPHandlerURLError (line 81) | func TestHTTPHandlerURLError(t *testing.T) {
function TestHTTPHandlerResponseUnmarshalError (line 101) | func TestHTTPHandlerResponseUnmarshalError(t *testing.T) {
FILE: examples/using-migrations/main.go
constant queryGetEmployee (line 12) | queryGetEmployee = "SELECT id,name,gender,contact_number,dob from emp...
constant queryInsertEmployee (line 13) | queryInsertEmployee = "INSERT INTO employee (id, name, gender, contact_n...
function main (line 16) | func main() {
type Employee (line 31) | type Employee struct
function GetHandler (line 40) | func GetHandler(c *gofr.Context) (any, error) {
function PostHandler (line 58) | func PostHandler(c *gofr.Context) (any, error) {
FILE: examples/using-migrations/main_test.go
function TestMain (line 16) | func TestMain(m *testing.M) {
function TestExampleMigration (line 21) | func TestExampleMigration(t *testing.T) {
FILE: examples/using-migrations/migrations/1722507126_create_employee_table.go
constant createTable (line 7) | createTable = `CREATE TABLE IF NOT EXISTS employee
constant employee_date (line 16) | employee_date = `INSERT INTO employee (id, name, gender, contact_number)...
function createTableEmployee (line 18) | func createTableEmployee() migration.Migrate {
FILE: examples/using-migrations/migrations/1722507126_create_employee_table_test.go
function TestCreateTableEmployee (line 14) | func TestCreateTableEmployee(t *testing.T) {
FILE: examples/using-migrations/migrations/1722507180_redis_add_employee_name.go
function addEmployeeInRedis (line 9) | func addEmployeeInRedis() migration.Migrate {
FILE: examples/using-migrations/migrations/1722507180_redis_add_employee_name_test.go
function TestAddEmployeeInRedis (line 13) | func TestAddEmployeeInRedis(t *testing.T) {
function TestAddEmployeeInRedis_Error (line 25) | func TestAddEmployeeInRedis_Error(t *testing.T) {
FILE: examples/using-migrations/migrations/all.go
function All (line 7) | func All() map[int64]migration.Migrate {
FILE: examples/using-migrations/migrations/all_test.go
function TestAll (line 11) | func TestAll(t *testing.T) {
FILE: examples/using-publisher/main.go
function main (line 10) | func main() {
function order (line 21) | func order(ctx *gofr.Context) (any, error) {
function product (line 44) | func product(ctx *gofr.Context) (any, error) {
FILE: examples/using-publisher/main_test.go
function TestMain (line 24) | func TestMain(m *testing.M) {
function TestExamplePublisherError (line 29) | func TestExamplePublisherError(t *testing.T) {
function TestOrderFunction (line 62) | func TestOrderFunction(t *testing.T) {
function TestProductFunction (line 94) | func TestProductFunction(t *testing.T) {
function testHandler (line 126) | func testHandler(t *testing.T, name string, handler func(*gofr.Context) ...
type testRequest (line 144) | type testRequest struct
method Bind (line 149) | func (r *testRequest) Bind(v interface{}) error {
method Param (line 153) | func (r *testRequest) Param(key string) string { return r.URL.Quer...
method PathParam (line 154) | func (r *testRequest) PathParam(key string) string { return "" }
method HostName (line 155) | func (r *testRequest) HostName() string { return r.Host }
method Params (line 156) | func (r *testRequest) Params(key string) []string { return r.URL.Quer...
FILE: examples/using-publisher/migrations/1721801313_create_topics.go
function createTopics (line 9) | func createTopics() migration.Migrate {
FILE: examples/using-publisher/migrations/1721801313_create_topics_test.go
type MockPubSub (line 13) | type MockPubSub struct
method Query (line 18) | func (*MockPubSub) Query(_ context.Context, _ string, _ ...any) ([]byt...
method DeleteTopic (line 22) | func (*MockPubSub) DeleteTopic(_ context.Context, _ string) error {
method CreateTopic (line 26) | func (m *MockPubSub) CreateTopic(_ context.Context, topic string) error {
function TestCreateTopics (line 34) | func TestCreateTopics(t *testing.T) {
FILE: examples/using-publisher/migrations/all.go
function All (line 7) | func All() map[int64]migration.Migrate {
FILE: examples/using-publisher/migrations/all_test.go
function TestAll (line 11) | func TestAll(t *testing.T) {
FILE: examples/using-subscriber/main.go
function main (line 8) | func main() {
function productHandler (line 20) | func productHandler(c *gofr.Context) error {
function orderHandler (line 38) | func orderHandler(c *gofr.Context) error {
FILE: examples/using-subscriber/main_test.go
function TestMain (line 17) | func TestMain(m *testing.M) {
function TestMainInitialization (line 23) | func TestMainInitialization(t *testing.T) {
type errorRequest (line 36) | type errorRequest struct
method Context (line 38) | func (e *errorRequest) Context() context.Context {
method Bind (line 42) | func (e *errorRequest) Bind(v interface{}) error { return errors.Ne...
method Param (line 43) | func (e *errorRequest) Param(key string) string { return "" }
method PathParam (line 44) | func (e *errorRequest) PathParam(key string) string { return "" }
method HostName (line 45) | func (e *errorRequest) HostName() string { return "" }
method Params (line 46) | func (e *errorRequest) Params(key string) []string { return nil }
function TestProductSubscribe_BindError (line 48) | func TestProductSubscribe_BindError(t *testing.T) {
function TestOrderSubscribe_BindError (line 64) | func TestOrderSubscribe_BindError(t *testing.T) {
type successProductRequest (line 79) | type successProductRequest struct
method Context (line 81) | func (r *successProductRequest) Context() context.Context {
method Bind (line 85) | func (r *successProductRequest) Bind(v interface{}) error {
method Param (line 95) | func (r *successProductRequest) Param(string) string { return "" }
method PathParam (line 96) | func (r *successProductRequest) PathParam(string) string { return "" }
method HostName (line 97) | func (r *successProductRequest) HostName() string { return "" }
method Params (line 98) | func (r *successProductRequest) Params(string) []string { return nil }
function TestProductHandler_Success (line 100) | func TestProductHandler_Success(t *testing.T) {
type successOrderRequest (line 114) | type successOrderRequest struct
method Context (line 116) | func (r *successOrderRequest) Context() context.Context {
method Bind (line 120) | func (r *successOrderRequest) Bind(v interface{}) error {
method Param (line 129) | func (r *successOrderRequest) Param(string) string { return "" }
method PathParam (line 130) | func (r *successOrderRequest) PathParam(string) string { return "" }
method HostName (line 131) | func (r *successOrderRequest) HostName() string { return "" }
method Params (line 132) | func (r *successOrderRequest) Params(string) []string { return nil }
function TestOrderHandler_Success (line 134) | func TestOrderHandler_Success(t *testing.T) {
FILE: examples/using-subscriber/migrations/1721800255_create_topics.go
function createTopics (line 9) | func createTopics() migration.Migrate {
FILE: examples/using-subscriber/migrations/1721800255_create_topics_test.go
type MockPubSub (line 14) | type MockPubSub struct
method Query (line 19) | func (*MockPubSub) Query(_ context.Context, _ string, _ ...any) ([]byt...
method DeleteTopic (line 23) | func (*MockPubSub) DeleteTopic(_ context.Context, _ string) error {
method CreateTopic (line 27) | func (m *MockPubSub) CreateTopic(_ context.Context, topic string) error {
function TestCreateTopics (line 35) | func TestCreateTopics(t *testing.T) {
FILE: examples/using-subscriber/migrations/all.go
function All (line 7) | func All() map[int64]migration.Migrate {
FILE: examples/using-subscriber/migrations/all_test.go
function TestAll (line 11) | func TestAll(t *testing.T) {
FILE: examples/using-web-socket/main.go
function main (line 7) | func main() {
function WSHandler (line 15) | func WSHandler(ctx *gofr.Context) (any, error) {
FILE: examples/using-web-socket/main_test.go
function TestMain (line 15) | func TestMain(m *testing.M) {
function Test_WebSocket_Success (line 20) | func Test_WebSocket_Success(t *testing.T) {
FILE: pkg/gofr/auth.go
method EnableBasicAuth (line 19) | func (a *App) EnableBasicAuth(credentials ...string) {
method EnableBasicAuthWithFunc (line 46) | func (a *App) EnableBasicAuthWithFunc(validateFunc func(username, passwo...
method EnableBasicAuthWithValidator (line 57) | func (a *App) EnableBasicAuthWithValidator(validateFunc func(c *containe...
method EnableAPIKeyAuth (line 68) | func (a *App) EnableAPIKeyAuth(apiKeys ...string) {
method EnableAPIKeyAuthWithFunc (line 79) | func (a *App) EnableAPIKeyAuthWithFunc(validateFunc func(apiKey string) ...
method EnableAPIKeyAuthWithValidator (line 92) | func (a *App) EnableAPIKeyAuthWithValidator(validateFunc func(c *contain...
method EnableOAuth (line 111) | func (a *App) EnableOAuth(jwksEndpoint string,
method addAuthMiddleware (line 129) | func (a *App) addAuthMiddleware(httpMW func(http.Handler) http.Handler,
FILE: pkg/gofr/cmd.go
type cmd (line 13) | type cmd struct
method Run (line 37) | func (cmd *cmd) Run(c *container.Container) {
method noCommandResponse (line 103) | func (cmd *cmd) noCommandResponse(r *route, ctx *Context, subCommand s...
method handler (line 121) | func (cmd *cmd) handler(path string) *route {
method addRoute (line 152) | func (cmd *cmd) addRoute(pattern string, handler Handler, options ...O...
method printHelp (line 176) | func (cmd *cmd) printHelp() {
type route (line 18) | type route struct
type Options (line 26) | type Options
type ErrCommandNotFound (line 29) | type ErrCommandNotFound struct
method Error (line 33) | func (e ErrCommandNotFound) Error() string {
function parseArgs (line 64) | func parseArgs(args []string) (subCommand string, showHelp bool, firstAr...
function getCommandForError (line 92) | func getCommandForError(subCommand, firstArg string) string {
function AddDescription (line 137) | func AddDescription(descString string) Options {
function AddHelp (line 145) | func AddHelp(helperString string) Options {
FILE: pkg/gofr/cmd/request.go
type Request (line 14) | type Request struct
method Param (line 70) | func (r *Request) Param(key string) string {
method PathParam (line 75) | func (r *Request) PathParam(key string) string {
method Context (line 79) | func (*Request) Context() context.Context {
method HostName (line 83) | func (*Request) HostName() (hostname string) {
method Params (line 90) | func (r *Request) Params(key string) []string {
method Bind (line 99) | func (r *Request) Bind(i any) error {
constant trueString (line 19) | trueString = "true"
function NewRequest (line 25) | func NewRequest(args []string) *Request {
FILE: pkg/gofr/cmd/request_test.go
function TestMain (line 10) | func TestMain(m *testing.M) {
function TestRequest_Bind (line 15) | func TestRequest_Bind(t *testing.T) {
function TestRequest_WithOneArg (line 51) | func TestRequest_WithOneArg(t *testing.T) {
function TestHostName (line 62) | func TestHostName(t *testing.T) {
function Test_Params (line 77) | func Test_Params(t *testing.T) {
FILE: pkg/gofr/cmd/responder.go
type Responder (line 8) | type Responder struct
method Respond (line 10) | func (*Responder) Respond(data any, err error) {
FILE: pkg/gofr/cmd/responder_test.go
function TestResponder_Respond (line 12) | func TestResponder_Respond(t *testing.T) {
FILE: pkg/gofr/cmd/terminal/colors.go
constant Black (line 4) | Black = iota
constant Red (line 5) | Red
constant Green (line 6) | Green
constant Yellow (line 7) | Yellow
constant Blue (line 8) | Blue
constant Magenta (line 9) | Magenta
constant Cyan (line 10) | Cyan
constant White (line 11) | White
constant BrightBlack (line 12) | BrightBlack
constant BrightRed (line 13) | BrightRed
constant BrightGreen (line 14) | BrightGreen
constant BrightYellow (line 15) | BrightYellow
constant BrightBlue (line 16) | BrightBlue
constant BrightMagenta (line 17) | BrightMagenta
constant BrightCyan (line 18) | BrightCyan
constant BrightWhite (line 19) | BrightWhite
method SetColor (line 22) | func (o *Out) SetColor(colorCode int) {
method ResetColor (line 26) | func (o *Out) ResetColor() {
FILE: pkg/gofr/cmd/terminal/output.go
type Output (line 12) | type Output interface
type terminal (line 48) | type terminal struct
type Out (line 55) | type Out struct
method getSize (line 76) | func (o *Out) getSize() (width, height int, err error) {
method Reset (line 126) | func (o *Out) Reset() {
method RestoreScreen (line 131) | func (o *Out) RestoreScreen() {
method SaveScreen (line 136) | func (o *Out) SaveScreen() {
method AltScreen (line 142) | func (o *Out) AltScreen() {
method ExitAltScreen (line 148) | func (o *Out) ExitAltScreen() {
method ClearScreen (line 153) | func (o *Out) ClearScreen() {
method MoveCursor (line 159) | func (o *Out) MoveCursor(row, column int) {
method HideCursor (line 164) | func (o *Out) HideCursor() {
method ShowCursor (line 169) | func (o *Out) ShowCursor() {
method SaveCursorPosition (line 174) | func (o *Out) SaveCursorPosition() {
method RestoreCursorPosition (line 179) | func (o *Out) RestoreCursorPosition() {
method CursorUp (line 184) | func (o *Out) CursorUp(n int) {
method CursorDown (line 189) | func (o *Out) CursorDown(n int) {
method CursorForward (line 194) | func (o *Out) CursorForward(n int) {
method CursorBack (line 199) | func (o *Out) CursorBack(n int) {
method CursorNextLine (line 205) | func (o *Out) CursorNextLine(n int) {
method CursorPrevLine (line 211) | func (o *Out) CursorPrevLine(n int) {
method ClearLine (line 216) | func (o *Out) ClearLine() {
method ClearLineLeft (line 221) | func (o *Out) ClearLineLeft() {
method ClearLineRight (line 226) | func (o *Out) ClearLineRight() {
method ClearLines (line 231) | func (o *Out) ClearLines(n int) {
method ChangeScrollingRegion (line 239) | func (o *Out) ChangeScrollingRegion(top, bottom int) {
method InsertLines (line 245) | func (o *Out) InsertLines(n int) {
method DeleteLines (line 251) | func (o *Out) DeleteLines(n int) {
method SetWindowTitle (line 256) | func (o *Out) SetWindowTitle(title string) {
function New (line 60) | func New() *Out {
function getTerminalInfo (line 67) | func getTerminalInfo(in io.Writer) (inFd uintptr, isTerminalIn bool) {
constant escape (line 82) | escape = string('\x1b')
constant csi (line 84) | csi = escape + "["
constant osc (line 86) | osc = escape + "]"
constant moveCursorUp (line 91) | moveCursorUp = iota + 1
constant clearScreen (line 92) | clearScreen
constant cursorUpSeq (line 95) | cursorUpSeq = "%dA"
constant cursorDownSeq (line 96) | cursorDownSeq = "%dB"
constant cursorForwardSeq (line 97) | cursorForwardSeq = "%dC"
constant cursorBackSeq (line 98) | cursorBackSeq = "%dD"
constant cursorNextLineSeq (line 99) | cursorNextLineSeq = "%dE"
constant cursorPreviousLineSeq (line 100) | cursorPreviousLineSeq = "%dF"
constant cursorPositionSeq (line 101) | cursorPositionSeq = "%d;%dH"
constant eraseDisplaySeq (line 102) | eraseDisplaySeq = "%dJ"
constant eraseLineSeq (line 103) | eraseLineSeq = "%dK"
constant saveCursorPositionSeq (line 104) | saveCursorPositionSeq = "s"
constant restoreCursorPositionSeq (line 105) | restoreCursorPositionSeq = "u"
constant changeScrollingRegionSeq (line 106) | changeScrollingRegionSeq = "%d;%dr"
constant insertLineSeq (line 107) | insertLineSeq = "%dL"
constant deleteLineSeq (line 108) | deleteLineSeq = "%dM"
constant eraseLineRightSeq (line 111) | eraseLineRightSeq = "0K"
constant eraseLineLeftSeq (line 112) | eraseLineLeftSeq = "1K"
constant eraseEntireLineSeq (line 113) | eraseEntireLineSeq = "2K"
constant restoreScreenSeq (line 116) | restoreScreenSeq = "?47l"
constant saveScreenSeq (line 117) | saveScreenSeq = "?47h"
constant altScreenSeq (line 118) | altScreenSeq = "?1049h"
constant exitAltScreenSeq (line 119) | exitAltScreenSeq = "?1049l"
constant setWindowTitleSeq (line 120) | setWindowTitleSeq = "2;%s"
constant showCursorSeq (line 121) | showCursorSeq = "?25h"
constant hideCursorSeq (line 122) | hideCursorSeq = "?25l"
FILE: pkg/gofr/cmd/terminal/output_test.go
function TestNewOutput (line 12) | func TestNewOutput(t *testing.T) {
function tempOutput (line 23) | func tempOutput(t *testing.T) *Out {
function validate (line 31) | func validate(t *testing.T, o *Out, exp string) {
function TestReset (line 43) | func TestReset(t *testing.T) {
function TestRestoreScreen (line 50) | func TestRestoreScreen(t *testing.T) {
function TestSaveScreen (line 57) | func TestSaveScreen(t *testing.T) {
function TestAltScreen (line 64) | func TestAltScreen(t *testing.T) {
function TestExitAltScreen (line 71) | func TestExitAltScreen(t *testing.T) {
function TestClearScreen (line 78) | func TestClearScreen(t *testing.T) {
function TestMoveCursor (line 85) | func TestMoveCursor(t *testing.T) {
function TestHideCursor (line 92) | func TestHideCursor(t *testing.T) {
function TestShowCursor (line 99) | func TestShowCursor(t *testing.T) {
function TestSaveCursorPosition (line 106) | func TestSaveCursorPosition(t *testing.T) {
function TestRestoreCursorPosition (line 113) | func TestRestoreCursorPosition(t *testing.T) {
function TestCursorUp (line 120) | func TestCursorUp(t *testing.T) {
function TestCursorDown (line 127) | func TestCursorDown(t *testing.T) {
function TestCursorForward (line 134) | func TestCursorForward(t *testing.T) {
function TestCursorBack (line 141) | func TestCursorBack(t *testing.T) {
function TestCursorNextLine (line 148) | func TestCursorNextLine(t *testing.T) {
function TestCursorPrevLine (line 155) | func TestCursorPrevLine(t *testing.T) {
function TestClearLine (line 162) | func TestClearLine(t *testing.T) {
function TestClearLineLeft (line 169) | func TestClearLineLeft(t *testing.T) {
function TestClearLineRight (line 176) | func TestClearLineRight(t *testing.T) {
function TestClearLines (line 183) | func TestClearLines(t *testing.T) {
function TestChangeScrollingRegion (line 190) | func TestChangeScrollingRegion(t *testing.T) {
function TestInsertLines (line 197) | func TestInsertLines(t *testing.T) {
function TestDeleteLines (line 204) | func TestDeleteLines(t *testing.T) {
function TestSetWindowTitle (line 211) | func TestSetWindowTitle(t *testing.T) {
FILE: pkg/gofr/cmd/terminal/printers.go
method Printf (line 7) | func (o *Out) Printf(format string, args ...any) {
method Print (line 11) | func (o *Out) Print(messages ...any) {
method Println (line 15) | func (o *Out) Println(messages ...any) {
FILE: pkg/gofr/cmd/terminal/printers_test.go
function TestOutput_Printf (line 11) | func TestOutput_Printf(t *testing.T) {
function TestOutput_Print (line 24) | func TestOutput_Print(t *testing.T) {
function TestOutput_Println (line 35) | func TestOutput_Println(t *testing.T) {
FILE: pkg/gofr/cmd/terminal/progress.go
type ProgressBar (line 15) | type ProgressBar struct
method Incr (line 52) | func (p *ProgressBar) Incr(i int64) bool {
method updateProgressBar (line 68) | func (p *ProgressBar) updateProgressBar() {
method getString (line 87) | func (p *ProgressBar) getString() string {
type Term (line 23) | type Term interface
function NewProgressBar (line 28) | func NewProgressBar(out Output, total int64) (*ProgressBar, error) {
constant maxRP (line 82) | maxRP = 50
constant minTermWidth (line 84) | minTermWidth = 110
function getProgressBox (line 103) | func getProgressBox(percentage float64) string {
FILE: pkg/gofr/cmd/terminal/progress_test.go
function TestProgressBar_SuccessCases (line 12) | func TestProgressBar_SuccessCases(t *testing.T) {
function TestProgressBar_Fail (line 44) | func TestProgressBar_Fail(t *testing.T) {
function TestProgressBar_Incr (line 55) | func TestProgressBar_Incr(t *testing.T) {
function TestProgressBar_getString (line 83) | func TestProgressBar_getString(t *testing.T) {
FILE: pkg/gofr/cmd/terminal/spinner.go
type Spinner (line 10) | type Spinner struct
method Spin (line 48) | func (s *Spinner) Spin(ctx context.Context) *Spinner {
method Stop (line 77) | func (s *Spinner) Stop() {
function NewDotSpinner (line 24) | func NewDotSpinner(o Output) *Spinner {
function NewPulseSpinner (line 32) | func NewPulseSpinner(o Output) *Spinner {
function NewGlobeSpinner (line 40) | func NewGlobeSpinner(o Output) *Spinner {
FILE: pkg/gofr/cmd/terminal/spinner_test.go
function TestSpinner (line 13) | func TestSpinner(t *testing.T) {
function TestSpinner_contextDone (line 75) | func TestSpinner_contextDone(t *testing.T) {
FILE: pkg/gofr/cmd_test.go
function Test_Run_SuccessCallRegisteredArgument (line 17) | func Test_Run_SuccessCallRegisteredArgument(t *testing.T) {
function Test_Run_SuccessSkipEmptySpaceAndMatchCommandWithSpace (line 38) | func Test_Run_SuccessSkipEmptySpaceAndMatchCommandWithSpace(t *testing.T) {
function Test_Run_SuccessCommandWithMultipleParameters (line 58) | func Test_Run_SuccessCommandWithMultipleParameters(t *testing.T) {
function Test_Run_SuccessRouteWithSpecialCharacters (line 81) | func Test_Run_SuccessRouteWithSpecialCharacters(t *testing.T) {
function Test_Run_ErrorRouteWithSpecialCharacters (line 115) | func Test_Run_ErrorRouteWithSpecialCharacters(t *testing.T) {
function Test_Run_ErrorParamNotReadWithoutHyphen (line 145) | func Test_Run_ErrorParamNotReadWithoutHyphen(t *testing.T) {
function Test_Run_ErrorNotARegisteredCommand (line 167) | func Test_Run_ErrorNotARegisteredCommand(t *testing.T) {
function Test_Run_ErrorWhenOnlyParamAreGiven (line 179) | func Test_Run_ErrorWhenOnlyParamAreGiven(t *testing.T) {
function Test_Run_ErrorRouteRegisteredButNilHandler (line 200) | func Test_Run_ErrorRouteRegisteredButNilHandler(t *testing.T) {
function Test_Run_ErrorNoArgumentGiven (line 217) | func Test_Run_ErrorNoArgumentGiven(t *testing.T) {
function Test_Run_SuccessCallInvalidHyphens (line 233) | func Test_Run_SuccessCallInvalidHyphens(t *testing.T) {
function Test_Run_HelpCommand (line 253) | func Test_Run_HelpCommand(t *testing.T) {
function Test_Run_HelpCommandLong (line 277) | func Test_Run_HelpCommandLong(t *testing.T) {
function Test_Run_UnknownCommandShowsHelp (line 301) | func Test_Run_UnknownCommandShowsHelp(t *testing.T) {
function Test_Run_handler_help (line 329) | func Test_Run_handler_help(t *testing.T) {
FILE: pkg/gofr/config/config.go
type Config (line 3) | type Config interface
FILE: pkg/gofr/config/godotenv.go
constant defaultFileName (line 14) | defaultFileName = "/.env"
constant defaultOverrideFileName (line 15) | defaultOverrideFileName = "/.local.env"
type EnvLoader (line 18) | type EnvLoader struct
method read (line 36) | func (e *EnvLoader) read(folder string) {
method captureInitialEnv (line 80) | func (*EnvLoader) captureInitialEnv() map[string]string {
method Get (line 93) | func (*EnvLoader) Get(key string) string {
method GetOrDefault (line 97) | func (*EnvLoader) GetOrDefault(key, defaultValue string) string {
type logger (line 22) | type logger interface
function NewEnvFile (line 29) | func NewEnvFile(configFolder string, logger logger) Config {
FILE: pkg/gofr/config/godotenv_test.go
function clearAllEnv (line 14) | func clearAllEnv() {
function TestMain (line 21) | func TestMain(m *testing.M) {
function Test_EnvSuccess (line 26) | func Test_EnvSuccess(t *testing.T) {
function Test_EnvSuccess_AppEnv_Override (line 50) | func Test_EnvSuccess_AppEnv_Override(t *testing.T) {
function Test_EnvSuccess_Local_Override (line 74) | func Test_EnvSuccess_Local_Override(t *testing.T) {
function Test_EnvSuccess_SystemEnv_Override (line 96) | func Test_EnvSuccess_SystemEnv_Override(t *testing.T) {
function Test_EnvFailureWithHyphen (line 121) | func Test_EnvFailureWithHyphen(t *testing.T) {
function createEnvFile (line 145) | func createEnvFile(t *testing.T, dir, fileName string, envData map[strin...
FILE: pkg/gofr/config/mock_config.go
type mockConfig (line 3) | type mockConfig struct
method Get (line 20) | func (m *mockConfig) Get(s string) string {
method GetOrDefault (line 24) | func (m *mockConfig) GetOrDefault(s, d string) string {
function NewMockConfig (line 7) | func NewMockConfig(configMap map[string]string) Config {
FILE: pkg/gofr/config/mock_config_test.go
function Test_NewMockConfig (line 9) | func Test_NewMockConfig(t *testing.T) {
FILE: pkg/gofr/constants.go
constant defaultPublicStaticDir (line 6) | defaultPublicStaticDir = "static"
constant shutDownTimeout (line 7) | shutDownTimeout = 30 * time.Second
constant gofrTraceExporter (line 8) | gofrTraceExporter = "gofr"
constant gofrTracerURL (line 9) | gofrTracerURL = "https://tracer.gofr.dev"
constant checkPortTimeout (line 10) | checkPortTimeout = 2 * time.Second
constant gofrHost (line 11) | gofrHost = "https://gofr.dev"
constant startServerPing (line 12) | startServerPing = "/api/ping/up"
constant shutServerPing (line 13) | shutServerPing = "/api/ping/down"
constant pingTimeout (line 14) | pingTimeout = 5 * time.Second
constant defaultTelemetry (line 15) | defaultTelemetry = "true"
constant defaultReflection (line 16) | defaultReflection = "false"
FILE: pkg/gofr/container/container.go
constant redisPubSubModeStreams (line 42) | redisPubSubModeStreams = "streams"
constant redisPubSubModePubSub (line 43) | redisPubSubModePubSub = "pubsub"
type Container (line 48) | type Container struct
method Create (line 97) | func (c *Container) Create(conf config.Config) {
method createPubSub (line 144) | func (c *Container) createPubSub(conf config.Config) {
method Close (line 157) | func (c *Container) Close() error {
method createMqttPubSub (line 179) | func (c *Container) createMqttPubSub(conf config.Config) pubsub.Client {
method GetHTTPService (line 226) | func (c *Container) GetHTTPService(serviceName string) service.HTTP {
method Metrics (line 230) | func (c *Container) Metrics() metrics.Manager {
method registerFrameworkMetrics (line 234) | func (c *Container) registerFrameworkMetrics() {
method GetAppName (line 270) | func (c *Container) GetAppName() string {
method GetAppVersion (line 274) | func (c *Container) GetAppVersion() string {
method GetPublisher (line 278) | func (c *Container) GetPublisher() pubsub.Publisher {
method GetSubscriber (line 282) | func (c *Container) GetSubscriber() pubsub.Subscriber {
method GetConnectionFromContext (line 287) | func (c *Container) GetConnectionFromContext(ctx context.Context) *web...
method GetWSConnectionByServiceName (line 306) | func (c *Container) GetWSConnectionByServiceName(serviceName string) *...
method AddConnection (line 311) | func (c *Container) AddConnection(connID string, conn *websocket.Conne...
method RemoveConnection (line 316) | func (c *Container) RemoveConnection(connID string) {
method createKafkaPubSub (line 330) | func (c *Container) createKafkaPubSub(conf config.Config) {
method createGooglePubSub (line 392) | func (c *Container) createGooglePubSub(conf config.Config) {
method createRedisPubSub (line 399) | func (c *Container) createRedisPubSub(conf config.Config) {
method warnIfRedisPubSubSharesRedisDB (line 406) | func (c *Container) warnIfRedisPubSubSharesRedisDB(conf config.Config) {
function NewContainer (line 82) | func NewContainer(conf config.Config) *Container {
function getDefaultDatasourceBuckets (line 323) | func getDefaultDatasourceBuckets() []float64 {
function effectiveRedisPubSubMode (line 445) | func effectiveRedisPubSubMode(conf config.Config) string {
FILE: pkg/gofr/container/container_test.go
function TestMain (line 23) | func TestMain(m *testing.M) {
function Test_newContainerSuccessWithLogger (line 28) | func Test_newContainerSuccessWithLogger(t *testing.T) {
function Test_newContainerDBInitializationFail (line 36) | func Test_newContainerDBInitializationFail(t *testing.T) {
function Test_newContainerPubSubInitializationFail (line 54) | func Test_newContainerPubSubInitializationFail(t *testing.T) {
function TestContainer_MQTTInitialization_Default (line 74) | func TestContainer_MQTTInitialization_Default(t *testing.T) {
function TestContainer_GetHTTPService (line 87) | func TestContainer_GetHTTPService(t *testing.T) {
function TestContainer_GetAppName (line 118) | func TestContainer_GetAppName(t *testing.T) {
function TestContainer_GetAppVersion (line 126) | func TestContainer_GetAppVersion(t *testing.T) {
function TestContainer_GetPublisher (line 134) | func TestContainer_GetPublisher(t *testing.T) {
function TestContainer_GetSubscriber (line 144) | func TestContainer_GetSubscriber(t *testing.T) {
function TestContainer_newContainerWithNilConfig (line 154) | func TestContainer_newContainerWithNilConfig(t *testing.T) {
function TestContainer_Close (line 166) | func TestContainer_Close(t *testing.T) {
function Test_GetConnectionFromContext (line 188) | func Test_GetConnectionFromContext(t *testing.T) {
function TestContainer_CreateSetsAppNameAndVersion (line 230) | func TestContainer_CreateSetsAppNameAndVersion(t *testing.T) {
function TestRedisPubSubEffectiveMode (line 257) | func TestRedisPubSubEffectiveMode(t *testing.T) {
function TestWarnRedisPubSubSharedDB_NoWarnWhenRedisNil (line 275) | func TestWarnRedisPubSubSharedDB_NoWarnWhenRedisNil(t *testing.T) {
function TestWarnRedisPubSubSharedDB_NoWarnWhenModeIsPubSub (line 287) | func TestWarnRedisPubSubSharedDB_NoWarnWhenModeIsPubSub(t *testing.T) {
function TestWarnRedisPubSubSharedDB_WarnsWhenPubSubDBUnset (line 302) | func TestWarnRedisPubSubSharedDB_WarnsWhenPubSubDBUnset(t *testing.T) {
function TestWarnRedisPubSubSharedDB_WarnsWhenPubSubDBInvalid (line 318) | func TestWarnRedisPubSubSharedDB_WarnsWhenPubSubDBInvalid(t *testing.T) {
function TestWarnRedisPubSubSharedDB_WarnsWhenPubSubDBEqualsRedisDB (line 335) | func TestWarnRedisPubSubSharedDB_WarnsWhenPubSubDBEqualsRedisDB(t *testi...
function TestWarnRedisPubSubSharedDB_NoWarnWhenPubSubDBDiffers (line 362) | func TestWarnRedisPubSubSharedDB_NoWarnWhenPubSubDBDiffers(t *testing.T) {
function TestCreatePubSub_DispatchBranches (line 378) | func TestCreatePubSub_DispatchBranches(t *testing.T) {
function TestWebsocketManagerHelpers (line 420) | func TestWebsocketManagerHelpers(t *testing.T) {
function TestContainer_registerFrameworkMetrics_RegistersExpectedMetrics (line 439) | func TestContainer_registerFrameworkMetrics_RegistersExpectedMetrics(t *...
function TestGetDefaultDatasourceBuckets (line 507) | func TestGetDefaultDatasourceBuckets(t *testing.T) {
function TestContainer_Close_ClosesWebsocketConnections (line 519) | func TestContainer_Close_ClosesWebsocketConnections(t *testing.T) {
FILE: pkg/gofr/container/datasources.go
type DB (line 18) | type DB interface
type Redis (line 33) | type Redis interface
type Cassandra (line 42) | type Cassandra interface
type CassandraBatch (line 122) | type CassandraBatch interface
type CassandraWithContext (line 161) | type CassandraWithContext interface
type CassandraBatchWithContext (line 179) | type CassandraBatchWithContext interface
type CassandraProvider (line 190) | type CassandraProvider interface
type Clickhouse (line 196) | type Clickhouse interface
type ClickhouseProvider (line 204) | type ClickhouseProvider interface
type OracleDB (line 210) | type OracleDB interface
type OracleTx (line 218) | type OracleTx interface
type OracleProvider (line 225) | type OracleProvider interface
type Mongo (line 232) | type Mongo interface
type Transaction (line 286) | type Transaction interface
type MongoProvider (line 295) | type MongoProvider interface
type SurrealDB (line 302) | type SurrealDB interface
type SurrealBDProvider (line 340) | type SurrealBDProvider interface
type provider (line 346) | type provider interface
type HealthChecker (line 360) | type HealthChecker interface
type KVStore (line 366) | type KVStore interface
type KVStoreProvider (line 374) | type KVStoreProvider interface
type PubSubProvider (line 380) | type PubSubProvider interface
type Solr (line 386) | type Solr interface
type SolrProvider (line 401) | type SolrProvider interface
type Dgraph (line 408) | type Dgraph interface
type DgraphProvider (line 488) | type DgraphProvider interface
type OpenTSDBProvider (line 493) | type OpenTSDBProvider interface
type OpenTSDB (line 501) | type OpenTSDB interface
type ScyllaDB (line 600) | type ScyllaDB interface
type ScyllaDBProvider (line 632) | type ScyllaDBProvider interface
type ArangoDB (line 637) | type ArangoDB interface
type ArangoDBProvider (line 701) | type ArangoDBProvider interface
type Elasticsearch (line 708) | type Elasticsearch interface
type ElasticsearchProvider (line 741) | type ElasticsearchProvider interface
type Couchbase (line 748) | type Couchbase interface
type CouchbaseProvider (line 783) | type CouchbaseProvider interface
type DBResolverProvider (line 790) | type DBResolverProvider interface
type InfluxDB (line 797) | type InfluxDB interface
type InfluxDBProvider (line 835) | type InfluxDBProvider interface
FILE: pkg/gofr/container/health.go
method Health (line 8) | func (c *Container) Health(ctx context.Context) any {
function checkExternalDBHealth (line 59) | func checkExternalDBHealth(ctx context.Context, c *Container, healthMap ...
method appHealth (line 89) | func (c *Container) appHealth(healthMap map[string]any, downCount int) {
function isNil (line 100) | func isNil(i any) bool {
FILE: pkg/gofr/container/health_test.go
function TestContainer_Health (line 19) | func TestContainer_Health(t *testing.T) {
function registerMocks (line 56) | func registerMocks(mocks *Mocks, health string) {
function getExpectedData (line 157) | func getExpectedData(datasourceHealth, appHealth, srvURL string) map[str...
FILE: pkg/gofr/container/metrics.go
type Metrics (line 5) | type Metrics interface
FILE: pkg/gofr/container/mock_container.go
type Mocks (line 17) | type Mocks struct
type options (line 41) | type options
function WithMockHTTPService (line 43) | func WithMockHTTPService(httpServiceNames ...string) options { //nolint:...
function setContainerMocks (line 61) | func setContainerMocks(c *Container, ctrl *gomock.Controller) {
function NewMockContainer (line 93) | func NewMockContainer(t *testing.T, options ...options) (*Container, *Mo...
type MockPubSub (line 181) | type MockPubSub struct
method Query (line 183) | func (*MockPubSub) Query(_ context.Context, _ string, _ ...any) ([]byt...
method CreateTopic (line 187) | func (*MockPubSub) CreateTopic(_ context.Context, _ string) error {
method DeleteTopic (line 191) | func (*MockPubSub) DeleteTopic(_ context.Context, _ string) error {
method Health (line 195) | func (*MockPubSub) Health() datasource.Health {
method Publish (line 199) | func (*MockPubSub) Publish(_ context.Context, _ string, _ []byte) error {
method Subscribe (line 203) | func (*MockPubSub) Subscribe(_ context.Context, _ string) (*pubsub.Mes...
method Close (line 207) | func (*MockPubSub) Close() error { return nil }
FILE: pkg/gofr/container/mock_datasources.go
type MockDB (line 27) | type MockDB struct
method EXPECT (line 46) | func (m *MockDB) EXPECT() *MockDBMockRecorder {
method Begin (line 51) | func (m *MockDB) Begin() (*sql0.Tx, error) {
method Close (line 66) | func (m *MockDB) Close() error {
method Dialect (line 80) | func (m *MockDB) Dialect() string {
method Exec (line 94) | func (m *MockDB) Exec(query string, args ...any) (sql.Result, error) {
method ExecContext (line 114) | func (m *MockDB) ExecContext(ctx context.Context, query string, args ....
method HealthCheck (line 134) | func (m *MockDB) HealthCheck() *datasource.Health {
method Prepare (line 148) | func (m *MockDB) Prepare(query string) (*sql.Stmt, error) {
method Query (line 163) | func (m *MockDB) Query(query string, args ...any) (*sql.Rows, error) {
method QueryContext (line 183) | func (m *MockDB) QueryContext(ctx context.Context, query string, args ...
method QueryRow (line 203) | func (m *MockDB) QueryRow(query string, args ...any) *sql.Row {
method QueryRowContext (line 222) | func (m *MockDB) QueryRowContext(ctx context.Context, query string, ar...
method Select (line 241) | func (m *MockDB) Select(ctx context.Context, data any, query string, a...
type MockDBMockRecorder (line 34) | type MockDBMockRecorder struct
method Begin (line 60) | func (mr *MockDBMockRecorder) Begin() *gomock.Call {
method Close (line 74) | func (mr *MockDBMockRecorder) Close() *gomock.Call {
method Dialect (line 88) | func (mr *MockDBMockRecorder) Dialect() *gomock.Call {
method Exec (line 107) | func (mr *MockDBMockRecorder) Exec(query any, args ...any) *gomock.Call {
method ExecContext (line 127) | func (mr *MockDBMockRecorder) ExecContext(ctx, query any, args ...any)...
method HealthCheck (line 142) | func (mr *MockDBMockRecorder) HealthCheck() *gomock.Call {
method Prepare (line 157) | func (mr *MockDBMockRecorder) Prepare(query any) *gomock.Call {
method Query (line 176) | func (mr *MockDBMockRecorder) Query(query any, args ...any) *gomock.Ca...
method QueryContext (line 196) | func (mr *MockDBMockRecorder) QueryContext(ctx, query any, args ...any...
method QueryRow (line 215) | func (mr *MockDBMockRecorder) QueryRow(query any, args ...any) *gomock...
method QueryRowContext (line 234) | func (mr *MockDBMockRecorder) QueryRowContext(ctx, query any, args ......
method Select (line 251) | func (mr *MockDBMockRecorder) Select(ctx, data, query any, args ...any...
function NewMockDB (line 39) | func NewMockDB(ctrl *gomock.Controller) *MockDB {
type MockRedis (line 258) | type MockRedis struct
method EXPECT (line 277) | func (m *MockRedis) EXPECT() *MockRedisMockRecorder {
method ACLCat (line 282) | func (m *MockRedis) ACLCat(ctx context.Context) *redis.StringSliceCmd {
method ACLCatArgs (line 296) | func (m *MockRedis) ACLCatArgs(ctx context.Context, options *redis.ACL...
method ACLDelUser (line 310) | func (m *MockRedis) ACLDelUser(ctx context.Context, username string) *...
method ACLDryRun (line 324) | func (m *MockRedis) ACLDryRun(ctx context.Context, username string, co...
method ACLGenPass (line 343) | func (m *MockRedis) ACLGenPass(ctx context.Context, bit int) *redis.St...
method ACLList (line 357) | func (m *MockRedis) ACLList(ctx context.Context) *redis.StringSliceCmd {
method ACLLog (line 371) | func (m *MockRedis) ACLLog(ctx context.Context, count int64) *redis.AC...
method ACLLogReset (line 385) | func (m *MockRedis) ACLLogReset(ctx context.Context) *redis.StatusCmd {
method ACLSetUser (line 399) | func (m *MockRedis) ACLSetUser(ctx context.Context, username string, r...
method ACLUsers (line 418) | func (m *MockRedis) ACLUsers(ctx context.Context) *redis.StringSliceCmd {
method ACLWhoAmI (line 432) | func (m *MockRedis) ACLWhoAmI(ctx context.Context) *redis.StringCmd {
method Append (line 446) | func (m *MockRedis) Append(ctx context.Context, key, value string) *re...
method BFAdd (line 460) | func (m *MockRedis) BFAdd(ctx context.Context, key string, element any...
method BFCard (line 474) | func (m *MockRedis) BFCard(ctx context.Context, key string) *redis.Int...
method BFExists (line 488) | func (m *MockRedis) BFExists(ctx context.Context, key string, element ...
method BFInfo (line 502) | func (m *MockRedis) BFInfo(ctx context.Context, key string) *redis.BFI...
method BFInfoArg (line 516) | func (m *MockRedis) BFInfoArg(ctx context.Context, key, option string)...
method BFInfoCapacity (line 530) | func (m *MockRedis) BFInfoCapacity(ctx context.Context, key string) *r...
method BFInfoExpansion (line 544) | func (m *MockRedis) BFInfoExpansion(ctx context.Context, key string) *...
method BFInfoFilters (line 558) | func (m *MockRedis) BFInfoFilters(ctx context.Context, key string) *re...
method BFInfoItems (line 572) | func (m *MockRedis) BFInfoItems(ctx context.Context, key string) *redi...
method BFInfoSize (line 586) | func (m *MockRedis) BFInfoSize(ctx context.Context, key string) *redis...
method BFInsert (line 600) | func (m *MockRedis) BFInsert(ctx context.Context, key string, options ...
method BFLoadChunk (line 619) | func (m *MockRedis) BFLoadChunk(ctx context.Context, key string, itera...
method BFMAdd (line 633) | func (m *MockRedis) BFMAdd(ctx context.Context, key string, elements ....
method BFMExists (line 652) | func (m *MockRedis) BFMExists(ctx context.Context, key string, element...
method BFReserve (line 671) | func (m *MockRedis) BFReserve(ctx context.Context, key string, errorRa...
method BFReserveExpansion (line 685) | func (m *MockRedis) BFReserveExpansion(ctx context.Context, key string...
method BFReserveNonScaling (line 699) | func (m *MockRedis) BFReserveNonScaling(ctx context.Context, key strin...
method BFReserveWithArgs (line 713) | func (m *MockRedis) BFReserveWithArgs(ctx context.Context, key string,...
method BFScanDump (line 727) | func (m *MockRedis) BFScanDump(ctx context.Context, key string, iterat...
method BLMPop (line 741) | func (m *MockRedis) BLMPop(ctx context.Context, timeout time.Duration,...
method BLMove (line 760) | func (m *MockRedis) BLMove(ctx context.Context, source, destination, s...
method BLPop (line 774) | func (m *MockRedis) BLPop(ctx context.Context, timeout time.Duration, ...
method BRPop (line 793) | func (m *MockRedis) BRPop(ctx context.Context, timeout time.Duration, ...
method BRPopLPush (line 812) | func (m *MockRedis) BRPopLPush(ctx context.Context, source, destinatio...
method BZMPop (line 826) | func (m *MockRedis) BZMPop(ctx context.Context, timeout time.Duration,...
method BZPopMax (line 845) | func (m *MockRedis) BZPopMax(ctx context.Context, timeout time.Duratio...
method BZPopMin (line 864) | func (m *MockRedis) BZPopMin(ctx context.Context, timeout time.Duratio...
method BgRewriteAOF (line 883) | func (m *MockRedis) BgRewriteAOF(ctx context.Context) *redis.StatusCmd {
method BgSave (line 897) | func (m *MockRedis) BgSave(ctx context.Context) *redis.StatusCmd {
method BitCount (line 911) | func (m *MockRedis) BitCount(ctx context.Context, key string, bitCount...
method BitField (line 925) | func (m *MockRedis) BitField(ctx context.Context, key string, values ....
method BitFieldRO (line 944) | func (m *MockRedis) BitFieldRO(ctx context.Context, key string, values...
method BitOpAnd (line 963) | func (m *MockRedis) BitOpAnd(ctx context.Context, destKey string, keys...
method BitOpAndOr (line 982) | func (m *MockRedis) BitOpAndOr(ctx context.Context, destKey string, ke...
method BitOpDiff (line 1001) | func (m *MockRedis) BitOpDiff(ctx context.Context, destKey string, key...
method BitOpDiff1 (line 1020) | func (m *MockRedis) BitOpDiff1(ctx context.Context, destKey string, ke...
method BitOpNot (line 1039) | func (m *MockRedis) BitOpNot(ctx context.Context, destKey, key string)...
method BitOpOne (line 1053) | func (m *MockRedis) BitOpOne(ctx context.Context, destKey string, keys...
method BitOpOr (line 1072) | func (m *MockRedis) BitOpOr(ctx context.Context, destKey string, keys ...
method BitOpXor (line 1091) | func (m *MockRedis) BitOpXor(ctx context.Context, destKey string, keys...
method BitPos (line 1110) | func (m *MockRedis) BitPos(ctx context.Context, key string, bit int64,...
method BitPosSpan (line 1129) | func (m *MockRedis) BitPosSpan(ctx context.Context, key string, bit in...
method CFAdd (line 1143) | func (m *MockRedis) CFAdd(ctx context.Context, key string, element any...
method CFAddNX (line 1157) | func (m *MockRedis) CFAddNX(ctx context.Context, key string, element a...
method CFCount (line 1171) | func (m *MockRedis) CFCount(ctx context.Context, key string, element a...
method CFDel (line 1185) | func (m *MockRedis) CFDel(ctx context.Context, key string, element any...
method CFExists (line 1199) | func (m *MockRedis) CFExists(ctx context.Context, key string, element ...
method CFInfo (line 1213) | func (m *MockRedis) CFInfo(ctx context.Context, key string) *redis.CFI...
method CFInsert (line 1227) | func (m *MockRedis) CFInsert(ctx context.Context, key string, options ...
method CFInsertNX (line 1246) | func (m *MockRedis) CFInsertNX(ctx context.Context, key string, option...
method CFLoadChunk (line 1265) | func (m *MockRedis) CFLoadChunk(ctx context.Context, key string, itera...
method CFMExists (line 1279) | func (m *MockRedis) CFMExists(ctx context.Context, key string, element...
method CFReserve (line 1298) | func (m *MockRedis) CFReserve(ctx context.Context, key string, capacit...
method CFReserveBucketSize (line 1312) | func (m *MockRedis) CFReserveBucketSize(ctx context.Context, key strin...
method CFReserveExpansion (line 1326) | func (m *MockRedis) CFReserveExpansion(ctx context.Context, key string...
method CFReserveMaxIterations (line 1340) | func (m *MockRedis) CFReserveMaxIterations(ctx context.Context, key st...
method CFReserveWithArgs (line 1354) | func (m *MockRedis) CFReserveWithArgs(ctx context.Context, key string,...
method CFScanDump (line 1368) | func (m *MockRedis) CFScanDump(ctx context.Context, key string, iterat...
method CMSIncrBy (line 1382) | func (m *MockRedis) CMSIncrBy(ctx context.Context, key string, element...
method CMSInfo (line 1401) | func (m *MockRedis) CMSInfo(ctx context.Context, key string) *redis.CM...
method CMSInitByDim (line 1415) | func (m *MockRedis) CMSInitByDim(ctx context.Context, key string, widt...
method CMSInitByProb (line 1429) | func (m *MockRedis) CMSInitByProb(ctx context.Context, key string, err...
method CMSMerge (line 1443) | func (m *MockRedis) CMSMerge(ctx context.Context, destKey string, sour...
method CMSMergeWithWeight (line 1462) | func (m *MockRedis) CMSMergeWithWeight(ctx context.Context, destKey st...
method CMSQuery (line 1476) | func (m *MockRedis) CMSQuery(ctx context.Context, key string, elements...
method ClientGetName (line 1495) | func (m *MockRedis) ClientGetName(ctx context.Context) *redis.StringCmd {
method ClientID (line 1509) | func (m *MockRedis) ClientID(ctx context.Context) *redis.IntCmd {
method ClientInfo (line 1523) | func (m *MockRedis) ClientInfo(ctx context.Context) *redis.ClientInfoC...
method ClientKill (line 1537) | func (m *MockRedis) ClientKill(ctx context.Context, ipPort string) *re...
method ClientKillByFilter (line 1551) | func (m *MockRedis) ClientKillByFilter(ctx context.Context, keys ...st...
method ClientList (line 1570) | func (m *MockRedis) ClientList(ctx context.Context) *redis.StringCmd {
method ClientMaintNotifications (line 1584) | func (m *MockRedis) ClientMaintNotifications(ctx context.Context, enab...
method ClientPause (line 1598) | func (m *MockRedis) ClientPause(ctx context.Context, dur time.Duration...
method ClientUnblock (line 1612) | func (m *MockRedis) ClientUnblock(ctx context.Context, id int64) *redi...
method ClientUnblockWithError (line 1626) | func (m *MockRedis) ClientUnblockWithError(ctx context.Context, id int...
method ClientUnpause (line 1640) | func (m *MockRedis) ClientUnpause(ctx context.Context) *redis.BoolCmd {
method Close (line 1654) | func (m *MockRedis) Close() error {
method ClusterAddSlots (line 1668) | func (m *MockRedis) ClusterAddSlots(ctx context.Context, slots ...int)...
method ClusterAddSlotsRange (line 1687) | func (m *MockRedis) ClusterAddSlotsRange(ctx context.Context, min, max...
method ClusterCountFailureReports (line 1701) | func (m *MockRedis) ClusterCountFailureReports(ctx context.Context, no...
method ClusterCountKeysInSlot (line 1715) | func (m *MockRedis) ClusterCountKeysInSlot(ctx context.Context, slot i...
method ClusterDelSlots (line 1729) | func (m *MockRedis) ClusterDelSlots(ctx context.Context, slots ...int)...
method ClusterDelSlotsRange (line 1748) | func (m *MockRedis) ClusterDelSlotsRange(ctx context.Context, min, max...
method ClusterFailover (line 1762) | func (m *MockRedis) ClusterFailover(ctx context.Context) *redis.Status...
method ClusterForget (line 1776) | func (m *MockRedis) ClusterForget(ctx context.Context, nodeID string) ...
method ClusterGetKeysInSlot (line 1790) | func (m *MockRedis) ClusterGetKeysInSlot(ctx context.Context, slot, co...
method ClusterInfo (line 1804) | func (m *MockRedis) ClusterInfo(ctx context.Context) *redis.StringCmd {
method ClusterKeySlot (line 1818) | func (m *MockRedis) ClusterKeySlot(ctx context.Context, key string) *r...
method ClusterLinks (line 1832) | func (m *MockRedis) ClusterLinks(ctx context.Context) *redis.ClusterLi...
method ClusterMeet (line 1846) | func (m *MockRedis) ClusterMeet(ctx context.Context, host, port string...
method ClusterMyID (line 1860) | func (m *MockRedis) ClusterMyID(ctx context.Context) *redis.StringCmd {
method ClusterMyShardID (line 1874) | func (m *MockRedis) ClusterMyShardID(ctx context.Context) *redis.Strin...
method ClusterNodes (line 1888) | func (m *MockRedis) ClusterNodes(ctx context.Context) *redis.StringCmd {
method ClusterReplicate (line 1902) | func (m *MockRedis) ClusterReplicate(ctx context.Context, nodeID strin...
method ClusterResetHard (line 1916) | func (m *MockRedis) ClusterResetHard(ctx context.Context) *redis.Statu...
method ClusterResetSoft (line 1930) | func (m *MockRedis) ClusterResetSoft(ctx context.Context) *redis.Statu...
method ClusterSaveConfig (line 1944) | func (m *MockRedis) ClusterSaveConfig(ctx context.Context) *redis.Stat...
method ClusterShards (line 1958) | func (m *MockRedis) ClusterShards(ctx context.Context) *redis.ClusterS...
method ClusterSlaves (line 1972) | func (m *MockRedis) ClusterSlaves(ctx context.Context, nodeID string) ...
method ClusterSlots (line 1986) | func (m *MockRedis) ClusterSlots(ctx context.Context) *redis.ClusterSl...
method Command (line 2000) | func (m *MockRedis) Command(ctx context.Context) *redis.CommandsInfoCmd {
method CommandGetKeys (line 2014) | func (m *MockRedis) CommandGetKeys(ctx context.Context, commands ...an...
method CommandGetKeysAndFlags (line 2033) | func (m *MockRedis) CommandGetKeysAndFlags(ctx context.Context, comman...
method CommandList (line 2052) | func (m *MockRedis) CommandList(ctx context.Context, filter *redis.Fil...
method ConfigGet (line 2066) | func (m *MockRedis) ConfigGet(ctx context.Context, parameter string) *...
method ConfigResetStat (line 2080) | func (m *MockRedis) ConfigResetStat(ctx context.Context) *redis.Status...
method ConfigRewrite (line 2094) | func (m *MockRedis) ConfigRewrite(ctx context.Context) *redis.StatusCmd {
method ConfigSet (line 2108) | func (m *MockRedis) ConfigSet(ctx context.Context, parameter, value st...
method Copy (line 2122) | func (m *MockRedis) Copy(ctx context.Context, sourceKey, destKey strin...
method DBSize (line 2136) | func (m *MockRedis) DBSize(ctx context.Context) *redis.IntCmd {
method DebugObject (line 2150) | func (m *MockRedis) DebugObject(ctx context.Context, key string) *redi...
method Decr (line 2164) | func (m *MockRedis) Decr(ctx context.Context, key string) *redis.IntCmd {
method DecrBy (line 2178) | func (m *MockRedis) DecrBy(ctx context.Context, key string, decrement ...
method Del (line 2192) | func (m *MockRedis) Del(ctx context.Context, keys ...string) *redis.In...
method DelExArgs (line 2211) | func (m *MockRedis) DelExArgs(ctx context.Context, key string, a redis...
method Digest (line 2225) | func (m *MockRedis) Digest(ctx context.Context, key string) *redis.Dig...
method Dump (line 2239) | func (m *MockRedis) Dump(ctx context.Context, key string) *redis.Strin...
method Echo (line 2253) | func (m *MockRedis) Echo(ctx context.Context, message any) *redis.Stri...
method Eval (line 2267) | func (m *MockRedis) Eval(ctx context.Context, script string, keys []st...
method EvalRO (line 2286) | func (m *MockRedis) EvalRO(ctx context.Context, script string, keys []...
method EvalSha (line 2305) | func (m *MockRedis) EvalSha(ctx context.Context, sha1 string, keys []s...
method EvalShaRO (line 2324) | func (m *MockRedis) EvalShaRO(ctx context.Context, sha1 string, keys [...
method Exists (line 2343) | func (m *MockRedis) Exists(ctx context.Context, keys ...string) *redis...
method Expire (line 2362) | func (m *MockRedis) Expire(ctx context.Context, key string, expiration...
method ExpireAt (line 2376) | func (m *MockRedis) ExpireAt(ctx context.Context, key string, tm time....
method ExpireGT (line 2390) | func (m *MockRedis) ExpireGT(ctx context.Context, key string, expirati...
method ExpireLT (line 2404) | func (m *MockRedis) ExpireLT(ctx context.Context, key string, expirati...
method ExpireNX (line 2418) | func (m *MockRedis) ExpireNX(ctx context.Context, key string, expirati...
method ExpireTime (line 2432) | func (m *MockRedis) ExpireTime(ctx context.Context, key string) *redis...
method ExpireXX (line 2446) | func (m *MockRedis) ExpireXX(ctx context.Context, key string, expirati...
method FCall (line 2460) | func (m *MockRedis) FCall(ctx context.Context, function string, keys [...
method FCallRO (line 2479) | func (m *MockRedis) FCallRO(ctx context.Context, function string, keys...
method FCallRo (line 2498) | func (m *MockRedis) FCallRo(ctx context.Context, function string, keys...
method FTAggregate (line 2517) | func (m *MockRedis) FTAggregate(ctx context.Context, index, query stri...
method FTAggregateWithArgs (line 2531) | func (m *MockRedis) FTAggregateWithArgs(ctx context.Context, index, qu...
method FTAliasAdd (line 2545) | func (m *MockRedis) FTAliasAdd(ctx context.Context, index, alias strin...
method FTAliasDel (line 2559) | func (m *MockRedis) FTAliasDel(ctx context.Context, alias string) *red...
method FTAliasUpdate (line 2573) | func (m *MockRedis) FTAliasUpdate(ctx context.Context, index, alias st...
method FTAlter (line 2587) | func (m *MockRedis) FTAlter(ctx context.Context, index string, skipIni...
method FTConfigGet (line 2601) | func (m *MockRedis) FTConfigGet(ctx context.Context, option string) *r...
method FTConfigSet (line 2615) | func (m *MockRedis) FTConfigSet(ctx context.Context, option string, va...
method FTCreate (line 2629) | func (m *MockRedis) FTCreate(ctx context.Context, index string, option...
method FTCursorDel (line 2648) | func (m *MockRedis) FTCursorDel(ctx context.Context, index string, cur...
method FTCursorRead (line 2662) | func (m *MockRedis) FTCursorRead(ctx context.Context, index string, cu...
method FTDictAdd (line 2676) | func (m *MockRedis) FTDictAdd(ctx context.Context, dict string, term ....
method FTDictDel (line 2695) | func (m *MockRedis) FTDictDel(ctx context.Context, dict string, term ....
method FTDictDump (line 2714) | func (m *MockRedis) FTDictDump(ctx context.Context, dict string) *redi...
method FTDropIndex (line 2728) | func (m *MockRedis) FTDropIndex(ctx context.Context, index string) *re...
method FTDropIndexWithArgs (line 2742) | func (m *MockRedis) FTDropIndexWithArgs(ctx context.Context, index str...
method FTExplain (line 2756) | func (m *MockRedis) FTExplain(ctx context.Context, index, query string...
method FTExplainWithArgs (line 2770) | func (m *MockRedis) FTExplainWithArgs(ctx context.Context, index, quer...
method FTHybrid (line 2784) | func (m *MockRedis) FTHybrid(ctx context.Context, index, searchExpr, v...
method FTHybridWithArgs (line 2798) | func (m *MockRedis) FTHybridWithArgs(ctx context.Context, index string...
method FTInfo (line 2812) | func (m *MockRedis) FTInfo(ctx context.Context, index string) *redis.F...
method FTSearch (line 2826) | func (m *MockRedis) FTSearch(ctx context.Context, index, query string)...
method FTSearchWithArgs (line 2840) | func (m *MockRedis) FTSearchWithArgs(ctx context.Context, index, query...
method FTSpellCheck (line 2854) | func (m *MockRedis) FTSpellCheck(ctx context.Context, index, query str...
method FTSpellCheckWithArgs (line 2868) | func (m *MockRedis) FTSpellCheckWithArgs(ctx context.Context, index, q...
method FTSynDump (line 2882) | func (m *MockRedis) FTSynDump(ctx context.Context, index string) *redi...
method FTSynUpdate (line 2896) | func (m *MockRedis) FTSynUpdate(ctx context.Context, index string, syn...
method FTSynUpdateWithArgs (line 2910) | func (m *MockRedis) FTSynUpdateWithArgs(ctx context.Context, index str...
method FTTagVals (line 2924) | func (m *MockRedis) FTTagVals(ctx context.Context, index, field string...
method FT_List (line 2938) | func (m *MockRedis) FT_List(ctx context.Context) *redis.StringSliceCmd {
method FlushAll (line 2952) | func (m *MockRedis) FlushAll(ctx context.Context) *redis.StatusCmd {
method FlushAllAsync (line 2966) | func (m *MockRedis) FlushAllAsync(ctx context.Context) *redis.StatusCmd {
method FlushDB (line 2980) | func (m *MockRedis) FlushDB(ctx context.Context) *redis.StatusCmd {
method FlushDBAsync (line 2994) | func (m *MockRedis) FlushDBAsync(ctx context.Context) *redis.StatusCmd {
method FunctionDelete (line 3008) | func (m *MockRedis) FunctionDelete(ctx context.Context, libName string...
method FunctionDump (line 3022) | func (m *MockRedis) FunctionDump(ctx context.Context) *redis.StringCmd {
method FunctionFlush (line 3036) | func (m *MockRedis) FunctionFlush(ctx context.Context) *redis.StringCmd {
method FunctionFlushAsync (line 3050) | func (m *MockRedis) FunctionFlushAsync(ctx context.Context) *redis.Str...
method FunctionKill (line 3064) | func (m *MockRedis) FunctionKill(ctx context.Context) *redis.StringCmd {
method FunctionList (line 3078) | func (m *MockRedis) FunctionList(ctx context.Context, q redis.Function...
method FunctionLoad (line 3092) | func (m *MockRedis) FunctionLoad(ctx context.Context, code string) *re...
method FunctionLoadReplace (line 3106) | func (m *MockRedis) FunctionLoadReplace(ctx context.Context, code stri...
method FunctionRestore (line 3120) | func (m *MockRedis) FunctionRestore(ctx context.Context, libDump strin...
method FunctionStats (line 3134) | func (m *MockRedis) FunctionStats(ctx context.Context) *redis.Function...
method GeoAdd (line 3148) | func (m *MockRedis) GeoAdd(ctx context.Context, key string, geoLocatio...
method GeoDist (line 3167) | func (m *MockRedis) GeoDist(ctx context.Context, key, member1, member2...
method GeoHash (line 3181) | func (m *MockRedis) GeoHash(ctx context.Context, key string, members ....
method GeoPos (line 3200) | func (m *MockRedis) GeoPos(ctx context.Context, key string, members .....
method GeoRadius (line 3219) | func (m *MockRedis) GeoRadius(ctx context.Context, key string, longitu...
method GeoRadiusByMember (line 3233) | func (m *MockRedis) GeoRadiusByMember(ctx context.Context, key, member...
method GeoRadiusByMemberStore (line 3247) | func (m *MockRedis) GeoRadiusByMemberStore(ctx context.Context, key, m...
method GeoRadiusStore (line 3261) | func (m *MockRedis) GeoRadiusStore(ctx context.Context, key string, lo...
method GeoSearch (line 3275) | func (m *MockRedis) GeoSearch(ctx context.Context, key string, q *redi...
method GeoSearchLocation (line 3289) | func (m *MockRedis) GeoSearchLocation(ctx context.Context, key string,...
method GeoSearchStore (line 3303) | func (m *MockRedis) GeoSearchStore(ctx context.Context, key, store str...
method Get (line 3317) | func (m *MockRedis) Get(ctx context.Context, key string) *redis.String...
method GetBit (line 3331) | func (m *MockRedis) GetBit(ctx context.Context, key string, offset int...
method GetDel (line 3345) | func (m *MockRedis) GetDel(ctx context.Context, key string) *redis.Str...
method GetEx (line 3359) | func (m *MockRedis) GetEx(ctx context.Context, key string, expiration ...
method GetRange (line 3373) | func (m *MockRedis) GetRange(ctx context.Context, key string, start, e...
method GetSet (line 3387) | func (m *MockRedis) GetSet(ctx context.Context, key string, value any)...
method HDel (line 3401) | func (m *MockRedis) HDel(ctx context.Context, key string, fields ...st...
method HExists (line 3420) | func (m *MockRedis) HExists(ctx context.Context, key, field string) *r...
method HExpire (line 3434) | func (m *MockRedis) HExpire(ctx context.Context, key string, expiratio...
method HExpireAt (line 3453) | func (m *MockRedis) HExpireAt(ctx context.Context, key string, tm time...
method HExpireAtWithArgs (line 3472) | func (m *MockRedis) HExpireAtWithArgs(ctx context.Context, key string,...
method HExpireTime (line 3491) | func (m *MockRedis) HExpireTime(ctx context.Context, key string, field...
method HExpireWithArgs (line 3510) | func (m *MockRedis) HExpireWithArgs(ctx context.Context, key string, e...
method HGet (line 3529) | func (m *MockRedis) HGet(ctx context.Context, key, field string) *redi...
method HGetAll (line 3543) | func (m *MockRedis) HGetAll(ctx context.Context, key string) *redis.Ma...
method HGetDel (line 3557) | func (m *MockRedis) HGetDel(ctx context.Context, key string, fields .....
method HGetEX (line 3576) | func (m *MockRedis) HGetEX(ctx context.Context, key string, fields ......
method HGetEXWithArgs (line 3595) | func (m *MockRedis) HGetEXWithArgs(ctx context.Context, key string, op...
method HIncrBy (line 3614) | func (m *MockRedis) HIncrBy(ctx context.Context, key, field string, in...
method HIncrByFloat (line 3628) | func (m *MockRedis) HIncrByFloat(ctx context.Context, key, field strin...
method HKeys (line 3642) | func (m *MockRedis) HKeys(ctx context.Context, key string) *redis.Stri...
method HLen (line 3656) | func (m *MockRedis) HLen(ctx context.Context, key string) *redis.IntCmd {
method HMGet (line 3670) | func (m *MockRedis) HMGet(ctx context.Context, key string, fields ...s...
method HMSet (line 3689) | func (m *MockRedis) HMSet(ctx context.Context, key string, values ...a...
method HPExpire (line 3708) | func (m *MockRedis) HPExpire(ctx context.Context, key string, expirati...
method HPExpireAt (line 3727) | func (m *MockRedis) HPExpireAt(ctx context.Context, key string, tm tim...
method HPExpireAtWithArgs (line 3746) | func (m *MockRedis) HPExpireAtWithArgs(ctx context.Context, key string...
method HPExpireTime (line 3765) | func (m *MockRedis) HPExpireTime(ctx context.Context, key string, fiel...
method HPExpireWithArgs (line 3784) | func (m *MockRedis) HPExpireWithArgs(ctx context.Context, key string, ...
method HPTTL (line 3803) | func (m *MockRedis) HPTTL(ctx context.Context, key string, fields ...s...
method HPersist (line 3822) | func (m *MockRedis) HPersist(ctx context.Context, key string, fields ....
method HRandField (line 3841) | func (m *MockRedis) HRandField(ctx context.Context, key string, count ...
method HRandFieldWithValues (line 3855) | func (m *MockRedis) HRandFieldWithValues(ctx context.Context, key stri...
method HScan (line 3869) | func (m *MockRedis) HScan(ctx context.Context, key string, cursor uint...
method HScanNoValues (line 3883) | func (m *MockRedis) HScanNoValues(ctx context.Context, key string, cur...
method HSet (line 3897) | func (m *MockRedis) HSet(ctx context.Context, key string, values ...an...
method HSetEX (line 3916) | func (m *MockRedis) HSetEX(ctx context.Context, key string, fieldsAndV...
method HSetEXWithArgs (line 3935) | func (m *MockRedis) HSetEXWithArgs(ctx context.Context, key string, op...
method HSetNX (line 3954) | func (m *MockRedis) HSetNX(ctx context.Context, key, field string, val...
method HStrLen (line 3968) | func (m *MockRedis) HStrLen(ctx context.Context, key, field string) *r...
method HTTL (line 3982) | func (m *MockRedis) HTTL(ctx context.Context, key string, fields ...st...
method HVals (line 4001) | func (m *MockRedis) HVals(ctx context.Context, key string) *redis.Stri...
method HealthCheck (line 4015) | func (m *MockRedis) HealthCheck() datasource.Health {
method Incr (line 4029) | func (m *MockRedis) Incr(ctx context.Context, key string) *redis.IntCmd {
method IncrBy (line 4043) | func (m *MockRedis) IncrBy(ctx context.Context, key string, value int6...
method IncrByFloat (line 4057) | func (m *MockRedis) IncrByFloat(ctx context.Context, key string, value...
method Info (line 4071) | func (m *MockRedis) Info(ctx context.Context, section ...string) *redi...
method JSONArrAppend (line 4090) | func (m *MockRedis) JSONArrAppend(ctx context.Context, key, path strin...
method JSONArrIndex (line 4109) | func (m *MockRedis) JSONArrIndex(ctx context.Context, key, path string...
method JSONArrIndexWithArgs (line 4128) | func (m *MockRedis) JSONArrIndexWithArgs(ctx context.Context, key, pat...
method JSONArrInsert (line 4147) | func (m *MockRedis) JSONArrInsert(ctx context.Context, key, path strin...
method JSONArrLen (line 4166) | func (m *MockRedis) JSONArrLen(ctx context.Context, key, path string) ...
method JSONArrPop (line 4180) | func (m *MockRedis) JSONArrPop(ctx context.Context, key, path string, ...
method JSONArrTrim (line 4194) | func (m *MockRedis) JSONArrTrim(ctx context.Context, key, path string)...
method JSONArrTrimWithArgs (line 4208) | func (m *MockRedis) JSONArrTrimWithArgs(ctx context.Context, key, path...
method JSONClear (line 4222) | func (m *MockRedis) JSONClear(ctx context.Context, key, path string) *...
method JSONDebugMemory (line 4236) | func (m *MockRedis) JSONDebugMemory(ctx context.Context, key, path str...
method JSONDel (line 4250) | func (m *MockRedis) JSONDel(ctx context.Context, key, path string) *re...
method JSONForget (line 4264) | func (m *MockRedis) JSONForget(ctx context.Context, key, path string) ...
method JSONGet (line 4278) | func (m *MockRedis) JSONGet(ctx context.Context, key string, paths ......
method JSONGetWithArgs (line 4297) | func (m *MockRedis) JSONGetWithArgs(ctx context.Context, key string, o...
method JSONMGet (line 4316) | func (m *MockRedis) JSONMGet(ctx context.Context, path string, keys .....
method JSONMSet (line 4335) | func (m *MockRedis) JSONMSet(ctx context.Context, params ...any) *redi...
method JSONMSetArgs (line 4354) | func (m *MockRedis) JSONMSetArgs(ctx context.Context, docs []redis.JSO...
method JSONMerge (line 4368) | func (m *MockRedis) JSONMerge(ctx context.Context, key, path, value st...
method JSONNumIncrBy (line 4382) | func (m *MockRedis) JSONNumIncrBy(ctx context.Context, key, path strin...
method JSONObjKeys (line 4396) | func (m *MockRedis) JSONObjKeys(ctx context.Context, key, path string)...
method JSONObjLen (line 4410) | func (m *MockRedis) JSONObjLen(ctx context.Context, key, path string) ...
method JSONSet (line 4424) | func (m *MockRedis) JSONSet(ctx context.Context, key, path string, val...
method JSONSetMode (line 4438) | func (m *MockRedis) JSONSetMode(ctx context.Context, key, path string,...
method JSONStrAppend (line 4452) | func (m *MockRedis) JSONStrAppend(ctx context.Context, key, path, valu...
method JSONStrLen (line 4466) | func (m *MockRedis) JSONStrLen(ctx context.Context, key, path string) ...
method JSONToggle (line 4480) | func (m *MockRedis) JSONToggle(ctx context.Context, key, path string) ...
method JSONType (line 4494) | func (m *MockRedis) JSONType(ctx context.Context, key, path string) *r...
method Keys (line 4508) | func (m *MockRedis) Keys(ctx context.Context, pattern string) *redis.S...
method LCS (line 4522) | func (m *MockRedis) LCS(ctx context.Context, q *redis.LCSQuery) *redis...
method LIndex (line 4536) | func (m *MockRedis) LIndex(ctx context.Context, key string, index int6...
method LInsert (line 4550) | func (m *MockRedis) LInsert(ctx context.Context, key, op string, pivot...
method LInsertAfter (line 4564) | func (m *MockRedis) LInsertAfter(ctx context.Context, key string, pivo...
method LInsertBefore (line 4578) | func (m *MockRedis) LInsertBefore(ctx context.Context, key string, piv...
method LLen (line 4592) | func (m *MockRedis) LLen(ctx context.Context, key string) *redis.IntCmd {
method LMPop (line 4606) | func (m *MockRedis) LMPop(ctx context.Context, direction string, count...
method LMove (line 4625) | func (m *MockRedis) LMove(ctx context.Context, source, destination, sr...
method LPop (line 4639) | func (m *MockRedis) LPop(ctx context.Context, key string) *redis.Strin...
method LPopCount (line 4653) | func (m *MockRedis) LPopCount(ctx context.Context, key string, count i...
method LPos (line 4667) | func (m *MockRedis) LPos(ctx context.Context, key, value string, args ...
method LPosCount (line 4681) | func (m *MockRedis) LPosCount(ctx context.Context, key, value string, ...
method LPush (line 4695) | func (m *MockRedis) LPush(ctx context.Context, key string, values ...a...
method LPushX (line 4714) | func (m *MockRedis) LPushX(ctx context.Context, key string, values ......
method LRange (line 4733) | func (m *MockRedis) LRange(ctx context.Context, key string, start, sto...
method LRem (line 4747) | func (m *MockRedis) LRem(ctx context.Context, key string, count int64,...
method LSet (line 4761) | func (m *MockRedis) LSet(ctx context.Context, key string, index int64,...
method LTrim (line 4775) | func (m *MockRedis) LTrim(ctx context.Context, key string, start, stop...
method LastSave (line 4789) | func (m *MockRedis) LastSave(ctx context.Context) *redis.IntCmd {
method Latency (line 4803) | func (m *MockRedis) Latency(ctx context.Context) *redis.LatencyCmd {
method LatencyReset (line 4817) | func (m *MockRedis) LatencyReset(ctx context.Context, events ...any) *...
method MGet (line 4836) | func (m *MockRedis) MGet(ctx context.Context, keys ...string) *redis.S...
method MSet (line 4855) | func (m *MockRedis) MSet(ctx context.Context, values ...any) *redis.St...
method MSetEX (line 4874) | func (m *MockRedis) MSetEX(ctx context.Context, args redis.MSetEXArgs,...
method MSetNX (line 4893) | func (m *MockRedis) MSetNX(ctx context.Context, values ...any) *redis....
method MemoryUsage (line 4912) | func (m *MockRedis) MemoryUsage(ctx context.Context, key string, sampl...
method Migrate (line 4931) | func (m *MockRedis) Migrate(ctx context.Context, host, port, key strin...
method ModuleLoadex (line 4945) | func (m *MockRedis) ModuleLoadex(ctx context.Context, conf *redis.Modu...
method Move (line 4959) | func (m *MockRedis) Move(ctx context.Context, key string, db int) *red...
method ObjectEncoding (line 4973) | func (m *MockRedis) ObjectEncoding(ctx context.Context, key string) *r...
method ObjectFreq (line 4987) | func (m *MockRedis) ObjectFreq(ctx context.Context, key string) *redis...
method ObjectIdleTime (line 5001) | func (m *MockRedis) ObjectIdleTime(ctx context.Context, key string) *r...
method ObjectRefCount (line 5015) | func (m *MockRedis) ObjectRefCount(ctx context.Context, key string) *r...
method PExpire (line 5029) | func (m *MockRedis) PExpire(ctx context.Context, key string, expiratio...
method PExpireAt (line 5043) | func (m *MockRedis) PExpireAt(ctx context.Context, key string, tm time...
method PExpireTime (line 5057) | func (m *MockRedis) PExpireTime(ctx context.Context, key string) *redi...
method PFAdd (line 5071) | func (m *MockRedis) PFAdd(ctx context.Context, key string, els ...any)...
method PFCount (line 5090) | func (m *MockRedis) PFCount(ctx context.Context, keys ...string) *redi...
method PFMerge (line 5109) | func (m *MockRedis) PFMerge(ctx context.Context, dest string, keys ......
method PTTL (line 5128) | func (m *MockRedis) PTTL(ctx context.Context, key string) *redis.Durat...
method Persist (line 5142) | func (m *MockRedis) Persist(ctx context.Context, key string) *redis.Bo...
method Ping (line 5156) | func (m *MockRedis) Ping(ctx context.Context) *redis.StatusCmd {
method Pipeline (line 5170) | func (m *MockRedis) Pipeline() redis.Pipeliner {
method Pipelined (line 5184) | func (m *MockRedis) Pipelined(ctx context.Context, fn func(redis.Pipel...
method PubSubChannels (line 5199) | func (m *MockRedis) PubSubChannels(ctx context.Context, pattern string...
method PubSubNumPat (line 5213) | func (m *MockRedis) PubSubNumPat(ctx context.Context) *redis.IntCmd {
method PubSubNumSub (line 5227) | func (m *MockRedis) PubSubNumSub(ctx context.Context, channels ...stri...
method PubSubShardChannels (line 5246) | func (m *MockRedis) PubSubShardChannels(ctx context.Context, pattern s...
method PubSubShardNumSub (line 5260) | func (m *MockRedis) PubSubShardNumSub(ctx context.Context, channels .....
method Publish (line 5279) | func (m *MockRedis) Publish(ctx context.Context, channel string, messa...
method Quit (line 5293) | func (m *MockRedis) Quit(ctx context.Context) *redis.StatusCmd {
method RPop (line 5307) | func (m *MockRedis) RPop(ctx context.Context, key string) *redis.Strin...
method RPopCount (line 5321) | func (m *MockRedis) RPopCount(ctx context.Context, key string, count i...
method RPopLPush (line 5335) | func (m *MockRedis) RPopLPush(ctx context.Context, source, destination...
method RPush (line 5349) | func (m *MockRedis) RPush(ctx context.Context, key string, values ...a...
method RPushX (line 5368) | func (m *MockRedis) RPushX(ctx context.Context, key string, values ......
method RandomKey (line 5387) | func (m *MockRedis) RandomKey(ctx context.Context) *redis.StringCmd {
method ReadOnly (line 5401) | func (m *MockRedis) ReadOnly(ctx context.Context) *redis.StatusCmd {
method ReadWrite (line 5415) | func (m *MockRedis) ReadWrite(ctx context.Context) *redis.StatusCmd {
method Rename (line 5429) | func (m *MockRedis) Rename(ctx context.Context, key, newkey string) *r...
method RenameNX (line 5443) | func (m *MockRedis) RenameNX(ctx context.Context, key, newkey string) ...
method Restore (line 5457) | func (m *MockRedis) Restore(ctx context.Context, key string, ttl time....
method RestoreReplace (line 5471) | func (m *MockRedis) RestoreReplace(ctx context.Context, key string, tt...
method SAdd (line 5485) | func (m *MockRedis) SAdd(ctx context.Context, key string, members ...a...
method SCard (line 5504) | func (m *MockRedis) SCard(ctx context.Context, key string) *redis.IntC...
method SDiff (line 5518) | func (m *MockRedis) SDiff(ctx context.Context, keys ...string) *redis....
method SDiffStore (line 5537) | func (m *MockRedis) SDiffStore(ctx context.Context, destination string...
method SInter (line 5556) | func (m *MockRedis) SInter(ctx context.Context, keys ...string) *redis...
method SInterCard (line 5575) | func (m *MockRedis) SInterCard(ctx context.Context, limit int64, keys ...
method SInterStore (line 5594) | func (m *MockRedis) SInterStore(ctx context.Context, destination strin...
method SIsMember (line 5613) | func (m *MockRedis) SIsMember(ctx context.Context, key string, member ...
method SMIsMember (line 5627) | func (m *MockRedis) SMIsMember(ctx context.Context, key string, member...
method SMembers (line 5646) | func (m *MockRedis) SMembers(ctx context.Context, key string) *redis.S...
method SMembersMap (line 5660) | func (m *MockRedis) SMembersMap(ctx context.Context, key string) *redi...
method SMove (line 5674) | func (m *MockRedis) SMove(ctx context.Context, source, destination str...
method SPop (line 5688) | func (m *MockRedis) SPop(ctx context.Context, key string) *redis.Strin...
method SPopN (line 5702) | func (m *MockRedis) SPopN(ctx context.Context, key string, count int64...
method SPublish (line 5716) | func (m *MockRedis) SPublish(ctx context.Context, channel string, mess...
method SRandMember (line 5730) | func (m *MockRedis) SRandMember(ctx context.Context, key string) *redi...
method SRandMemberN (line 5744) | func (m *MockRedis) SRandMemberN(ctx context.Context, key string, coun...
method SRem (line 5758) | func (m *MockRedis) SRem(ctx context.Context, key string, members ...a...
method SScan (line 5777) | func (m *MockRedis) SScan(ctx context.Context, key string, cursor uint...
method SUnion (line 5791) | func (m *MockRedis) SUnion(ctx context.Context, keys ...string) *redis...
method SUnionStore (line 5810) | func (m *MockRedis) SUnionStore(ctx context.Context, destination strin...
method Save (line 5829) | func (m *MockRedis) Save(ctx context.Context) *redis.StatusCmd {
method Scan (line 5843) | func (m *MockRedis) Scan(ctx context.Context, cursor uint64, match str...
method ScanType (line 5857) | func (m *MockRedis) ScanType(ctx context.Context, cursor uint64, match...
method ScriptExists (line 5871) | func (m *MockRedis) ScriptExists(ctx context.Context, hashes ...string...
method ScriptFlush (line 5890) | func (m *MockRedis) ScriptFlush(ctx context.Context) *redis.StatusCmd {
method ScriptKill (line 5904) | func (m *MockRedis) ScriptKill(ctx context.Context) *redis.StatusCmd {
method ScriptLoad (line 5918) | func (m *MockRedis) ScriptLoad(ctx context.Context, script string) *re...
method Set (line 5932) | func (m *MockRedis) Set(ctx context.Context, key string, value any, ex...
method SetArgs (line 5946) | func (m *MockRedis) SetArgs(ctx context.Context, key string, value any...
method SetBit (line 5960) | func (m *MockRedis) SetBit(ctx context.Context, key string, offset int...
method SetEx (line 5974) | func (m *MockRedis) SetEx(ctx context.Context, key string, value any, ...
method SetIFDEQ (line 5988) | func (m *MockRedis) SetIFDEQ(ctx context.Context, key string, value an...
method SetIFDEQGet (line 6002) | func (m *MockRedis) SetIFDEQGet(ctx context.Context, key string, value...
method SetIFDNE (line 6016) | func (m *MockRedis) SetIFDNE(ctx context.Context, key string, value an...
method SetIFDNEGet (line 6030) | func (m *MockRedis) SetIFDNEGet(ctx context.Context, key string, value...
method SetIFEQ (line 6044) | func (m *MockRedis) SetIFEQ(ctx context.Context, key string, value, ma...
method SetIFEQGet (line 6058) | func (m *MockRedis) SetIFEQGet(ctx context.Context, key string, value,...
method SetIFNE (line 6072) | func (m *MockRedis) SetIFNE(ctx context.Context, key string, value, ma...
method SetIFNEGet (line 6086) | func (m *MockRedis) SetIFNEGet(ctx context.Context, key string, value,...
method SetNX (line 6100) | func (m *MockRedis) SetNX(ctx context.Context, key string, value any, ...
method SetRange (line 6114) | func (m *MockRedis) SetRange(ctx context.Context, key string, offset i...
method SetXX (line 6128) | func (m *MockRedis) SetXX(ctx context.Context, key string, value any, ...
method Shutdown (line 6142) | func (m *MockRedis) Shutdown(ctx context.Context) *redis.StatusCmd {
method ShutdownNoSave (line 6156) | func (m *MockRedis) ShutdownNoSave(ctx context.Context) *redis.StatusC...
method ShutdownSave (line 6170) | func (m *MockRedis) ShutdownSave(ctx context.Context) *redis.StatusCmd {
method SlaveOf (line 6184) | func (m *MockRedis) SlaveOf(ctx context.Context, host, port string) *r...
method SlowLogGet (line 6198) | func (m *MockRedis) SlowLogGet(ctx context.Context, num int64) *redis....
method SlowLogLen (line 6212) | func (m *MockRedis) SlowLogLen(ctx context.Context) *redis.IntCmd {
method SlowLogReset (line 6226) | func (m *MockRedis) SlowLogReset(ctx context.Context) *redis.StatusCmd {
method Sort (line 6240) | func (m *MockRedis) Sort(ctx context.Context, key string, sort *redis....
method SortInterfaces (line 6254) | func (m *MockRedis) SortInterfaces(ctx context.Context, key string, so...
method SortRO (line 6268) | func (m *MockRedis) SortRO(ctx context.Context, key string, sort *redi...
method SortStore (line 6282) | func (m *MockRedis) SortStore(ctx context.Context, key, store string, ...
method StrLen (line 6296) | func (m *MockRedis) StrLen(ctx context.Context, key string) *redis.Int...
method TDigestAdd (line 6310) | func (m *MockRedis) TDigestAdd(ctx context.Context, key string, elemen...
method TDigestByRank (line 6329) | func (m *MockRedis) TDigestByRank(ctx context.Context, key string, ran...
method TDigestByRevRank (line 6348) | func (m *MockRedis) TDigestByRevRank(ctx context.Context, key string, ...
method TDigestCDF (line 6367) | func (m *MockRedis) TDigestCDF(ctx context.Context, key string, elemen...
method TDigestCreate (line 6386) | func (m *MockRedis) TDigestCreate(ctx context.Context, key string) *re...
method TDigestCreateWithCompression (line 6400) | func (m *MockRedis) TDigestCreateWithCompression(ctx context.Context, ...
method TDigestInfo (line 6414) | func (m *MockRedis) TDigestInfo(ctx context.Context, key string) *redi...
method TDigestMax (line 6428) | func (m *MockRedis) TDigestMax(ctx context.Context, key string) *redis...
method TDigestMerge (line 6442) | func (m *MockRedis) TDigestMerge(ctx context.Context, destKey string, ...
method TDigestMin (line 6461) | func (m *MockRedis) TDigestMin(ctx context.Context, key string) *redis...
method TDigestQuantile (line 6475) | func (m *MockRedis) TDigestQuantile(ctx context.Context, key string, e...
method TDigestRank (line 6494) | func (m *MockRedis) TDigestRank(ctx context.Context, key string, value...
method TDigestReset (line 6513) | func (m *MockRedis) TDigestReset(ctx context.Context, key string) *red...
method TDigestRevRank (line 6527) | func (m *MockRedis) TDigestRevRank(ctx context.Context, key string, va...
method TDigestTrimmedMean (line 6546) | func (m *MockRedis) TDigestTrimmedMean(ctx context.Context, key string...
method TSAdd (line 6560) | func (m *MockRedis) TSAdd(ctx context.Context, key string, timestamp a...
method TSAddWithArgs (line 6574) | func (m *MockRedis) TSAddWithArgs(ctx context.Context, key string, tim...
method TSAlter (line 6588) | func (m *MockRedis) TSAlter(ctx context.Context, key string, options *...
method TSCreate (line 6602) | func (m *MockRedis) TSCreate(ctx context.Context, key string) *redis.S...
method TSCreateRule (line 6616) | func (m *MockRedis) TSCreateRule(ctx context.Context, sourceKey, destK...
method TSCreateRuleWithArgs (line 6630) | func (m *MockRedis) TSCreateRuleWithArgs(ctx context.Context, sourceKe...
method TSCreateWithArgs (line 6644) | func (m *MockRedis) TSCreateWithArgs(ctx context.Context, key string, ...
method TSDecrBy (line 6658) | func (m *MockRedis) TSDecrBy(ctx context.Context, Key string, timestam...
method TSDecrByWithArgs (line 6672) | func (m *MockRedis) TSDecrByWithArgs(ctx context.Context, key string, ...
method TSDel (line 6686) | func (m *MockRedis) TSDel(ctx context.Context, Key string, fromTimesta...
method TSDeleteRule (line 6700) | func (m *MockRedis) TSDeleteRule(ctx context.Context, sourceKey, destK...
method TSGet (line 6714) | func (m *MockRedis) TSGet(ctx context.Context, key string) *redis.TSTi...
method TSGetWithArgs (line 6728) | func (m *MockRedis) TSGetWithArgs(ctx context.Context, key string, opt...
method TSIncrBy (line 6742) | func (m *MockRedis) TSIncrBy(ctx context.Context, Key string, timestam...
method TSIncrByWithArgs (line 6756) | func (m *MockRedis) TSIncrByWithArgs(ctx context.Context, key string, ...
method TSInfo (line 6770) | func (m *MockRedis) TSInfo(ctx context.Context, key string) *redis.Map...
method TSInfoWithArgs (line 6784) | func (m *MockRedis) TSInfoWithArgs(ctx context.Context, key string, op...
method TSMAdd (line 6798) | func (m *MockRedis) TSMAdd(ctx context.Context, ktvSlices [][]any) *re...
method TSMGet (line 6812) | func (m *MockRedis) TSMGet(ctx context.Context, filters []string) *red...
method TSMGetWithArgs (line 6826) | func (m *MockRedis) TSMGetWithArgs(ctx context.Context, filters []stri...
method TSMRange (line 6840) | func (m *MockRedis) TSMRange(ctx context.Context, fromTimestamp, toTim...
method TSMRangeWithArgs (line 6854) | func (m *MockRedis) TSMRangeWithArgs(ctx context.Context, fromTimestam...
method TSMRevRange (line 6868) | func (m *MockRedis) TSMRevRange(ctx context.Context, fromTimestamp, to...
method TSMRevRangeWithArgs (line 6882) | func (m *MockRedis) TSMRevRangeWithArgs(ctx context.Context, fromTimes...
method TSQueryIndex (line 6896) | func (m *MockRedis) TSQueryIndex(ctx context.Context, filterExpr []str...
method TSRange (line 6910) | func (m *MockRedis) TSRange(ctx context.Context, key string, fromTimes...
method TSRangeWithArgs (line 6924) | func (m *MockRedis) TSRangeWithArgs(ctx context.Context, key string, f...
method TSRevRange (line 6938) | func (m *MockRedis) TSRevRange(ctx context.Context, key string, fromTi...
method TSRevRangeWithArgs (line 6952) | func (m *MockRedis) TSRevRangeWithArgs(ctx context.Context, key string...
method TTL (line 6966) | func (m *MockRedis) TTL(ctx context.Context, key string) *redis.Durati...
method Time (line 6980) | func (m *MockRedis) Time(ctx context.Context) *redis.TimeCmd {
method TopKAdd (line 6994) | func (m *MockRedis) TopKAdd(ctx context.Context, key string, elements ...
method TopKCount (line 7013) | func (m *MockRedis) TopKCount(ctx context.Context, key string, element...
method TopKIncrBy (line 7032) | func (m *MockRedis) TopKIncrBy(ctx context.Context, key string, elemen...
method TopKInfo (line 7051) | func (m *MockRedis) TopKInfo(ctx context.Context, key string) *redis.T...
method TopKList (line 7065) | func (m *MockRedis) TopKList(ctx context.Context, key string) *redis.S...
method TopKListWithCount (line 7079) | func (m *MockRedis) TopKListWithCount(ctx context.Context, key string)...
method TopKQuery (line 7093) | func (m *MockRedis) TopKQuery(ctx context.Context, key string, element...
method TopKReserve (line 7112) | func (m *MockRedis) TopKReserve(ctx context.Context, key string, k int...
method TopKReserveWithOptions (line 7126) | func (m *MockRedis) TopKReserveWithOptions(ctx context.Context, key st...
method Touch (line 7140) | func (m *MockRedis) Touch(ctx context.Context, keys ...string) *redis....
method TxPipeline (line 7159) | func (m *MockRedis) TxPipeline() redis.Pipeliner {
method TxPipelined (line 7173) | func (m *MockRedis) TxPipelined(ctx context.Context, fn func(redis.Pip...
method Type (line 7188) | func (m *MockRedis) Type(ctx context.Context, key string) *redis.Statu...
method Unlink (line 7202) | func (m *MockRedis) Unlink(ctx context.Context, keys ...string) *redis...
method VAdd (line 7221) | func (m *MockRedis) VAdd(ctx context.Context, key, element string, val...
method VAddWithArgs (line 7235) | func (m *MockRedis) VAddWithArgs(ctx context.Context, key, element str...
method VCard (line 7249) | func (m *MockRedis) VCard(ctx context.Context, key string) *redis.IntC...
method VClearAttributes (line 7263) | func (m *MockRedis) VClearAttributes(ctx context.Context, key, element...
method VDim (line 7277) | func (m *MockRedis) VDim(ctx context.Context, key string) *redis.IntCmd {
method VEmb (line 7291) | func (m *MockRedis) VEmb(ctx context.Context, key, element string, raw...
method VGetAttr (line 7305) | func (m *MockRedis) VGetAttr(ctx context.Context, key, element string)...
method VInfo (line 7319) | func (m *MockRedis) VInfo(ctx context.Context, key string) *redis.MapS...
method VLinks (line 7333) | func (m *MockRedis) VLinks(ctx context.Context, key, element string) *...
method VLinksWithScores (line 7347) | func (m *MockRedis) VLinksWithScores(ctx context.Context, key, element...
method VRandMember (line 7361) | func (m *MockRedis) VRandMember(ctx context.Context, key string) *redi...
method VRandMemberCount (line 7375) | func (m *MockRedis) VRandMemberCount(ctx context.Context, key string, ...
method VRange (line 7389) | func (m *MockRedis) VRange(ctx context.Context, key, start, end string...
method VRem (line 7403) | func (m *MockRedis) VRem(ctx context.Context, key, element string) *re...
method VSetAttr (line 7417) | func (m *MockRedis) VSetAttr(ctx context.Context, key, element string,...
method VSim (line 7431) | func (m *MockRedis) VSim(ctx context.Context, key string, val redis.Ve...
method VSimWithArgs (line 7445) | func (m *MockRedis) VSimWithArgs(ctx context.Context, key string, val ...
method VSimWithArgsWithScores (line 7459) | func (m *MockRedis) VSimWithArgsWithScores(ctx context.Context, key st...
method VSimWithScores (line 7473) | func (m *MockRedis) VSimWithScores(ctx context.Context, key string, va...
method XAck (line 7487) | func (m *MockRedis) XAck(ctx context.Context, stream, group string, id...
method XAckDel (line 7506) | func (m *MockRedis) XAckDel(ctx context.Context, stream, group, mode s...
method XAdd (line 7525) | func (m *MockRedis) XAdd(ctx context.Context, a *redis.XAddArgs) *redi...
method XAutoClaim (line 7539) | func (m *MockRedis) XAutoClaim(ctx context.Context, a *redis.XAutoClai...
method XAutoClaimJustID (line 7553) | func (m *MockRedis) XAutoClaimJustID(ctx context.Context, a *redis.XAu...
method XCfgSet (line 7567) | func (m *MockRedis) XCfgSet(ctx context.Context, a *redis.XCfgSetArgs)...
method XClaim (line 7581) | func (m *MockRedis) XClaim(ctx context.Context, a *redis.XClaimArgs) *...
method XClaimJustID (line 7595) | func (m *MockRedis) XClaimJustID(ctx context.Context, a *redis.XClaimA...
method XDel (line 7609) | func (m *MockRedis) XDel(ctx context.Context, stream string, ids ...st...
method XDelEx (line 7628) | func (m *MockRedis) XDelEx(ctx context.Context, stream, mode string, i...
method XGroupCreate (line 7647) | func (m *MockRedis) XGroupCreate(ctx context.Context, stream, group, s...
method XGroupCreateConsumer (line 7661) | func (m *MockRedis) XGroupCreateConsumer(ctx context.Context, stream, ...
method XGroupCreateMkStream (line 7675) | func (m *MockRedis) XGroupCreateMkStream(ctx context.Context, stream, ...
method XGroupDelConsumer (line 7689) | func (m *MockRedis) XGroupDelConsumer(ctx context.Context, stream, gro...
method XGroupDestroy (line 7703) | func (m *MockRedis) XGroupDestroy(ctx context.Context, stream, group s...
method XGroupSetID (line 7717) | func (m *MockRedis) XGroupSetID(ctx context.Context, stream, group, st...
method XInfoConsumers (line 7731) | func (m *MockRedis) XInfoConsumers(ctx context.Context, key, group str...
method XInfoGroups (line 7745) | func (m *MockRedis) XInfoGroups(ctx context.Context, key string) *redi...
method XInfoStream (line 7759) | func (m *MockRedis) XInfoStream(ctx context.Context, key string) *redi...
method XInfoStreamFull (line 7773) | func (m *MockRedis) XInfoStreamFull(ctx context.Context, key string, c...
method XLen (line 7787) | func (m *MockRedis) XLen(ctx context.Context, stream string) *redis.In...
method XPending (line 7801) | func (m *MockRedis) XPending(ctx context.Context, stream, group string...
method XPendingExt (line 7815) | func (m *MockRedis) XPendingExt(ctx context.Context, a *redis.XPending...
method XRange (line 7829) | func (m *MockRedis) XRange(ctx context.Context, stream, start, stop st...
method XRangeN (line 7843) | func (m *MockRedis) XRangeN(ctx context.Context, stream, start, stop s...
method XRead (line 7857) | func (m *MockRedis) XRead(ctx context.Context, a *redis.XReadArgs) *re...
method XReadGroup (line 7871) | func (m *MockRedis) XReadGroup(ctx context.Context, a *redis.XReadGrou...
method XReadStreams (line 7885) | func (m *MockRedis) XReadStreams(ctx context.Context, streams ...strin...
method XRevRange (line 7904) | func (m *MockRedis) XRevRange(ctx context.Context, stream, start, stop...
method XRevRangeN (line 7918) | func (m *MockRedis) XRevRangeN(ctx context.Context, stream, start, sto...
method XTrimMaxLen (line 7932) | func (m *MockRedis) XTrimMaxLen(ctx context.Context, key string, maxLe...
method XTrimMaxLenApprox (line 7946) | func (m *MockRedis) XTrimMaxLenApprox(ctx context.Context, key string,...
method XTrimMaxLenApproxMode (line 7960) | func (m *MockRedis) XTrimMaxLenApproxMode(ctx context.Context, key str...
method XTrimMaxLenMode (line 7974) | func (m *MockRedis) XTrimMaxLenMode(ctx context.Context, key string, m...
method XTrimMinID (line 7988) | func (m *MockRedis) XTrimMinID(ctx context.Context, key, minID string)...
method XTrimMinIDApprox (line 8002) | func (m *MockRedis) XTrimMinIDApprox(ctx context.Context, key, minID s...
method XTrimMinIDApproxMode (line 8016) | func (m *MockRedis) XTrimMinIDApproxMode(ctx context.Context, key, min...
method XTrimMinIDMode (line 8030) | func (m *MockRedis) XTrimMinIDMode(ctx context.Context, key, minID, mo...
method ZAdd (line 8044) | func (m *MockRedis) ZAdd(ctx context.Context, key string, members ...r...
method ZAddArgs (line 8063) | func (m *MockRedis) ZAddArgs(ctx context.Context, key string, args red...
method ZAddArgsIncr (line 8077) | func (m *MockRedis) ZAddArgsIncr(ctx context.Context, key string, args...
method ZAddGT (line 8091) | func (m *MockRedis) ZAddGT(ctx context.Context, key string, members .....
method ZAddLT (line 8110) | func (m *MockRedis) ZAddLT(ctx context.Context, key string, members .....
method ZAddNX (line 8129) | func (m *MockRedis) ZAddNX(ctx context.Context, key string, members .....
method ZAddXX (line 8148) | func (m *MockRedis) ZAddXX(ctx context.Context, key string, members .....
method ZCard (line 8167) | func (m *MockRedis) ZCard(ctx context.Context, key string) *redis.IntC...
method ZCount (line 8181) | func (m *MockRedis) ZCount(ctx context.Context, key, min, max string) ...
method ZDiff (line 8195) | func (m *MockRedis) ZDiff(ctx context.Context, keys ...string) *redis....
method ZDiffStore (line 8214) | func (m *MockRedis) ZDiffStore(ctx context.Context, destination string...
method ZDiffWithScores (line 8233) | func (m *MockRedis) ZDiffWithScores(ctx context.Context, keys ...strin...
method ZIncrBy (line 8252) | func (m *MockRedis) ZIncrBy(ctx context.Context, key string, increment...
method ZInter (line 8266) | func (m *MockRedis) ZInter(ctx context.Context, store *redis.ZStore) *...
method ZInterCard (line 8280) | func (m *MockRedis) ZInterCard(ctx context.Context, limit int64, keys ...
method ZInterStore (line 8299) | func (m *MockRedis) ZInterStore(ctx context.Context, destination strin...
method ZInterWithScores (line 8313) | func (m *MockRedis) ZInterWithScores(ctx context.Context, store *redis...
method ZLexCount (line 8327) | func (m *MockRedis) ZLexCount(ctx context.Context, key, min, max strin...
method ZMPop (line 8341) | func (m *MockRedis) ZMPop(ctx context.Context, order string, count int...
method ZMScore (line 8360) | func (m *MockRedis) ZMScore(ctx context.Context, key string, members ....
method ZPopMax (line 8379) | func (m *MockRedis) ZPopMax(ctx context.Context, key string, count ......
method ZPopMin (line 8398) | func (m *MockRedis) ZPopMin(ctx context.Context, key string, count ......
method ZRandMember (line 8417) | func (m *MockRedis) ZRandMember(ctx context.Context, key string, count...
method ZRandMemberWithScores (line 8431) | func (m *MockRedis) ZRandMemberWithScores(ctx context.Context, key str...
method ZRange (line 8445) | func (m *MockRedis) ZRange(ctx context.Context, key string, start, sto...
method ZRangeArgs (line 8459) | func (m *MockRedis) ZRangeArgs(ctx context.Context, z redis.ZRangeArgs...
method ZRangeArgsWithScores (line 8473) | func (m *MockRedis) ZRangeArgsWithScores(ctx context.Context, z redis....
method ZRangeByLex (line 8487) | func (m *MockRedis) ZRangeByLex(ctx context.Context, key string, opt *...
method ZRangeByScore (line 8501) | func (m *MockRedis) ZRangeByScore(ctx context.Context, key string, opt...
method ZRangeByScoreWithScores (line 8515) | func (m *MockRedis) ZRangeByScoreWithScores(ctx context.Context, key s...
method ZRangeStore (line 8529) | func (m *MockRedis) ZRangeStore(ctx context.Context, dst string, z red...
method ZRangeWithScores (line 8543) | func (m *MockRedis) ZRangeWithScores(ctx context.Context, key string, ...
method ZRank (line 8557) | func (m *MockRedis) ZRank(ctx context.Context, key, member string) *re...
method ZRankWithScore (line 8571) | func (m *MockRedis) ZRankWithScore(ctx context.Context, key, member st...
method ZRem (line 8585) | func (m *MockRedis) ZRem(ctx context.Context, key string, members ...a...
method ZRemRangeByLex (line 8604) | func (m *MockRedis) ZRemRangeByLex(ctx context.Context, key, min, max ...
method ZRemRangeByRank (line 8618) | func (m *MockRedis) ZRemRangeByRank(ctx context.Context, key string, s...
method ZRemRangeByScore (line 8632) | func (m *MockRedis) ZRemRangeByScore(ctx context.Context, key, min, ma...
method ZRevRange (line 8646) | func (m *MockRedis) ZRevRange(ctx context.Context, key string, start, ...
method ZRevRangeByLex (line 8660) | func (m *MockRedis) ZRevRangeByLex(ctx context.Context, key string, op...
method ZRevRangeByScore (line 8674) | func (m *MockRedis) ZRevRangeByScore(ctx context.Context, key string, ...
method ZRevRangeByScoreWithScores (line 8688) | func (m *MockRedis) ZRevRangeByScoreWithScores(ctx context.Context, ke...
method ZRevRangeWithScores (line 8702) | func (m *MockRedis) ZRevRangeWithScores(ctx context.Context, key strin...
method ZRevRank (line 8716) | func (m *MockRedis) ZRevRank(ctx context.Context, key, member string) ...
method ZRevRankWithScore (line 8730) | func (m *MockRedis) ZRevRankWithScore(ctx context.Context, key, member...
method ZScan (line 8744) | func (m *MockRedis) ZScan(ctx context.Context, key string, cursor uint...
method ZScore (line 8758) | func (m *MockRedis) ZScore(ctx context.Context, key, member string) *r...
method ZUnion (line 8772) | func (m *MockRedis) ZUnion(ctx context.Context, store redis.ZStore) *r...
method ZUnionStore (line 8786) | func (m *MockRedis) ZUnionStore(ctx context.Context, dest string, stor...
method ZUnionWithScores (line 8800) | func (m *MockRedis) ZUnionWithScores(ctx context.Context, store redis....
type MockRedisMockRecorder (line 265) | type MockRedisMockRecorder struct
method ACLCat (line 290) | func (mr *MockRedisMockRecorder) ACLCat(ctx any) *gomock.Call {
method ACLCatArgs (line 304) | func (mr *MockRedisMockRecorder) ACLCatArgs(ctx, options any) *gomock....
method ACLDelUser (line 318) | func (mr *MockRedisMockRecorder) ACLDelUser(ctx, username any) *gomock...
method ACLDryRun (line 336) | func (mr *MockRedisMockRecorder) ACLDryRun(ctx, username any, command ...
method ACLGenPass (line 351) | func (mr *MockRedisMockRecorder) ACLGenPass(ctx, bit any) *gomock.Call {
method ACLList (line 365) | func (mr *MockRedisMockRecorder) ACLList(ctx any) *gomock.Call {
method ACLLog (line 379) | func (mr *MockRedisMockRecorder) ACLLog(ctx, count any) *gomock.Call {
method ACLLogReset (line 393) | func (mr *MockRedisMockRecorder) ACLLogReset(ctx any) *gomock.Call {
method ACLSetUser (line 411) | func (mr *MockRedisMockRecorder) ACLSetUser(ctx, username any, rules ....
method ACLUsers (line 426) | func (mr *MockRedisMockRecorder) ACLUsers(ctx any) *gomock.Call {
method ACLWhoAmI (line 440) | func (mr *MockRedisMockRecorder) ACLWhoAmI(ctx any) *gomock.Call {
method Append (line 454) | func (mr *MockRedisMockRecorder) Append(ctx, key, value any) *gomock.C...
method BFAdd (line 468) | func (mr *MockRedisMockRecorder) BFAdd(ctx, key, element any) *gomock....
method BFCard (line 482) | func (mr *MockRedisMockRecorder) BFCard(ctx, key any) *gomock.Call {
method BFExists (line 496) | func (mr *MockRedisMockRecorder) BFExists(ctx, key, element any) *gomo...
method BFInfo (line 510) | func (mr *MockRedisMockRecorder) BFInfo(ctx, key any) *gomock.Call {
method BFInfoArg (line 524) | func (mr *MockRedisMockRecorder) BFInfoArg(ctx, key, option any) *gomo...
method BFInfoCapacity (line 538) | func (mr *MockRedisMockRecorder) BFInfoCapacity(ctx, key any) *gomock....
method BFInfoExpansion (line 552) | func (mr *MockRedisMockRecorder) BFInfoExpansion(ctx, key any) *gomock...
method BFInfoFilters (line 566) | func (mr *MockRedisMockRecorder) BFInfoFilters(ctx, key any) *gomock.C...
method BFInfoItems (line 580) | func (mr *MockRedisMockRecorder) BFInfoItems(ctx, key any) *gomock.Call {
method BFInfoSize (line 594) | func (mr *MockRedisMockRecorder) BFInfoSize(ctx, key any) *gomock.Call {
method BFInsert (line 612) | func (mr *MockRedisMockRecorder) BFInsert(ctx, key, options any, eleme...
method BFLoadChunk (line 627) | func (mr *MockRedisMockRecorder) BFLoadChunk(ctx, key, iterator, data ...
method BFMAdd (line 645) | func (mr *MockRedisMockRecorder) BFMAdd(ctx, key any, elements ...any)...
method BFMExists (line 664) | func (mr *MockRedisMockRecorder) BFMExists(ctx, key any, elements ...a...
method BFReserve (line 679) | func (mr *MockRedisMockRecorder) BFReserve(ctx, key, errorRate, capaci...
method BFReserveExpansion (line 693) | func (mr *MockRedisMockRecorder) BFReserveExpansion(ctx, key, errorRat...
method BFReserveNonScaling (line 707) | func (mr *MockRedisMockRecorder) BFReserveNonScaling(ctx, key, errorRa...
method BFReserveWithArgs (line 721) | func (mr *MockRedisMockRecorder) BFReserveWithArgs(ctx, key, options a...
method BFScanDump (line 735) | func (mr *MockRedisMockRecorder) BFScanDump(ctx, key, iterator any) *g...
method BLMPop (line 753) | func (mr *MockRedisMockRecorder) BLMPop(ctx, timeout, direction, count...
method BLMove (line 768) | func (mr *MockRedisMockRecorder) BLMove(ctx, source, destination, srcp...
method BLPop (line 786) | func (mr *MockRedisMockRecorder) BLPop(ctx, timeout any, keys ...any) ...
method BRPop (line 805) | func (mr *MockRedisMockRecorder) BRPop(ctx, timeout any, keys ...any) ...
method BRPopLPush (line 820) | func (mr *MockRedisMockRecorder) BRPopLPush(ctx, source, destination, ...
method BZMPop (line 838) | func (mr *MockRedisMockRecorder) BZMPop(ctx, timeout, order, count any...
method BZPopMax (line 857) | func (mr *MockRedisMockRecorder) BZPopMax(ctx, timeout any, keys ...an...
method BZPopMin (line 876) | func (mr *MockRedisMockRecorder) BZPopMin(ctx, timeout any, keys ...an...
method BgRewriteAOF (line 891) | func (mr *MockRedisMockRecorder) BgRewriteAOF(ctx any) *gomock.Call {
method BgSave (line 905) | func (mr *MockRedisMockRecorder) BgSave(ctx any) *gomock.Call {
method BitCount (line 919) | func (mr *MockRedisMockRecorder) BitCount(ctx, key, bitCount any) *gom...
method BitField (line 937) | func (mr *MockRedisMockRecorder) BitField(ctx, key any, values ...any)...
method BitFieldRO (line 956) | func (mr *MockRedisMockRecorder) BitFieldRO(ctx, key any, values ...an...
method BitOpAnd (line 975) | func (mr *MockRedisMockRecorder) BitOpAnd(ctx, destKey any, keys ...an...
method BitOpAndOr (line 994) | func (mr *MockRedisMockRecorder) BitOpAndOr(ctx, destKey any, keys ......
method BitOpDiff (line 1013) | func (mr *MockRedisMockRecorder) BitOpDiff(ctx, destKey any, keys ...a...
method BitOpDiff1 (line 1032) | func (mr *MockRedisMockRecorder) BitOpDiff1(ctx, destKey any, keys ......
method BitOpNot (line 1047) | func (mr *MockRedisMockRecorder) BitOpNot(ctx, destKey, key any) *gomo...
method BitOpOne (line 1065) | func (mr *MockRedisMockRecorder) BitOpOne(ctx, destKey any, keys ...an...
method BitOpOr (line 1084) | func (mr *MockRedisMockRecorder) BitOpOr(ctx, destKey any, keys ...any...
method BitOpXor (line 1103) | func (mr *MockRedisMockRecorder) BitOpXor(ctx, destKey any, keys ...an...
method BitPos (line 1122) | func (mr *MockRedisMockRecorder) BitPos(ctx, key, bit any, pos ...any)...
method BitPosSpan (line 1137) | func (mr *MockRedisMockRecorder) BitPosSpan(ctx, key, bit, start, end,...
method CFAdd (line 1151) | func (mr *MockRedisMockRecorder) CFAdd(ctx, key, element any) *gomock....
method CFAddNX (line 1165) | func (mr *MockRedisMockRecorder) CFAddNX(ctx, key, element any) *gomoc...
method CFCount (line 1179) | func (mr *MockRedisMockRecorder) CFCount(ctx, key, element any) *gomoc...
method CFDel (line 1193) | func (mr *MockRedisMockRecorder) CFDel(ctx, key, element any) *gomock....
method CFExists (line 1207) | func (mr *MockRedisMockRecorder) CFExists(ctx, key, element any) *gomo...
method CFInfo (line 1221) | func (mr *MockRedisMockRecorder) CFInfo(ctx, key any) *gomock.Call {
method CFInsert (line 1239) | func (mr *MockRedisMockRecorder) CFInsert(ctx, key, options any, eleme...
method CFInsertNX (line 1258) | func (mr *MockRedisMockRecorder) CFInsertNX(ctx, key, options any, ele...
method CFLoadChunk (line 1273) | func (mr *MockRedisMockRecorder) CFLoadChunk(ctx, key, iterator, data ...
method CFMExists (line 1291) | func (mr *MockRedisMockRecorder) CFMExists(ctx, key any, elements ...a...
method CFReserve (line 1306) | func (mr *MockRedisMockRecorder) CFReserve(ctx, key, capacity any) *go...
method CFReserveBucketSize (line 1320) | func (mr *MockRedisMockRecorder) CFReserveBucketSize(ctx, key, capacit...
method CFReserveExpansion (line 1334) | func (mr *MockRedisMockRecorder) CFReserveExpansion(ctx, key, capacity...
method CFReserveMaxIterations (line 1348) | func (mr *MockRedisMockRecorder) CFReserveMaxIterations(ctx, key, capa...
method CFReserveWithArgs (line 1362) | func (mr *MockRedisMockRecorder) CFReserveWithArgs(ctx, key, options a...
method CFScanDump (line 1376) | func (mr *MockRedisMockRecorder) CFScanDump(ctx, key, iterator any) *g...
method CMSIncrBy (line 1394) | func (mr *MockRedisMockRecorder) CMSIncrBy(ctx, key any, elements ...a...
method CMSInfo (line 1409) | func (mr *MockRedisMockRecorder) CMSInfo(ctx, key any) *gomock.Call {
method CMSInitByDim (line 1423) | func (mr *MockRedisMockRecorder) CMSInitByDim(ctx, key, width, height ...
method CMSInitByProb (line 1437) | func (mr *MockRedisMockRecorder) CMSInitByProb(ctx, key, errorRate, pr...
method CMSMerge (line 1455) | func (mr *MockRedisMockRecorder) CMSMerge(ctx, destKey any, sourceKeys...
method CMSMergeWithWeight (line 1470) | func (mr *MockRedisMockRecorder) CMSMergeWithWeight(ctx, destKey, sour...
method CMSQuery (line 1488) | func (mr *MockRedisMockRecorder) CMSQuery(ctx, key any, elements ...an...
method ClientGetName (line 1503) | func (mr *MockRedisMockRecorder) ClientGetName(ctx any) *gomock.Call {
method ClientID (line 1517) | func (mr *MockRedisMockRecorder) ClientID(ctx any) *gomock.Call {
method ClientInfo (line 1531) | func (mr *MockRedisMockRecorder) ClientInfo(ctx any) *gomock.Call {
method ClientKill (line 1545) | func (mr *MockRedisMockRecorder) ClientKill(ctx, ipPort any) *gomock.C...
method ClientKillByFilter (line 1563) | func (mr *MockRedisMockRecorder) ClientKillByFilter(ctx any, keys ...a...
method ClientList (line 1578) | func (mr *MockRedisMockRecorder) ClientList(ctx any) *gomock.Call {
method ClientMaintNotifications (line 1592) | func (mr *MockRedisMockRecorder) ClientMaintNotifications(ctx, enabled...
method ClientPause (line 1606) | func (mr *MockRedisMockRecorder) ClientPause(ctx, dur any) *gomock.Call {
method ClientUnblock (line 1620) | func (mr *MockRedisMockRecorder) ClientUnblock(ctx, id any) *gomock.Ca...
method ClientUnblockWithError (line 1634) | func (mr *MockRedisMockRecorder) ClientUnblockWithError(ctx, id any) *...
method ClientUnpause (line 1648) | func (mr *MockRedisMockRecorder) ClientUnpause(ctx any) *gomock.Call {
method Close (line 1662) | func (mr *MockRedisMockRecorder) Close() *gomock.Call {
method ClusterAddSlots (line 1680) | func (mr *MockRedisMockRecorder) ClusterAddSlots(ctx any, slots ...any...
method ClusterAddSlotsRange (line 1695) | func (mr *MockRedisMockRecorder) ClusterAddSlotsRange(ctx, min, max an...
method ClusterCountFailureReports (line 1709) | func (mr *MockRedisMockRecorder) ClusterCountFailureReports(ctx, nodeI...
method ClusterCountKeysInSlot (line 1723) | func (mr *MockRedisMockRecorder) ClusterCountKeysInSlot(ctx, slot any)...
method ClusterDelSlots (line 1741) | func (mr *MockRedisMockRecorder) ClusterDelSlots(ctx any, slots ...any...
method ClusterDelSlotsRange (line 1756) | func (mr *MockRedisMockRecorder) ClusterDelSlotsRange(ctx, min, max an...
method ClusterFailover (line 1770) | func (mr *MockRedisMockRecorder) ClusterFailover(ctx any) *gomock.Call {
method ClusterForget (line 1784) | func (mr *MockRedisMockRecorder) ClusterForget(ctx, nodeID any) *gomoc...
method ClusterGetKeysInSlot (line 1798) | func (mr *MockRedisMockRecorder) ClusterGetKeysInSlot(ctx, slot, count...
method ClusterInfo (line 1812) | func (mr *MockRedisMockRecorder) ClusterInfo(ctx any) *gomock.Call {
method ClusterKeySlot (line 1826) | func (mr *MockRedisMockRecorder) ClusterKeySlot(ctx, key any) *gomock....
method ClusterLinks (line 1840) | func (mr *MockRedisMockRecorder) ClusterLinks(ctx any) *gomock.Call {
method ClusterMeet (line 1854) | func (mr *MockRedisMockRecorder) ClusterMeet(ctx, host, port any) *gom...
method ClusterMyID (line 1868) | func (mr *MockRedisMockRecorder) ClusterMyID(ctx any) *gomock.Call {
method ClusterMyShardID (line 1882) | func (mr *MockRedisMockRecorder) ClusterMyShardID(ctx any) *gomock.Call {
method ClusterNodes (line 1896) | func (mr *MockRedisMockRecorder) ClusterNodes(ctx any) *gomock.Call {
method ClusterReplicate (line 1910) | func (mr *MockRedisMockRecorder) ClusterReplicate(ctx, nodeID any) *go...
method ClusterResetHard (line 1924) | func (mr *MockRedisMockRecorder) ClusterResetHard(ctx any) *gomock.Call {
method ClusterResetSoft (line 1938) | func (mr *MockRedisMockRecorder) ClusterResetSoft(ctx any) *gomock.Call {
method ClusterSaveConfig (line 1952) | func (mr *MockRedisMockRecorder) ClusterSaveConfig(ctx any) *gomock.Ca...
method ClusterShards (line 1966) | func (mr *MockRedisMockRecorder) ClusterShards(ctx any) *gomock.Call {
method ClusterSlaves (line 1980) | func (mr *MockRedisMockRecorder) ClusterSlaves(ctx, nodeID any) *gomoc...
method ClusterSlots (line 1994) | func (mr *MockRedisMockRecorder) ClusterSlots(ctx any) *gomock.Call {
method Command (line 2008) | func (mr *MockRedisMockRecorder) Command(ctx any) *gomock.Call {
method CommandGetKeys (line 2026) | func (mr *MockRedisMockRecorder) CommandGetKeys(ctx any, commands ...a...
method CommandGetKeysAndFlags (line 2045) | func (mr *MockRedisMockRecorder) CommandGetKeysAndFlags(ctx any, comma...
method CommandList (line 2060) | func (mr *MockRedisMockRecorder) CommandList(ctx, filter any) *gomock....
method ConfigGet (line 2074) | func (mr *MockRedisMockRecorder) ConfigGet(ctx, parameter any) *gomock...
method ConfigResetStat (line 2088) | func (mr *MockRedisMockRecorder) ConfigResetStat(ctx any) *gomock.Call {
method ConfigRewrite (line 2102) | func (mr *MockRedisMockRecorder) ConfigRewrite(ctx any) *gomock.Call {
method ConfigSet (line 2116) | func (mr *MockRedisMockRecorder) ConfigSet(ctx, parameter, value any) ...
method Copy (line 2130) | func (mr *MockRedisMockRecorder) Copy(ctx, sourceKey, destKey, db, rep...
method DBSize (line 2144) | func (mr *MockRedisMockRecorder) DBSize(ctx any) *gomock.Call {
method DebugObject (line 2158) | func (mr *MockRedisMockRecorder) DebugObject(ctx, key any) *gomock.Call {
method Decr (line 2172) | func (mr *MockRedisMockRecorder) Decr(ctx, key any) *gomock.Call {
method DecrBy (line 2186) | func (mr *MockRedisMockRecorder) DecrBy(ctx, key, decrement any) *gomo...
method Del (line 2204) | func (mr *MockRedisMockRecorder) Del(ctx any, keys ...any) *gomock.Call {
method DelExArgs (line 2219) | func (mr *MockRedisMockRecorder) DelExArgs(ctx, key, a any) *gomock.Ca...
method Digest (line 2233) | func (mr *MockRedisMockRecorder) Digest(ctx, key any) *gomock.Call {
method Dump (line 2247) | func (mr *MockRedisMockRecorder) Dump(ctx, key any) *gomock.Call {
method Echo (line 2261) | func (mr *MockRedisMockRecorder) Echo(ctx, message any) *gomock.Call {
method Eval (line 2279) | func (mr *MockRedisMockRecorder) Eval(ctx, script, keys any, args ...a...
method EvalRO (line 2298) | func (mr *MockRedisMockRecorder) EvalRO(ctx, script, keys any, args .....
method EvalSha (line 2317) | func (mr *MockRedisMockRecorder) EvalSha(ctx, sha1, keys any, args ......
method EvalShaRO (line 2336) | func (mr *MockRedisMockRecorder) EvalShaRO(ctx, sha1, keys any, args ....
method Exists (line 2355) | func (mr *MockRedisMockRecorder) Exists(ctx any, keys ...any) *gomock....
method Expire (line 2370) | func (mr *MockRedisMockRecorder) Expire(ctx, key, expiration any) *gom...
method ExpireAt (line 2384) | func (mr *MockRedisMockRecorder) ExpireAt(ctx, key, tm any) *gomock.Ca...
method ExpireGT (line 2398) | func (mr *MockRedisMockRecorder) ExpireGT(ctx, key, expiration any) *g...
method ExpireLT (line 2412) | func (mr *MockRedisMockRecorder) ExpireLT(ctx, key, expiration any) *g...
method ExpireNX (line 2426) | func (mr *MockRedisMockRecorder) ExpireNX(ctx, key, expiration any) *g...
method ExpireTime (line 2440) | func (mr *MockRedisMockRecorder) ExpireTime(ctx, key any) *gomock.Call {
method ExpireXX (line 2454) | func (mr *MockRedisMockRecorder) ExpireXX(ctx, key, expiration any) *g...
method FCall (line 2472) | func (mr *MockRedisMockRecorder) FCall(ctx, function, keys any, args ....
method FCallRO (line 2491) | func (mr *MockRedisMockRecorder) FCallRO(ctx, function, keys any, args...
method FCallRo (line 2510) | func (mr *MockRedisMockRecorder) FCallRo(ctx, function, keys any, args...
method FTAggregate (line 2525) | func (mr *MockRedisMockRecorder) FTAggregate(ctx, index, query any) *g...
method FTAggregateWithArgs (line 2539) | func (mr *MockRedisMockRecorder) FTAggregateWithArgs(ctx, index, query...
method FTAliasAdd (line 2553) | func (mr *MockRedisMockRecorder) FTAliasAdd(ctx, index, alias any) *go...
method FTAliasDel (line 2567) | func (mr *MockRedisMockRecorder) FTAliasDel(ctx, alias any) *gomock.Ca...
method FTAliasUpdate (line 2581) | func (mr *MockRedisMockRecorder) FTAliasUpdate(ctx, index, alias any) ...
method FTAlter (line 2595) | func (mr *MockRedisMockRecorder) FTAlter(ctx, index, skipInitialScan, ...
method FTConfigGet (line 2609) | func (mr *MockRedisMockRecorder) FTConfigGet(ctx, option any) *gomock....
method FTConfigSet (line 2623) | func (mr *MockRedisMockRecorder) FTConfigSet(ctx, option, value any) *...
method FTCreate (line 2641) | func (mr *MockRedisMockRecorder) FTCreate(ctx, index, options any, sch...
method FTCursorDel (line 2656) | func (mr *MockRedisMockRecorder) FTCursorDel(ctx, index, cursorId any)...
method FTCursorRead (line 2670) | func (mr *MockRedisMockRecorder) FTCursorRead(ctx, index, cursorId, co...
method FTDictAdd (line 2688) | func (mr *MockRedisMockRecorder) FTDictAdd(ctx, dict any, term ...any)...
method FTDictDel (line 2707) | func (mr *MockRedisMockRecorder) FTDictDel(ctx, dict any, term ...any)...
method FTDictDump (line 2722) | func (mr *MockRedisMockRecorder) FTDictDump(ctx, dict any) *gomock.Call {
method FTDropIndex (line 2736) | func (mr *MockRedisMockRecorder) FTDropIndex(ctx, index any) *gomock.C...
method FTDropIndexWithArgs (line 2750) | func (mr *MockRedisMockRecorder) FTDropIndexWithArgs(ctx, index, optio...
method FTExplain (line 2764) | func (mr *MockRedisMockRecorder) FTExplain(ctx, index, query any) *gom...
method FTExplainWithArgs (line 2778) | func (mr *MockRedisMockRecorder) FTExplainWithArgs(ctx, index, query, ...
method FTHybrid (line 2792) | func (mr *MockRedisMockRecorder) FTHybrid(ctx, index, searchExpr, vect...
method FTHybridWithArgs (line 2806) | func (mr *MockRedisMockRecorder) FTHybridWithArgs(ctx, index, options ...
method FTInfo (line 2820) | func (mr *MockRedisMockRecorder) FTInfo(ctx, index any) *gomock.Call {
method FTSearch (line 2834) | func (mr *MockRedisMockRecorder) FTSearch(ctx, index, query any) *gomo...
method FTSearchWithArgs (line 2848) | func (mr *MockRedisMockRecorder) FTSearchWithArgs(ctx, index, query, o...
method FTSpellCheck (line 2862) | func (mr *MockRedisMockRecorder) FTSpellCheck(ctx, index, query any) *...
method FTSpellCheckWithArgs (line 2876) | func (mr *MockRedisMockRecorder) FTSpellCheckWithArgs(ctx, index, quer...
method FTSynDump (line 2890) | func (mr *MockRedisMockRecorder) FTSynDump(ctx, index any) *gomock.Call {
method FTSynUpdate (line 2904) | func (mr *MockRedisMockRecorder) FTSynUpdate(ctx, index, synGroupId, t...
method FTSynUpdateWithArgs (line 2918) | func (mr *MockRedisMockRecorder) FTSynUpdateWithArgs(ctx, index, synGr...
method FTTagVals (line 2932) | func (mr *MockRedisMockRecorder) FTTagVals(ctx, index, field any) *gom...
method FT_List (line 2946) | func (mr *MockRedisMockRecorder) FT_List(ctx any) *gomock.Call {
method FlushAll (line 2960) | func (mr *MockRedisMockRecorder) FlushAll(ctx any) *gomock.Call {
method FlushAllAsync (line 2974) | func (mr *MockRedisMockRecorder) FlushAllAsync(ctx any) *gomock.Call {
method FlushDB (line 2988) | func (mr *MockRedisMockRecorder) FlushDB(ctx any) *gomock.Call {
method FlushDBAsync (line 3002) | func (mr *MockRedisMockRecorder) FlushDBAsync(ctx any) *gomock.Call {
method FunctionDelete (line 3016) | func (mr *MockRedisMockRecorder) FunctionDelete(ctx, libName any) *gom...
method FunctionDump (line 3030) | func (mr *MockRedisMockRecorder) FunctionDump(ctx any) *gomock.Call {
method FunctionFlush (line 3044) | func (mr *MockRedisMockRecorder) FunctionFlush(ctx any) *gomock.Call {
method FunctionFlushAsync (line 3058) | func (mr *MockRedisMockRecorder) FunctionFlushAsync(ctx any) *gomock.C...
method FunctionKill (line 3072) | func (mr *MockRedisMockRecorder) FunctionKill(ctx any) *gomock.Call {
method FunctionList (line 3086) | func (mr *MockRedisMockRecorder) FunctionList(ctx, q any) *gomock.Call {
method FunctionLoad (line 3100) | func (mr *MockRedisMockRecorder) FunctionLoad(ctx, code any) *gomock.C...
method FunctionLoadReplace (line 3114) | func (mr *MockRedisMockRecorder) FunctionLoadReplace(ctx, code any) *g...
method FunctionRestore (line 3128) | func (mr *MockRedisMockRecorder) FunctionRestore(ctx, libDump any) *go...
method FunctionStats (line 3142) | func (mr *MockRedisMockRecorder) FunctionStats(ctx any) *gomock.Call {
method GeoAdd (line 3160) | func (mr *MockRedisMockRecorder) GeoAdd(ctx, key any, geoLocation ...a...
method GeoDist (line 3175) | func (mr *MockRedisMockRecorder) GeoDist(ctx, key, member1, member2, u...
method GeoHash (line 3193) | func (mr *MockRedisMockRecorder) GeoHash(ctx, key any, members ...any)...
method GeoPos (line 3212) | func (mr *MockRedisMockRecorder) GeoPos(ctx, key any, members ...any) ...
method GeoRadius (line 3227) | func (mr *MockRedisMockRecorder) GeoRadius(ctx, key, longitude, latitu...
method GeoRadiusByMember (line 3241) | func (mr *MockRedisMockRecorder) GeoRadiusByMember(ctx, key, member, q...
method GeoRadiusByMemberStore (line 3255) | func (mr *MockRedisMockRecorder) GeoRadiusByMemberStore(ctx, key, memb...
method GeoRadiusStore (line 3269) | func (mr *MockRedisMockRecorder) GeoRadiusStore(ctx, key, longitude, l...
method GeoSearch (line 3283) | func (mr *MockRedisMockRecorder) GeoSearch(ctx, key, q any) *gomock.Ca...
method GeoSearchLocation (line 3297) | func (mr *MockRedisMockRecorder) GeoSearchLocation(ctx, key, q any) *g...
method GeoSearchStore (line 3311) | func (mr *MockRedisMockRecorder) GeoSearchStore(ctx, key, store, q any...
method Get (line 3325) | func (mr *MockRedisMockRecorder) Get(ctx, key any) *gomock.Call {
method GetBit (line 3339) | func (mr *MockRedisMockRecorder) GetBit(ctx, key, offset any) *gomock....
method GetDel (line 3353) | func (mr *MockRedisMockRecorder) GetDel(ctx, key any) *gomock.Call {
method GetEx (line 3367) | func (mr *MockRedisMockRecorder) GetEx(ctx, key, expiration any) *gomo...
method GetRange (line 3381) | func (mr *MockRedisMockRecorder) GetRange(ctx, key, start, end any) *g...
method GetSet (line 3395) | func (mr *MockRedisMockRecorder) GetSet(ctx, key, value any) *gomock.C...
method HDel (line 3413) | func (mr *MockRedisMockRecorder) HDel(ctx, key any, fields ...any) *go...
method HExists (line 3428) | func (mr *MockRedisMockRecorder) HExists(ctx, key, field any) *gomock....
method HExpire (line 3446) | func (mr *MockRedisMockRecorder) HExpire(ctx, key, expiration any, fie...
method HExpireAt (line 3465) | func (mr *MockRedisMockRecorder) HExpireAt(ctx, key, tm any, fields .....
method HExpireAtWithArgs (line 3484) | func (mr *MockRedisMockRecorder) HExpireAtWithArgs(ctx, key, tm, expir...
method HExpireTime (line 3503) | func (mr *MockRedisMockRecorder) HExpireTime(ctx, key any, fields ...a...
method HExpireWithArgs (line 3522) | func (mr *MockRedisMockRecorder) HExpireWithArgs(ctx, key, expiration,...
method HGet (line 3537) | func (mr *MockRedisMockRecorder) HGet(ctx, key, field any) *gomock.Call {
method HGetAll (line 3551) | func (mr *MockRedisMockRecorder) HGetAll(ctx, key any) *gomock.Call {
method HGetDel (line 3569) | func (mr *MockRedisMockRecorder) HGetDel(ctx, key any, fields ...any) ...
method HGetEX (line 3588) | func (mr *MockRedisMockRecorder) HGetEX(ctx, key any, fields ...any) *...
method HGetEXWithArgs (line 3607) | func (mr *MockRedisMockRecorder) HGetEXWithArgs(ctx, key, options any,...
method HIncrBy (line 3622) | func (mr *MockRedisMockRecorder) HIncrBy(ctx, key, field, incr any) *g...
method HIncrByFloat (line 3636) | func (mr *MockRedisMockRecorder) HIncrByFloat(ctx, key, field, incr an...
method HKeys (line 3650) | func (mr *MockRedisMockRecorder) HKeys(ctx, key any) *gomock.Call {
method HLen (line 3664) | func (mr *MockRedisMockRecorder) HLen(ctx, key any) *gomock.Call {
method HMGet (line 3682) | func (mr *MockRedisMockRecorder) HMGet(ctx, key any, fields ...any) *g...
method HMSet (line 3701) | func (mr *MockRedisMockRecorder) HMSet(ctx, key any, values ...any) *g...
method HPExpire (line 3720) | func (mr *MockRedisMockRecorder) HPExpire(ctx, key, expiration any, fi...
method HPExpireAt (line 3739) | func (mr *MockRedisMockRecorder) HPExpireAt(ctx, key, tm any, fields ....
method HPExpireAtWithArgs (line 3758) | func (mr *MockRedisMockRecorder) HPExpireAtWithArgs(ctx, key, tm, expi...
method HPExpireTime (line 3777) | func (mr *MockRedisMockRecorder) HPExpireTime(ctx, key any, fields ......
method HPExpireWithArgs (line 3796) | func (mr *MockRedisMockRecorder) HPExpireWithArgs(ctx, key, expiration...
method HPTTL (line 3815) | func (mr *MockRedisMockRecorder) HPTTL(ctx, key any, fields ...any) *g...
method HPersist (line 3834) | func (mr *MockRedisMockRecorder) HPersist(ctx, key any, fields ...any)...
method HRandField (line 3849) | func (mr *MockRedisMockRecorder) HRandField(ctx, key, count any) *gomo...
method HRandFieldWithValues (line 3863) | func (mr *MockRedisMockRecorder) HRandFieldWithValues(ctx, key, count ...
method HScan (line 3877) | func (mr *MockRedisMockRecorder) HScan(ctx, key, cursor, match, count ...
method HScanNoValues (line 3891) | func (mr *MockRedisMockRecorder) HScanNoValues(ctx, key, cursor, match...
method HSet (line 3909) | func (mr *MockRedisMockRecorder) HSet(ctx, key any, values ...any) *go...
method HSetEX (line 3928) | func (mr *MockRedisMockRecorder) HSetEX(ctx, key any, fieldsAndValues ...
method HSetEXWithArgs (line 3947) | func (mr *MockRedisMockRecorder) HSetEXWithArgs(ctx, key, options any,...
method HSetNX (line 3962) | func (mr *MockRedisMockRecorder) HSetNX(ctx, key, field, value any) *g...
method HStrLen (line 3976) | func (mr *MockRedisMockRecorder) HStrLen(ctx, key, field any) *gomock....
method HTTL (line 3994) | func (mr *MockRedisMockRecorder) HTTL(ctx, key any, fields ...any) *go...
method HVals (line 4009) | func (mr *MockRedisMockRecorder) HVals(ctx, key any) *gomock.Call {
method HealthCheck (line 4023) | func (mr *MockRedisMockRecorder) HealthCheck() *gomock.Call {
method Incr (line 4037) | func (mr *MockRedisMockRecorder) Incr(ctx, key any) *gomock.Call {
method IncrBy (line 4051) | func (mr *MockRedisMockRecorder) IncrBy(ctx, key, value any) *gomock.C...
method IncrByFloat (line 4065) | func (mr *MockRedisMockRecorder) IncrByFloat(ctx, key, value any) *gom...
method Info (line 4083) | func (mr *MockRedisMockRecorder) Info(ctx any, section ...any) *gomock...
method JSONArrAppend (line 4102) | func (mr *MockRedisMockRecorder) JSONArrAppend(ctx, key, path any, val...
method JSONArrIndex (line 4121) | func (mr *MockRedisMockRecorder) JSONArrIndex(ctx, key, path any, valu...
method JSONArrIndexWithArgs (line 4140) | func (mr *MockRedisMockRecorder) JSONArrIndexWithArgs(ctx, key, path, ...
method JSONArrInsert (line 4159) | func (mr *MockRedisMockRecorder) JSONArrInsert(ctx, key, path, index a...
method JSONArrLen (line 4174) | func (mr *MockRedisMockRecorder) JSONArrLen(ctx, key, path any) *gomoc...
method JSONArrPop (line 4188) | func (mr *MockRedisMockRecorder) JSONArrPop(ctx, key, path, index any)...
method JSONArrTrim (line 4202) | func (mr *MockRedisMockRecorder) JSONArrTrim(ctx, key, path any) *gomo...
method JSONArrTrimWithArgs (line 4216) | func (mr *MockRedisMockRecorder) JSONArrTrimWithArgs(ctx, key, path, o...
method JSONClear (line 4230) | func (mr *MockRedisMockRecorder) JSONClear(ctx, key, path any) *gomock...
method JSONDebugMemory (line 4244) | func (mr *MockRedisMockRecorder) JSONDebugMemory(ctx, key, path any) *...
method JSONDel (line 4258) | func (mr *MockRedisMockRecorder) JSONDel(ctx, key, path any) *gomock.C...
method JSONForget (line 4272) | func (mr *MockRedisMockRecorder) JSONForget(ctx, key, path any) *gomoc...
method JSONGet (line 4290) | func (mr *MockRedisMockRecorder) JSONGet(ctx, key any, paths ...any) *...
method JSONGetWithArgs (line 4309) | func (mr *MockRedisMockRecorder) JSONGetWithArgs(ctx, key, options any...
method JSONMGet (line 4328) | func (mr *MockRedisMockRecorder) JSONMGet(ctx, path any, keys ...any) ...
method JSONMSet (line 4347) | func (mr *MockRedisMockRecorder) JSONMSet(ctx any, params ...any) *gom...
method JSONMSetArgs (line 4362) | func (mr *MockRedisMockRecorder) JSONMSetArgs(ctx, docs any) *gomock.C...
method JSONMerge (line 4376) | func (mr *MockRedisMockRecorder) JSONMerge(ctx, key, path, value any) ...
method JSONNumIncrBy (line 4390) | func (mr *MockRedisMockRecorder) JSONNumIncrBy(ctx, key, path, value a...
method JSONObjKeys (line 4404) | func (mr *MockRedisMockRecorder) JSONObjKeys(ctx, key, path any) *gomo...
method JSONObjLen (line 4418) | func (mr *MockRedisMockRecorder) JSONObjLen(ctx, key, path any) *gomoc...
method JSONSet (line 4432) | func (mr *MockRedisMockRecorder) JSONSet(ctx, key, path, value any) *g...
method JSONSetMode (line 4446) | func (mr *MockRedisMockRecorder) JSONSetMode(ctx, key, path, value, mo...
method JSONStrAppend (line 4460) | func (mr *MockRedisMockRecorder) JSONStrAppend(ctx, key, path, value a...
method JSONStrLen (line 4474) | func (mr *MockRedisMockRecorder) JSONStrLen(ctx, key, path any) *gomoc...
method JSONToggle (line 4488) | func (mr *MockRedisMockRecorder) JSONToggle(ctx, key, path any) *gomoc...
method JSONType (line 4502) | func (mr *MockRedisMockRecorder) JSONType(ctx, key, path any) *gomock....
method Keys (line 4516) | func (mr *MockRedisMockRecorder) Keys(ctx, pattern any) *gomock.Call {
method LCS (line 4530) | func (mr *MockRedisMockRecorder) LCS(ctx, q any) *gomock.Call {
method LIndex (line 4544) | func (mr *MockRedisMockRecorder) LIndex(ctx, key, index any) *gomock.C...
method LInsert (line 4558) | func (mr *MockRedisMockRecorder) LInsert(ctx, key, op, pivot, value an...
method LInsertAfter (line 4572) | func (mr *MockRedisMockRecorder) LInsertAfter(ctx, key, pivot, value a...
method LInsertBefore (line 4586) | func (mr *MockRedisMockRecorder) LInsertBefore(ctx, key, pivot, value ...
method LLen (line 4600) | func (mr *MockRedisMockRecorder) LLen(ctx, key any) *gomock.Call {
method LMPop (line 4618) | func (mr *MockRedisMockRecorder) LMPop(ctx, direction, count any, keys...
method LMove (line 4633) | func (mr *MockRedisMockRecorder) LMove(ctx, source, destination, srcpo...
method LPop (line 4647) | func (mr *MockRedisMockRecorder) LPop(ctx, key any) *gomock.Call {
method LPopCount (line 4661) | func (mr *MockRedisMockRecorder) LPopCount(ctx, key, count any) *gomoc...
method LPos (line 4675) | func (mr *MockRedisMockRecorder) LPos(ctx, key, value, args any) *gomo...
method LPosCount (line 4689) | func (mr *MockRedisMockRecorder) LPosCount(ctx, key, value, count, arg...
method LPush (line 4707) | func (mr *MockRedisMockRecorder) LPush(ctx, key any, values ...any) *g...
method LPushX (line 4726) | func (mr *MockRedisMockRecorder) LPushX(ctx, key any, values ...any) *...
method LRange (line 4741) | func (mr *MockRedisMockRecorder) LRange(ctx, key, start, stop any) *go...
method LRem (line 4755) | func (mr *MockRedisMockRecorder) LRem(ctx, key, count, value any) *gom...
method LSet (line 4769) | func (mr *MockRedisMockRecorder) LSet(ctx, key, index, value any) *gom...
method LTrim (line 4783) | func (mr *MockRedisMockRecorder) LTrim(ctx, key, start, stop any) *gom...
method LastSave (line 4797) | func (mr *MockRedisMockRecorder) LastSave(ctx any) *gomock.Call {
method Latency (line 4811) | func (mr *MockRedisMockRecorder) Latency(ctx any) *gomock.Call {
method LatencyReset (line 4829) | func (mr *MockRedisMockRecorder) LatencyReset(ctx any, events ...any) ...
method MGet (line 4848) | func (mr *MockRedisMockRecorder) MGet(ctx any, keys ...any) *gomock.Ca...
method MSet (line 4867) | func (mr *MockRedisMockRecorder) MSet(ctx any, values ...any) *gomock....
method MSetEX (line 4886) | func (mr *MockRedisMockRecorder) MSetEX(ctx, args any, values ...any) ...
method MSetNX (line 4905) | func (mr *MockRedisMockRecorder) MSetNX(ctx any, values ...any) *gomoc...
method MemoryUsage (line 4924) | func (mr *MockRedisMockRecorder) MemoryUsage(ctx, key any, samples ......
method Migrate (line 4939) | func (mr *MockRedisMockRecorder) Migrate(ctx, host, port, key, db, tim...
method ModuleLoadex (line 4953) | func (mr *MockRedisMockRecorder) ModuleLoadex(ctx, conf any) *gomock.C...
method Move (line 4967) | func (mr *MockRedisMockRecorder) Move(ctx, key, db any) *gomock.Call {
method ObjectEncoding (line 4981) | func (mr *MockRedisMockRecorder) ObjectEncoding(ctx, key any) *gomock....
method ObjectFreq (line 4995) | func (mr *MockRedisMockRecorder) ObjectFreq(ctx, key any) *gomock.Call {
method ObjectIdleTime (line 5009) | func (mr *MockRedisMockRecorder) ObjectIdleTime(ctx, key any) *gomock....
method ObjectRefCount (line 5023) | func (mr *MockRedisMockRecorder) ObjectRefCount(ctx, key any) *gomock....
method PExpire (line 5037) | func (mr *MockRedisMockRecorder) PExpire(ctx, key, expiration any) *go...
method PExpireAt (line 5051) | func (mr *MockRedisMockRecorder) PExpireAt(ctx, key, tm any) *gomock.C...
method PExpireTime (line 5065) | func (mr *MockRedisMockRecorder) PExpireTime(ctx, key any) *gomock.Call {
method PFAdd (line 5083) | func (mr *MockRedisMockRecorder) PFAdd(ctx, key any, els ...any) *gomo...
method PFCount (line 5102) | func (mr *MockRedisMockRecorder) PFCount(ctx any, keys ...any) *gomock...
method PFMerge (line 5121) | func (mr *MockRedisMockRecorder) PFMerge(ctx, dest any, keys ...any) *...
method PTTL (line 5136) | func (mr *MockRedisMockRecorder) PTTL(ctx, key any) *gomock.Call {
method Persist (line 5150) | func (mr *MockRedisMockRecorder) Persist(ctx, key any) *gomock.Call {
method Ping (line 5164) | func (mr *MockRedisMockRecorder) Ping(ctx any) *gomock.Call {
method Pipeline (line 5178) | func (mr *MockRedisMockRecorder) Pipeline() *gomock.Call {
method Pipelined (line 5193) | func (mr *MockRedisMockRecorder) Pipelined(ctx, fn any) *gomock.Call {
method PubSubChannels (line 5207) | func (mr *MockRedisMockRecorder) PubSubChannels(ctx, pattern any) *gom...
method PubSubNumPat (line 5221) | func (mr *MockRedisMockRecorder) PubSubNumPat(ctx any) *gomock.Call {
method PubSubNumSub (line 5239) | func (mr *MockRedisMockRecorder) PubSubNumSub(ctx any, channels ...any...
method PubSubShardChannels (line 5254) | func (mr *MockRedisMockRecorder) PubSubShardChannels(ctx, pattern any)...
method PubSubShardNumSub (line 5272) | func (mr *MockRedisMockRecorder) PubSubShardNumSub(ctx any, channels ....
method Publish (line 5287) | func (mr *MockRedisMockRecorder) Publish(ctx, channel, message any) *g...
method Quit (line 5301) | func (mr *MockRedisMockRecorder) Quit(ctx any) *gomock.Call {
method RPop (line 5315) | func (mr *MockRedisMockRecorder) RPop(ctx, key any) *gomock.Call {
method RPopCount (line 5329) | func (mr *MockRedisMockRecorder) RPopCount(ctx, key, count any) *gomoc...
method RPopLPush (line 5343) | func (mr *MockRedisMockRecorder) RPopLPush(ctx, source, destination an...
method RPush (line 5361) | func (mr *MockRedisMockRecorder) RPush(ctx, key any, values ...any) *g...
method RPushX (line 5380) | func (mr *MockRedisMockRecorder) RPushX(ctx, key any, values ...any) *...
method RandomKey (line 5395) | func (mr *MockRedisMockRecorder) RandomKey(ctx any) *gomock.Call {
method ReadOnly (line 5409) | func (mr *MockRedisMockRecorder) ReadOnly(ctx any) *gomock.Call {
method ReadWrite (line 5423) | func (mr *MockRedisMockRecorder) ReadWrite(ctx any) *gomock.Call {
method Rename (line 5437) | func (mr *MockRedisMockRecorder) Rename(ctx, key, newkey any) *gomock....
method RenameNX (line 5451) | func (mr *MockRedisMockRecorder) RenameNX(ctx, key, newkey any) *gomoc...
method Restore (line 5465) | func (mr *MockRedisMockRecorder) Restore(ctx, key, ttl, value any) *go...
method RestoreReplace (line 5479) | func (mr *MockRedisMockRecorder) RestoreReplace(ctx, key, ttl, value a...
method SAdd (line 5497) | func (mr *MockRedisMockRecorder) SAdd(ctx, key any, members ...any) *g...
method SCard (line 5512) | func (mr *MockRedisMockRecorder) SCard(ctx, key any) *gomock.Call {
method SDiff (line 5530) | func (mr *MockRedisMockRecorder) SDiff(ctx any, keys ...any) *gomock.C...
method SDiffStore (line 5549) | func (mr *MockRedisMockRecorder) SDiffStore(ctx, destination any, keys...
method SInter (line 5568) | func (mr *MockRedisMockRecorder) SInter(ctx any, keys ...any) *gomock....
method SInterCard (line 5587) | func (mr *MockRedisMockRecorder) SInterCard(ctx, limit any, keys ...an...
method SInterStore (line 5606) | func (mr *MockRedisMockRecorder) SInterStore(ctx, destination any, key...
method SIsMember (line 5621) | func (mr *MockRedisMockRecorder) SIsMember(ctx, key, member any) *gomo...
method SMIsMember (line 5639) | func (mr *MockRedisMockRecorder) SMIsMember(ctx, key any, members ...a...
method SMembers (line 5654) | func (mr *MockRedisMockRecorder) SMembers(ctx, key any) *gomock.Call {
method SMembersMap (line 5668) | func (mr *MockRedisMockRecorder) SMembersMap(ctx, key any) *gomock.Call {
method SMove (line 5682) | func (mr *MockRedisMockRecorder) SMove(ctx, source, destination, membe...
method SPop (line 5696) | func (mr *MockRedisMockRecorder) SPop(ctx, key any) *gomock.Call {
method SPopN (line 5710) | func (mr *MockRedisMockRecorder) SPopN(ctx, key, count any) *gomock.Ca...
method SPublish (line 5724) | func (mr *MockRedisMockRecorder) SPublish(ctx, channel, message any) *...
method SRandMember (line 5738) | func (mr *MockRedisMockRecorder) SRandMember(ctx, key any) *gomock.Call {
method SRandMemberN (line 5752) | func (mr *MockRedisMockRecorder) SRandMemberN(ctx, key, count any) *go...
method SRem (line 5770) | func (mr *MockRedisMockRecorder) SRem(ctx, key any, members ...any) *g...
method SScan (line 5785) | func (mr *MockRedisMockRecorder) SScan(ctx, key, cursor, match, count ...
method SUnion (line 5803) | func (mr *MockRedisMockRecorder) SUnion(ctx any, keys ...any) *gomock....
method SUnionStore (line 5822) | func (mr *MockRedisMockRecorder) SUnionStore(ctx, destination any, key...
method Save (line 5837) | func (mr *MockRedisMockRecorder) Save(ctx any) *gomock.Call {
method Scan (line 5851) | func (mr *MockRedisMockRecorder) Scan(ctx, cursor, match, count any) *...
method ScanType (line 5865) | func (mr *MockRedisMockRecorder) ScanType(ctx, cursor, match, count, k...
method ScriptExists (line 5883) | func (mr *MockRedisMockRecorder) ScriptExists(ctx any, hashes ...any) ...
method ScriptFlush (line 5898) | func (mr *MockRedisMockRecorder) ScriptFlush(ctx any) *gomock.Call {
method ScriptKill (line 5912) | func (mr *MockRedisMockRecorder) ScriptKill(ctx any) *gomock.Call {
method ScriptLoad (line 5926) | func (mr *MockRedisMockRecorder) ScriptLoad(ctx, script any) *gomock.C...
method Set (line 5940) | func (mr *MockRedisMockRecorder) Set(ctx, key, value, expiration any) ...
method SetArgs (line 5954) | func (mr *MockRedisMockRecorder) SetArgs(ctx, key, value, a any) *gomo...
method SetBit (line 5968) | func (mr *MockRedisMockRecorder) SetBit(ctx, key, offset, value any) *...
method SetEx (line 5982) | func (mr *MockRedisMockRecorder) SetEx(ctx, key, value, expiration any...
method SetIFDEQ (line 5996) | func (mr *MockRedisMockRecorder) SetIFDEQ(ctx, key, value, matchDigest...
method SetIFDEQGet (line 6010) | func (mr *MockRedisMockRecorder) SetIFDEQGet(ctx, key, value, matchDig...
method SetIFDNE (line 6024) | func (mr *MockRedisMockRecorder) SetIFDNE(ctx, key, value, matchDigest...
method SetIFDNEGet (line 6038) | func (mr *MockRedisMockRecorder) SetIFDNEGet(ctx, key, value, matchDig...
method SetIFEQ (line 6052) | func (mr *MockRedisMockRecorder) SetIFEQ(ctx, key, value, matchValue, ...
method SetIFEQGet (line 6066) | func (mr *MockRedisMockRecorder) SetIFEQGet(ctx, key, value, matchValu...
method SetIFNE (line 6080) | func (mr *MockRedisMockRecorder) SetIFNE(ctx, key, value, matchValue, ...
method SetIFNEGet (line 6094) | func (mr *MockRedisMockRecorder) SetIFNEGet(ctx, key, value, matchValu...
method SetNX (line 6108) | func (mr *MockRedisMockRecorder) SetNX(ctx, key, value, expiration any...
method SetRange (line 6122) | func (mr *MockRedisMockRecorder) SetRange(ctx, key, offset, value any)...
method SetXX (line 6136) | func (mr *MockRedisMockRecorder) SetXX(ctx, key, value, expiration any...
method Shutdown (line 6150) | func (mr *MockRedisMockRecorder) Shutdown(ctx any) *gomock.Call {
method ShutdownNoSave (line 6164) | func (mr *MockRedisMockRecorder) ShutdownNoSave(ctx any) *gomock.Call {
method ShutdownSave (line 6178) | func (mr *MockRedisMockRecorder) ShutdownSave(ctx any) *gomock.Call {
method SlaveOf (line 6192) | func (mr *MockRedisMockRecorder) SlaveOf(ctx, host, port any) *gomock....
method SlowLogGet (line 6206) | func (mr *MockRedisMockRecorder) SlowLogGet(ctx, num any) *gomock.Call {
method SlowLogLen (line 6220) | func (mr *MockRedisMockRecorder) SlowLogLen(ctx any) *gomock.Call {
method SlowLogReset (line 6234) | func (mr *MockRedisMockRecorder) SlowLogReset(ctx any) *gomock.Call {
method Sort (line 6248) | func (mr *MockRedisMockRecorder) Sort(ctx, key, sort any) *gomock.Call {
method SortInterfaces (line 6262) | func (mr *MockRedisMockRecorder) SortInterfaces(ctx, key, sort any) *g...
method SortRO (line 6276) | func (mr *MockRedisMockRecorder) SortRO(ctx, key, sort any) *gomock.Ca...
method SortStore (line 6290) | func (mr *MockRedisMockRecorder) SortStore(ctx, key, store, sort any) ...
method StrLen (line 6304) | func (mr *MockRedisMockRecorder) StrLen(ctx, key any) *gomock.Call {
method TDigestAdd (line 6322) | func (mr *MockRedisMockRecorder) TDigestAdd(ctx, key any, elements ......
method TDigestByRank (line 6341) | func (mr *MockRedisMockRecorder) TDigestByRank(ctx, key any, rank ...a...
method TDigestByRevRank (line 6360) | func (mr *MockRedisMockRecorder) TDigestByRevRank(ctx, key any, rank ....
method TDigestCDF (line 6379) | func (mr *MockRedisMockRecorder) TDigestCDF(ctx, key any, elements ......
method TDigestCreate (line 6394) | func (mr *MockRedisMockRecorder) TDigestCreate(ctx, key any) *gomock.C...
method TDigestCreateWithCompression (line 6408) | func (mr *MockRedisMockRecorder) TDigestCreateWithCompression(ctx, key...
method TDigestInfo (line 6422) | func (mr *MockRedisMockRecorder) TDigestInfo(ctx, key any) *gomock.Call {
method TDigestMax (line 6436) | func (mr *MockRedisMockRecorder) TDigestMax(ctx, key any) *gomock.Call {
method TDigestMerge (line 6454) | func (mr *MockRedisMockRecorder) TDigestMerge(ctx, destKey, options an...
method TDigestMin (line 6469) | func (mr *MockRedisMockRecorder) TDigestMin(ctx, key any) *gomock.Call {
method TDigestQuantile (line 6487) | func (mr *MockRedisMockRecorder) TDigestQuantile(ctx, key any, element...
method TDigestRank (line 6506) | func (mr *MockRedisMockRecorder) TDigestRank(ctx, key any, values ...a...
method TDigestReset (line 6521) | func (mr *MockRedisMockRecorder) TDigestReset(ctx, key any) *gomock.Ca...
method TDigestRevRank (line 6539) | func (mr *MockRedisMockRecorder) TDigestRevRank(ctx, key any, values ....
method TDigestTrimmedMean (line 6554) | func (mr *MockRedisMockRecorder) TDigestTrimmedMean(ctx, key, lowCutQu...
method TSAdd (line 6568) | func (mr *MockRedisMockRecorder) TSAdd(ctx, key, timestamp, value any)...
method TSAddWithArgs (line 6582) | func (mr *MockRedisMockRecorder) TSAddWithArgs(ctx, key, timestamp, va...
method TSAlter (line 6596) | func (mr *MockRedisMockRecorder) TSAlter(ctx, key, options any) *gomoc...
method TSCreate (line 6610) | func (mr *MockRedisMockRecorder) TSCreate(ctx, key any) *gomock.Call {
method TSCreateRule (line 6624) | func (mr *MockRedisMockRecorder) TSCreateRule(ctx, sourceKey, destKey,...
method TSCreateRuleWithArgs (line 6638) | func (mr *MockRedisMockRecorder) TSCreateRuleWithArgs(ctx, sourceKey, ...
method TSCreateWithArgs (line 6652) | func (mr *MockRedisMockRecorder) TSCreateWithArgs(ctx, key, options an...
method TSDecrBy (line 6666) | func (mr *MockRedisMockRecorder) TSDecrBy(ctx, Key, timestamp any) *go...
method TSDecrByWithArgs (line 6680) | func (mr *MockRedisMockRecorder) TSDecrByWithArgs(ctx, key, timestamp,...
method TSDel (line 6694) | func (mr *MockRedisMockRecorder) TSDel(ctx, Key, fromTimestamp, toTime...
method TSDeleteRule (line 6708) | func (mr *MockRedisMockRecorder) TSDeleteRule(ctx, sourceKey, destKey ...
method TSGet (line 6722) | func (mr *MockRedisMockRecorder) TSGet(ctx, key any) *gomock.Call {
method TSGetWithArgs (line 6736) | func (mr *MockRedisMockRecorder) TSGetWithArgs(ctx, key, options any) ...
method TSIncrBy (line 6750) | func (mr *MockRedisMockRecorder) TSIncrBy(ctx, Key, timestamp any) *go...
method TSIncrByWithArgs (line 6764) | func (mr *MockRedisMockRecorder) TSIncrByWithArgs(ctx, key, timestamp,...
method TSInfo (line 6778) | func (mr *MockRedisMockRecorder) TSInfo(ctx, key any) *gomock.Call {
method TSInfoWithArgs (line 6792) | func (mr *MockRedisMockRecorder) TSInfoWithArgs(ctx, key, options any)...
method TSMAdd (line 6806) | func (mr *MockRedisMockRecorder) TSMAdd(ctx, ktvSlices any) *gomock.Ca...
method TSMGet (line 6820) | func (mr *MockRedisMockRecorder) TSMGet(ctx, filters any) *gomock.Call {
method TSMGetWithArgs (line 6834) | func (mr *MockRedisMockRecorder) TSMGetWithArgs(ctx, filters, options ...
method TSMRange (line 6848) | func (mr *MockRedisMockRecorder) TSMRange(ctx, fromTimestamp, toTimest...
method TSMRangeWithArgs (line 6862) | func (mr *MockRedisMockRecorder) TSMRangeWithArgs(ctx, fromTimestamp, ...
method TSMRevRange (line 6876) | func (mr *MockRedisMockRecorder) TSMRevRange(ctx, fromTimestamp, toTim...
method TSMRevRangeWithArgs (line 6890) | func (mr *MockRedisMockRecorder) TSMRevRangeWithArgs(ctx, fromTimestam...
method TSQueryIndex (line 6904) | func (mr *MockRedisMockRecorder) TSQueryIndex(ctx, filterExpr any) *go...
method TSRange (line 6918) | func (mr *MockRedisMockRecorder) TSRange(ctx, key, fromTimestamp, toTi...
method TSRangeWithArgs (line 6932) | func (mr *MockRedisMockRecorder) TSRangeWithArgs(ctx, key, fromTimesta...
method TSRevRange (line 6946) | func (mr *MockRedisMockRecorder) TSRevRange(ctx, key, fromTimestamp, t...
method TSRevRangeWithArgs (line 6960) | func (mr *MockRedisMockRecorder) TSRevRangeWithArgs(ctx, key, fromTime...
method TTL (line 6974) | func (mr *MockRedisMockRecorder) TTL(ctx, key any) *gomock.Call {
method Time (line 6988) | func (mr *MockRedisMockRecorder) Time(ctx any) *gomock.Call {
method TopKAdd (line 7006) | func (mr *MockRedisMockRecorder) TopKAdd(ctx, key any, elements ...any...
method TopKCount (line 7025) | func (mr *MockRedisMockRecorder) TopKCount(ctx, key any, elements ...a...
method TopKIncrBy (line 7044) | func (mr *MockRedisMockRecorder) TopKIncrBy(ctx, key any, elements ......
method TopKInfo (line 7059) | func (mr *MockRedisMockRecorder) TopKInfo(ctx, key any) *gomock.Call {
method TopKList (line 7073) | func (mr *MockRedisMockRecorder) TopKList(ctx, key any) *gomock.Call {
method TopKListWithCount (line 7087) | func (mr *MockRedisMockRecorder) TopKListWithCount(ctx, key any) *gomo...
method TopKQuery (line 7105) | func (mr *MockRedisMockRecorder) TopKQuery(ctx, key any, elements ...a...
method TopKReserve (line 7120) | func (mr *MockRedisMockRecorder) TopKReserve(ctx, key, k any) *gomock....
method TopKReserveWithOptions (line 7134) | func (mr *MockRedisMockRecorder) TopKReserveWithOptions(ctx, key, k, w...
method Touch (line 7152) | func (mr *MockRedisMockRecorder) Touch(ctx any, keys ...any) *gomock.C...
method TxPipeline (line 7167) | func (mr *MockRedisMockRecorder) TxPipeline() *gomock.Call {
method TxPipelined (line 7182) | func (mr *MockRedisMockRecorder) TxPipelined(ctx, fn any) *gomock.Call {
method Type (line 7196) | func (mr *MockRedisMockRecorder) Type(ctx, key any) *gomock.Call {
method Unlink (line 7214) | func (mr *MockRedisMockRecorder) Unlink(ctx any, keys ...any) *gomock....
method VAdd (line 7229) | func (mr *MockRedisMockRecorder) VAdd(ctx, key, element, val any) *gom...
method VAddWithArgs (line 7243) | func (mr *MockRedisMockRecorder) VAddWithArgs(ctx, key, element, val, ...
method VCard (line 7257) | func (mr *MockRedisMockRecorder) VCard(ctx, key any) *gomock.Call {
method VClearAttributes (line 7271) | func (mr *MockRedisMockRecorder) VClearAttributes(ctx, key, element an...
method VDim (line 7285) | func (mr *MockRedisMockRecorder) VDim(ctx, key any) *gomock.Call {
method VEmb (line 7299) | func (mr *MockRedisMockRecorder) VEmb(ctx, key, element, raw any) *gom...
method VGetAttr (line 7313) | func (mr *MockRedisMockRecorder) VGetAttr(ctx, key, element any) *gomo...
method VInfo (line 7327) | func (mr *MockRedisMockRecorder) VInfo(ctx, key any) *gomock.Call {
method VLinks (line 7341) | func (mr *MockRedisMockRecorder) VLinks(ctx, key, element any) *gomock...
method VLinksWithScores (line 7355) | func (mr *MockRedisMockRecorder) VLinksWithScores(ctx, key, element an...
method VRandMember (line 7369) | func (mr *MockRedisMockRecorder) VRandMember(ctx, key any) *gomock.Call {
method VRandMemberCount (line 7383) | func (mr *MockRedisMockRecorder) VRandMemberCount(ctx, key, count any)...
method VRange (line 7397) | func (mr *MockRedisMockRecorder) VRange(ctx, key, start, end, count an...
method VRem (line 7411) | func (mr *MockRedisMockRecorder) VRem(ctx, key, element any) *gomock.C...
method VSetAttr (line 7425) | func (mr *MockRedisMockRecorder) VSetAttr(ctx, key, element, attr any)...
method VSim (line 7439) | func (mr *MockRedisMockRecorder) VSim(ctx, key, val any) *gomock.Call {
method VSimWithArgs (line 7453) | func (mr *MockRedisMockRecorder) VSimWithArgs(ctx, key, val, args any)...
method VSimWithArgsWithScores (line 7467) | func (mr *MockRedisMockRecorder) VSimWithArgsWithScores(ctx, key, val,...
method VSimWithScores (line 7481) | func (mr *MockRedisMockRecorder) VSimWithScores(ctx, key, val any) *go...
method XAck (line 7499) | func (mr *MockRedisMockRecorder) XAck(ctx, stream, group any, ids ...a...
method XAckDel (line 7518) | func (mr *MockRedisMockRecorder) XAckDel(ctx, stream, group, mode any,...
method XAdd (line 7533) | func (mr *MockRedisMockRecorder) XAdd(ctx, a any) *gomock.Call {
method XAutoClaim (line 7547) | func (mr *MockRedisMockRecorder) XAutoClaim(ctx, a any) *gomock.Call {
method XAutoClaimJustID (line 7561) | func (mr *MockRedisMockRecorder) XAutoClaimJustID(ctx, a any) *gomock....
method XCfgSet (line 7575) | func (mr *MockRedisMockRecorder) XCfgSet(ctx, a any) *gomock.Call {
method XClaim (line 7589) | func (mr *MockRedisMockRecorder) XClaim(ctx, a any) *gomock.Call {
method XClaimJustID (line 7603) | func (mr *MockRedisMockRecorder) XClaimJustID(ctx, a any) *gomock.Call {
method XDel (line 7621) | func (mr *MockRedisMockRecorder) XDel(ctx, stream any, ids ...any) *go...
method XDelEx (line 7640) | func (mr *MockRedisMockRecorder) XDelEx(ctx, stream, mode any, ids ......
method XGroupCreate (line 7655) | func (mr *MockRedisMockRecorder) XGroupCreate(ctx, stream, group, star...
method XGroupCreateConsumer (line 7669) | func (mr *MockRedisMockRecorder) XGroupCreateConsumer(ctx, stream, gro...
method XGroupCreateMkStream (line 7683) | func (mr *MockRedisMockRecorder) XGroupCreateMkStream(ctx, stream, gro...
method XGroupDelConsumer (line 7697) | func (mr *MockRedisMockRecorder) XGroupDelConsumer(ctx, stream, group,...
method XGroupDestroy (line 7711) | func (mr *MockRedisMockRecorder) XGroupDestroy(ctx, stream, group any)...
method XGroupSetID (line 7725) | func (mr *MockRedisMo
Condensed preview — 858 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (8,436K chars).
[
{
"path": ".codeclimate.yml",
"chars": 763,
"preview": "version: \"2\"\n\nchecks:\n argument-count:\n enabled: true\n config:\n threshold: 6\n complex-logic:\n enabled: t"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 689,
"preview": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: triage\nassignees: ''\n\n---\n\n**Describe t"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.md",
"chars": 599,
"preview": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: triage\nassignees: ''\n\n---\n\n**Is your"
},
{
"path": ".github/ISSUE_TEMPLATE/question.md",
"chars": 97,
"preview": "---\nname: Question\nabout: Ask a question on using gofr\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n\n"
},
{
"path": ".github/dependabot.yml",
"chars": 672,
"preview": "---\nversion: 2\nupdates:\n - package-ecosystem: \"gomod\"\n open-pull-requests-limit: 10 # avoid spam, if no one reacts\n"
},
{
"path": ".github/pull_request_template.md",
"chars": 902,
"preview": "## Pull Request Template\n\n\n**Description:**\n\n- Provide a concise explanation of the changes made.\n- Mention the issu"
},
{
"path": ".github/workflows/go.yml",
"chars": 17052,
"preview": "---\nname: Workflow-Pipeline\npermissions:\n contents: read\n\n# Define when this workflow should run\non:\n # Run on push ev"
},
{
"path": ".github/workflows/typos.yml",
"chars": 262,
"preview": "name: Typos Check\non:\n push:\n pull_request:\njobs:\n typos:\n runs-on: ubuntu-latest\n permissions:\n contents:"
},
{
"path": ".github/workflows/website-prod.yml",
"chars": 2947,
"preview": "name: Build and Deploy\npermissions:\n contents: read\n\non:\n push:\n tags:\n - \"v*.*.*\"\n\nenv:\n APP_NAME: gofr-webs"
},
{
"path": ".github/workflows/website-stage.yml",
"chars": 2993,
"preview": "name: Build and Deploy Website To Stage\npermissions:\n contents: read\n\non:\n push:\n branches:\n - development\n\nen"
},
{
"path": ".gitignore",
"chars": 326,
"preview": "# Binaries for programs and plugins\n*.exe\n*.exe~\n*.dll\n*.so\n*.dylib\n\n# Test binary, built with `go test -c`\n*.test\n\n\n# O"
},
{
"path": ".golangci.yml",
"chars": 4422,
"preview": "version: \"2\"\nlinters:\n default: none\n enable:\n - asciicheck\n - bodyclose\n - canonicalheader\n - copyloopvar"
},
{
"path": ".ls-lint.yml",
"chars": 47,
"preview": "---\nls:\n .go: snake_case\n .pb.go: snake_case\n"
},
{
"path": ".qlty/.gitignore",
"chars": 63,
"preview": "*\n!configs\n!configs/**\n!hooks\n!hooks/**\n!qlty.toml\n!.gitignore\n"
},
{
"path": ".qlty/configs/.hadolint.yaml",
"chars": 20,
"preview": "ignored:\n - DL3008\n"
},
{
"path": ".qlty/configs/.yamllint.yaml",
"chars": 178,
"preview": "rules:\n document-start: disable\n quoted-strings:\n required: only-when-needed\n extra-allowed: [\"{|}\"]\n key-dupli"
},
{
"path": ".qlty/qlty.toml",
"chars": 3435,
"preview": "# This file was automatically generated by `qlty init`.\n# You can modify it to suit your needs.\n# We recommend you to co"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 5220,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participa"
},
{
"path": "CONTRIBUTING.md",
"chars": 9069,
"preview": "## Contribution Guidelines\n* Minor changes can be done directly by editing code on GitHub. GitHub automatically creates "
},
{
"path": "Dockerfile",
"chars": 312,
"preview": "FROM golang:1.24\n\nRUN mkdir -p /go/src/gofr.dev\nWORKDIR /go/src/gofr.dev\nCOPY . .\n\nRUN go build -ldflags \"-linkmode exte"
},
{
"path": "LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 5545,
"preview": "<div align=\"center\">\n<h1 style=\"font-size: 100px; font-weight: 500;\">\n <i>Go</i>Fr\n</h1>\n<div align=\"center\">\n<p>\n<im"
},
{
"path": "SECURITY.md",
"chars": 438,
"preview": "# Security Policy\n\n## Supported Versions\n\nFollowing versions are being supported for security updates.\n\n| Version | Supp"
},
{
"path": "docs/Dockerfile",
"chars": 761,
"preview": "FROM ghcr.io/gofr-dev/website:latest AS builder\n\nWORKDIR /app\n\nCOPY docs/quick-start /app/src/app/docs/quick-start\nCOPY"
},
{
"path": "docs/advanced-guide/authentication/page.md",
"chars": 5262,
"preview": "# Authentication\n\nAuthentication is a crucial aspect of web applications, controlling access to resources based on user "
},
{
"path": "docs/advanced-guide/building-cli-applications/page.md",
"chars": 1722,
"preview": "# Building CLI Applications\n\nGoFr provides a simple way to build command-line applications using `app.NewCMD()`. This cr"
},
{
"path": "docs/advanced-guide/circuit-breaker/page.md",
"chars": 5825,
"preview": "# Circuit Breaker in HTTP Communication\n\nCalls to remote resources and services can fail due to temporary issues like sl"
},
{
"path": "docs/advanced-guide/custom-spans-in-tracing/page.md",
"chars": 1494,
"preview": "# Custom Spans In Tracing\n\nGoFr's built-in tracing provides valuable insights into application's behavior. However, some"
},
{
"path": "docs/advanced-guide/dealing-with-sql/page.md",
"chars": 1370,
"preview": "# Dealing with SQL\n\nGoFr simplifies the process of connecting to SQL databases where one needs to add respective configs"
},
{
"path": "docs/advanced-guide/debugging/page.md",
"chars": 3726,
"preview": "# Using `pprof` in GoFr Applications\n\nIn GoFr applications, `pprof` profiling is automatically enabled. The profiling en"
},
{
"path": "docs/advanced-guide/gofr-errors/page.md",
"chars": 3813,
"preview": "# Error Handling\n\nGoFr provides a structured error handling approach to simplify error management in your applications. "
},
{
"path": "docs/advanced-guide/graphql/page.md",
"chars": 10270,
"preview": "# GraphQL in GoFr\n\nGoFr provides a **Schema-First** approach to building GraphQL APIs. This means you define your API co"
},
{
"path": "docs/advanced-guide/grpc/page.md",
"chars": 19894,
"preview": "# gRPC with Gofr\n\nWe have already seen how GoFr can help ease the development of HTTP servers, but there are cases where"
},
{
"path": "docs/advanced-guide/grpc-streaming/page.md",
"chars": 15984,
"preview": "# gRPC Streaming with GoFr\n\nGoFr provides comprehensive support for gRPC streaming, enabling efficient real-time communi"
},
{
"path": "docs/advanced-guide/handling-data-migrations/page.md",
"chars": 14832,
"preview": "# Handling Data Migrations\n\nIf you make manual changes to your database, you must inform other developers so they can ap"
},
{
"path": "docs/advanced-guide/handling-file/page.md",
"chars": 14848,
"preview": "# Handling File\n\nGoFr simplifies the complexity of working with different file stores by offering a uniform API. This al"
},
{
"path": "docs/advanced-guide/http-communication/page.md",
"chars": 9488,
"preview": "# Inter-Service HTTP Calls\n\nGoFr promotes microservice architecture and to facilitate the same, it provides the support "
},
{
"path": "docs/advanced-guide/injecting-databases-drivers/page.md",
"chars": 1271,
"preview": "# Injecting Database Drivers\nKeeping in mind the size of the framework in the final build, it felt counter-productive to"
},
{
"path": "docs/advanced-guide/key-value-store/page.md",
"chars": 10500,
"preview": "# Key Value Store\n\nA key-value store is a type of NoSQL database that uses a simple data model: each item is stored as a"
},
{
"path": "docs/advanced-guide/middlewares/page.md",
"chars": 4627,
"preview": "# Middleware in GoFr\n\nMiddleware allows you intercepting and manipulating HTTP requests and responses flowing through yo"
},
{
"path": "docs/advanced-guide/monitoring-service-health/page.md",
"chars": 4084,
"preview": "# Monitoring Service Health\n\nHealth check in microservices refers to a mechanism or process implemented within each serv"
},
{
"path": "docs/advanced-guide/overriding-default/page.md",
"chars": 3975,
"preview": "# Overriding Default\n\nGoFr allows overriding default behavior of its features.\n\n## Raw response format\n\nGoFr by default "
},
{
"path": "docs/advanced-guide/publishing-custom-metrics/page.md",
"chars": 6472,
"preview": "# Publishing Custom Metrics\n\nGoFr publishes some {% new-tab-link newtab=false title=\"default metrics\" href=\"/docs/quick-"
},
{
"path": "docs/advanced-guide/rbac/page.md",
"chars": 16659,
"preview": "# Role-Based Access Control (RBAC) in GoFr\n\nRole-Based Access Control (RBAC) is a security mechanism that restricts acce"
},
{
"path": "docs/advanced-guide/remote-log-level-change/page.md",
"chars": 2037,
"preview": "# Remote Log Level Change\n\nGoFr makes it easy to adjust the details captured in the application's logs, even while it's "
},
{
"path": "docs/advanced-guide/serving-static-files/page.md",
"chars": 1775,
"preview": "# Serving Static Files using GoFr\n\nOften, we are required to serve static content such as a default profile image, a fav"
},
{
"path": "docs/advanced-guide/setting-custom-response-headers/page.md",
"chars": 2650,
"preview": "# Custom Response Headers and Metadata in GoFr\n\nGoFr simplifies the process of adding custom HTTP response headers and m"
},
{
"path": "docs/advanced-guide/startup-hooks/page.md",
"chars": 1832,
"preview": "# Startup Hooks\n\nGoFr provides a way to run synchronous jobs when your application starts, before any servers begin hand"
},
{
"path": "docs/advanced-guide/swagger-documentation/page.md",
"chars": 1587,
"preview": "# Rendering OpenAPI Documentation in GoFr\n\nGoFr supports automatic rendering of OpenAPI (also known as Swagger) document"
},
{
"path": "docs/advanced-guide/using-cron/page.md",
"chars": 3600,
"preview": "# Cron job scheduling\n\nCron is a task scheduler that allows user to automate commands or scripts to \nrun at specific tim"
},
{
"path": "docs/advanced-guide/using-publisher-subscriber/page.md",
"chars": 21233,
"preview": "# Publisher Subscriber\n\nPublisher Subscriber is an architectural design pattern for asynchronous communication between d"
},
{
"path": "docs/advanced-guide/websocket/page.md",
"chars": 5179,
"preview": "# Websockets\n\nWebSockets provide a full-duplex communication channel over a single, long-lived connection, making them i"
},
{
"path": "docs/datasources/arangodb/page.md",
"chars": 6618,
"preview": "# ArangoDB\n\n\n\n## Configuration\n\nTo connect to `ArangoDB`, you need to provide the following environment variables:\n- `HO"
},
{
"path": "docs/datasources/cassandra/page.md",
"chars": 3075,
"preview": "# Cassandra\nGoFr supports pluggable Cassandra drivers. \n\n## Configuration\nTo connect to `Cassandra`, you need to provide"
},
{
"path": "docs/datasources/clickhouse/page.md",
"chars": 2095,
"preview": "# ClickHouse\n\n## Configuration\nTo connect to `ClickHouse`, you need to provide the following environment variables and u"
},
{
"path": "docs/datasources/cockroachdb/page.md",
"chars": 1220,
"preview": "# CockroachDB\n\nGoFr provides support for CockroachDB, a cloud-native SQL database that is compatible with PostgreSQL.\n\n#"
},
{
"path": "docs/datasources/couchbase/page.md",
"chars": 3380,
"preview": "# Couchbase\n\n## Configuration\n\nTo connect to `Couchbase`, you need to provide the following environment variables and us"
},
{
"path": "docs/datasources/dgraph/page.md",
"chars": 3996,
"preview": "# Dgraph\n\n## Configuration\nTo connect to `Dgraph`, you need to provide the following environment variables and use it:\n-"
},
{
"path": "docs/datasources/elasticsearch/page.md",
"chars": 5088,
"preview": "# Elasticsearch\n\n## Configuration\nTo connect to `Elasticsearch`, you need to provide the following environment variables"
},
{
"path": "docs/datasources/getting-started/page.md",
"chars": 1785,
"preview": "# Getting Started\nGoFr adopts an interface-driven architecture for datasource integration, providing a consistent way to"
},
{
"path": "docs/datasources/influxdb/page.md",
"chars": 3228,
"preview": "# InfluxDB\nGoFr supports injecting InfluxDB using an interface that defines the necessary methods to interact with Influ"
},
{
"path": "docs/datasources/migrations/elasticsearch/page.md",
"chars": 12191,
"preview": "# Elasticsearch Migrations\n\nElasticsearch migrations in **GoFr** let you manage index schemas, mappings, settings and da"
},
{
"path": "docs/datasources/mongodb/page.md",
"chars": 2882,
"preview": "# MongoDB\n\n## Configuration\nTo connect to `MongoDB`, you need to provide the following environment variables:\n- `URI`: M"
},
{
"path": "docs/datasources/opentsdb/page.md",
"chars": 6970,
"preview": "# OpenTSDB\n\n\n## Configuration\nTo connect to `OpenTSDB`, you need to provide the following environment variables:\n- `HOST"
},
{
"path": "docs/datasources/oracle/page.md",
"chars": 5523,
"preview": "# OracleDB\n\n## Configuration\nTo connect to `OracleDB`, you need to provide the following environment variables:\n- `HOST`"
},
{
"path": "docs/datasources/scylladb/page.md",
"chars": 4291,
"preview": "# ScyllaDB\n\n## Configuration\nTo connect to `ScyllaDB`, you need to provide the following environment variables:\n- `HOST`"
},
{
"path": "docs/datasources/solr/page.md",
"chars": 2841,
"preview": "# Solr\n\n## Configuration\nTo connect to `Solr` DB, you need to provide the following environment variables:\n- `HOST`: The"
},
{
"path": "docs/datasources/surrealdb/page.md",
"chars": 4162,
"preview": "# SurrealDB\n\n## Configuration\nTo connect to `SurrealDB`, you need to provide the following environment variables:\n- `HOS"
},
{
"path": "docs/events.json",
"chars": 1664,
"preview": "[\n {\n \"date\": \"23-24th November, 2024\",\n \"title\": \"GoFr Hackathon\",\n \"description\": \"GoFr Hackat"
},
{
"path": "docs/navigation.js",
"chars": 14768,
"preview": "export const navigation = [\n {\n title: 'Quick Start Guide',\n desc: \"Get started with GoFR through our Q"
},
{
"path": "docs/page.md",
"chars": 1481,
"preview": "# Getting started\n\nGoFr is an opinionated web framework written in Go (Golang). It helps in building robust and scalable"
},
{
"path": "docs/quick-start/add-rest-handlers/page.md",
"chars": 6213,
"preview": "# Add REST Handlers\n\nGoFr simplifies the process of implementing CRUD (Create, Read, Update, Delete) operations by enabl"
},
{
"path": "docs/quick-start/cli/page.md",
"chars": 0,
"preview": ""
},
{
"path": "docs/quick-start/configuration/page.md",
"chars": 1907,
"preview": "# Configurations\n\nGoFr simplifies configuration management by reading configuration via environment variables.\nApplicati"
},
{
"path": "docs/quick-start/connecting-mysql/page.md",
"chars": 12010,
"preview": "# Connecting to MySQL\n\nJust like Redis, GoFr supports connection to various SQL-compatible databases (MySQL, MariaDB, Po"
},
{
"path": "docs/quick-start/connecting-redis/page.md",
"chars": 2676,
"preview": "# Connecting to Redis\n\nGoFr simplifies the process of connecting to Redis.\n\n## Setup:\n\nEnsure we have Redis installed on"
},
{
"path": "docs/quick-start/introduction/page.md",
"chars": 3314,
"preview": "# Prerequisite\n\n- Go 1.24 or above.\n To check the Go version, use the following command `go version`.\n\n- Prior familiar"
},
{
"path": "docs/quick-start/observability/page.md",
"chars": 13241,
"preview": "# Observability\n\nGoFr, by default, manages observability in different ways once the server starts:\n\n## Logs\nLogs offer r"
},
{
"path": "docs/references/configs/page.md",
"chars": 10676,
"preview": "# GoFr Configuration Options\n\nThis document lists all the configuration options supported by the GoFr framework. The con"
},
{
"path": "docs/references/context/page.md",
"chars": 4506,
"preview": "# GoFr Context\n\nGoFr context is an object injected by the GoFr handler. It contains all the request-specific data, for e"
},
{
"path": "docs/references/gofrcli/page.md",
"chars": 16040,
"preview": "# GoFR Command Line Interface\n\nManaging repetitive tasks and maintaining consistency across large-scale applications is "
},
{
"path": "docs/references/testing/page.md",
"chars": 14334,
"preview": "# Testing REST APIs with GoFr\n\nTesting REST APIs ensures that your endpoints function correctly under various conditions"
},
{
"path": "docs/testimonials.json",
"chars": 3516,
"preview": "[\n {\n \"quote\": \"Beyond the technical aspects, the GoFr community has been a highlight. The core team's responsivenes"
},
{
"path": "examples/grpc/grpc-streaming-client/README.md",
"chars": 665,
"preview": "# gRPC Streaming Client Example\n\nThis GoFr example demonstrates a simple gRPC streaming server that communicates with an"
},
{
"path": "examples/grpc/grpc-streaming-client/client/chat.pb.go",
"chars": 6883,
"preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.28.1\n// \tprotoc v5.29.3\n// sou"
},
{
"path": "examples/grpc/grpc-streaming-client/client/chat.proto",
"chars": 376,
"preview": "syntax = \"proto3\";\noption go_package = \"gofr.dev/examples/grpc/grpc-streaming-client/client\";\n\nmessage Request {\n strin"
},
{
"path": "examples/grpc/grpc-streaming-client/client/chat_grpc.pb.go",
"chars": 7992,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n// versions:\n// - protoc-gen-go-grpc v1.2.0\n// - protoc "
},
{
"path": "examples/grpc/grpc-streaming-client/client/chatservice_client.go",
"chars": 2794,
"preview": "// Code generated by gofr.dev/cli/gofr. DO NOT EDIT.\n// versions:\n// \tgofr-cli v0.7.0\n// \tgofr.dev v1.39.0\n// \tsource: c"
},
{
"path": "examples/grpc/grpc-streaming-client/client/health_client.go",
"chars": 3508,
"preview": "// Code generated by gofr.dev/cli/gofr. DO NOT EDIT.\n// versions:\n// \tgofr-cli v0.6.0\n// \tgofr.dev v1.37.0\n// \tsource: c"
},
{
"path": "examples/grpc/grpc-streaming-client/main.go",
"chars": 6908,
"preview": "package main\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"time\"\n\n\t\"gofr.dev/examples/grpc/grpc-streaming-client/client\"\n\t\"gofr.dev"
},
{
"path": "examples/grpc/grpc-streaming-server/README.md",
"chars": 422,
"preview": "# GRPC Server Example\n\nThis GoFr example showcases a basic gRPC streaming server implementation. For detailed instructio"
},
{
"path": "examples/grpc/grpc-streaming-server/main.go",
"chars": 232,
"preview": "package main\n\nimport (\n\t\"gofr.dev/examples/grpc/grpc-streaming-server/server\"\n\t\"gofr.dev/pkg/gofr\"\n)\n\nfunc main() {\n\tapp"
},
{
"path": "examples/grpc/grpc-streaming-server/main_test.go",
"chars": 11909,
"preview": "package main\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n\n\t\"google.golang.org/grpc\"\n"
},
{
"path": "examples/grpc/grpc-streaming-server/server/chat.pb.go",
"chars": 6877,
"preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.28.1\n// \tprotoc v5.29.3\n// sou"
},
{
"path": "examples/grpc/grpc-streaming-server/server/chat.proto",
"chars": 378,
"preview": "syntax = \"proto3\";\noption go_package = \"gofr.dev/examples/grpc/grpc-streaming-server/server\";\n\nmessage Request {\n strin"
},
{
"path": "examples/grpc/grpc-streaming-server/server/chat_grpc.pb.go",
"chars": 7992,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n// versions:\n// - protoc-gen-go-grpc v1.2.0\n// - protoc "
},
{
"path": "examples/grpc/grpc-streaming-server/server/chatservice_gofr.go",
"chars": 7725,
"preview": "// Code generated by gofr.dev/cli/gofr. DO NOT EDIT.\n// versions:\n// \tgofr-cli v0.7.0\n// \tgofr.dev v1.39.0\n// \tsource: c"
},
{
"path": "examples/grpc/grpc-streaming-server/server/chatservice_server.go",
"chars": 3071,
"preview": "// versions:\n// \tgofr-cli v0.6.0\n// \tgofr.dev v1.37.0\n// \tsource: chat.proto\n\npackage server\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"st"
},
{
"path": "examples/grpc/grpc-streaming-server/server/health_gofr.go",
"chars": 3673,
"preview": "// Code generated by gofr.dev/cli/gofr. DO NOT EDIT.\n// versions:\n// \tgofr-cli v0.7.0\n// \tgofr.dev v1.39.0\n// \tsource: c"
},
{
"path": "examples/grpc/grpc-streaming-server/server/request_gofr.go",
"chars": 1112,
"preview": "// Code generated by gofr.dev/cli/gofr. DO NOT EDIT.\n// versions:\n// \tgofr-cli v0.7.0\n// \tgofr.dev v1.39.0\n// \tsource: c"
},
{
"path": "examples/grpc/grpc-unary-client/README.md",
"chars": 645,
"preview": "# gRPC Unary Client Example\n\nThis GoFr example demonstrates a simple gRPC unary client that communicates with another gR"
},
{
"path": "examples/grpc/grpc-unary-client/client/health_client.go",
"chars": 3502,
"preview": "// Code generated by gofr.dev/cli/gofr. DO NOT EDIT.\n// versions:\n// \tgofr-cli v0.6.0\n// \tgofr.dev v1.37.0\n// \tsource: h"
},
{
"path": "examples/grpc/grpc-unary-client/client/health_test.go",
"chars": 5270,
"preview": "package client\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n\t\"goog"
},
{
"path": "examples/grpc/grpc-unary-client/client/hello.pb.go",
"chars": 6274,
"preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.28.1\n// \tprotoc v5.29.3\n// sou"
},
{
"path": "examples/grpc/grpc-unary-client/client/hello.proto",
"chars": 259,
"preview": "syntax = \"proto3\";\noption go_package = \"gofr.dev/examples/grpc/grpc-unary-client/client\";\n\nmessage HelloRequest {\n stri"
},
{
"path": "examples/grpc/grpc-unary-client/client/hello_client.go",
"chars": 1434,
"preview": "// Code generated by gofr.dev/cli/gofr. DO NOT EDIT.\n// versions:\n// \tgofr-cli v0.7.0\n// \tgofr.dev v1.39.0\n// \tsource: h"
},
{
"path": "examples/grpc/grpc-unary-client/client/hello_grpc.pb.go",
"chars": 3391,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n// versions:\n// - protoc-gen-go-grpc v1.2.0\n// - protoc "
},
{
"path": "examples/grpc/grpc-unary-client/client/hello_test.go",
"chars": 7055,
"preview": "package client\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/requ"
},
{
"path": "examples/grpc/grpc-unary-client/main.go",
"chars": 1431,
"preview": "package main\n\nimport (\n\t\"gofr.dev/examples/grpc/grpc-unary-client/client\"\n\t\"gofr.dev/pkg/gofr\"\n)\n\nfunc main() {\n\tapp := "
},
{
"path": "examples/grpc/grpc-unary-client/main_test.go",
"chars": 5591,
"preview": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\t\"net\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stre"
},
{
"path": "examples/grpc/grpc-unary-server/README.md",
"chars": 418,
"preview": "# GRPC Server Example\n\nThis GoFr example showcases a basic gRPC unary server implementation. For detailed instructions o"
},
{
"path": "examples/grpc/grpc-unary-server/main.go",
"chars": 216,
"preview": "package main\n\nimport (\n\t\"gofr.dev/examples/grpc/grpc-unary-server/server\"\n\t\"gofr.dev/pkg/gofr\"\n)\n\nfunc main() {\n\tapp := "
},
{
"path": "examples/grpc/grpc-unary-server/main_test.go",
"chars": 5691,
"preview": "package main\n\nimport (\n\t\"context\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/"
},
{
"path": "examples/grpc/grpc-unary-server/server/health_gofr.go",
"chars": 3674,
"preview": "// Code generated by gofr.dev/cli/gofr. DO NOT EDIT.\n// versions:\n// \tgofr-cli v0.7.0\n// \tgofr.dev v1.39.0\n// \tsource: h"
},
{
"path": "examples/grpc/grpc-unary-server/server/health_test.go",
"chars": 6104,
"preview": "package server\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/requ"
},
{
"path": "examples/grpc/grpc-unary-server/server/hello.pb.go",
"chars": 6274,
"preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.28.1\n// \tprotoc v5.29.3\n// sou"
},
{
"path": "examples/grpc/grpc-unary-server/server/hello.proto",
"chars": 253,
"preview": "syntax = \"proto3\";\noption go_package = \"gofr.dev/examples/grpc/grpc-server/server\";\n\nmessage HelloRequest {\n string nam"
},
{
"path": "examples/grpc/grpc-unary-server/server/hello_gofr.go",
"chars": 3134,
"preview": "// Code generated by gofr.dev/cli/gofr. DO NOT EDIT.\n// versions:\n// \tgofr-cli v0.7.0\n// \tgofr.dev v1.39.0\n// \tsource: h"
},
{
"path": "examples/grpc/grpc-unary-server/server/hello_grpc.pb.go",
"chars": 3391,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n// versions:\n// - protoc-gen-go-grpc v1.2.0\n// - protoc "
},
{
"path": "examples/grpc/grpc-unary-server/server/hello_server.go",
"chars": 1060,
"preview": "// versions:\n// \tgofr-cli v0.6.0\n// \tgofr.dev v1.37.0\n// \tsource: hello.proto\n\npackage server\n\nimport (\n\t\"fmt\"\n\n\t\"gofr.d"
},
{
"path": "examples/grpc/grpc-unary-server/server/hello_server_test.go",
"chars": 775,
"preview": "package server\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/requ"
},
{
"path": "examples/grpc/grpc-unary-server/server/hello_test.go",
"chars": 12251,
"preview": "package server\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testi"
},
{
"path": "examples/grpc/grpc-unary-server/server/request_gofr.go",
"chars": 1159,
"preview": "// Code generated by gofr.dev/cli/gofr. DO NOT EDIT.\n// versions:\n// \tgofr-cli v0.7.0\n// \tgofr.dev v1.39.0\n// \tsource: h"
},
{
"path": "examples/grpc/grpc-unary-server/server/request_test.go",
"chars": 3846,
"preview": "package server\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/requ"
},
{
"path": "examples/http-server/Dockerfile",
"chars": 577,
"preview": "# Build stage\nFROM golang:1.25-alpine AS build\nRUN apk add --no-cache build-base\n\nWORKDIR /src\n\n# Copy go.mod + go.sum f"
},
{
"path": "examples/http-server/README.md",
"chars": 1769,
"preview": "# HTTP Server Example\n\nThis GoFr example demonstrates a simple HTTP server which supports Redis and MySQL as datasources"
},
{
"path": "examples/http-server/docker/docker-compose.yaml",
"chars": 1359,
"preview": "version: '3.8'\n\nservices:\n gofr-http-server:\n build:\n context: ../../../ # project root (so go.mod an"
},
{
"path": "examples/http-server/docker/prometheus/prometheus.yml",
"chars": 420,
"preview": "global:\n scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.\n evaluatio"
},
{
"path": "examples/http-server/docker/provisioning/dashboards/dashboards.yaml",
"chars": 229,
"preview": "apiVersion: 1\n\nproviders:\n - name: 'Gofr Dashboard'\n orgId: 1\n folder: ''\n type: file\n disableDeletion: fal"
},
{
"path": "examples/http-server/docker/provisioning/dashboards/gofr-dashboard/dashboards.json",
"chars": 138512,
"preview": "{\n \"annotations\": {\n \"list\": [\n {\n \"builtIn\": 1,\n \"datasource\": {\n \"type\": \"datasource\","
},
{
"path": "examples/http-server/docker/provisioning/datasources/datasource.yaml",
"chars": 158,
"preview": "apiVersion: 1\n\ndatasources:\n - name: Prometheus\n type: prometheus\n access: proxy\n url: http://prometheus:9090\n"
},
{
"path": "examples/http-server/main.go",
"chars": 2211,
"preview": "package main\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/redis/go-redis/v9\"\n\n\t\"gofr."
},
{
"path": "examples/http-server/main_test.go",
"chars": 10878,
"preview": "package main\n\n// This test file demonstrates how to test handlers in GoFr.\n//\n// Key Concepts:\n// 1. GoFr wraps http.Req"
},
{
"path": "examples/http-server/static/openapi.json",
"chars": 3203,
"preview": "{\n \"openapi\": \"3.0.0\",\n \"info\": {\n \"title\": \"Http-Server API\",\n \"description\": \"Example Http-Server with multipl"
},
{
"path": "examples/http-server-using-redis/Dockerfile",
"chars": 307,
"preview": "FROM golang:1.24\n\nRUN mkdir /src/\nWORKDIR /src/\nCOPY . .\nRUN go get ./...\nRUN go build -ldflags \"-linkmode external -ext"
},
{
"path": "examples/http-server-using-redis/README.md",
"chars": 315,
"preview": "# Redis Example\n\nThis GoFr example demonstrates the use of Redis as datasource through a simple HTTP server.\n\n### To run"
},
{
"path": "examples/http-server-using-redis/main.go",
"chars": 2274,
"preview": "package main\n\nimport (\n\t\"time\"\n\n\t\"gofr.dev/pkg/gofr\"\n)\n\nconst redisExpiryTime = 5\n\nfunc main() {\n\t// Create a new applic"
},
{
"path": "examples/http-server-using-redis/main_test.go",
"chars": 3574,
"preview": "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/go-redis/redismock/"
},
{
"path": "examples/sample-cmd/README.md",
"chars": 149,
"preview": "# CMD Example\n\nThis GoFr example demonstrates a simple CMD application.\n\n### To run the example use the command below:\n`"
},
{
"path": "examples/sample-cmd/configs/.test.env",
"chars": 22,
"preview": "CMD_LOGS_FILE=logs.txt"
},
{
"path": "examples/sample-cmd/main.go",
"chars": 1591,
"preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"gofr.dev/pkg/gofr\"\n\t\"gofr.dev/pkg/gofr/cmd/terminal\"\n)\n\nfunc main() {\n\t// Creat"
},
{
"path": "examples/sample-cmd/main_test.go",
"chars": 4802,
"preview": "package main\n\nimport (\n\t\"context\"\n\t\"os\"\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\n\t\"gofr.dev/pkg/gof"
},
{
"path": "examples/using-add-filestore/README.md",
"chars": 1219,
"preview": "# Add FileStore Example\n\nThis GoFr example demonstrates a CMD application that can be used to interact with a remote fil"
},
{
"path": "examples/using-add-filestore/go.mod",
"chars": 5458,
"preview": "module gofr.dev/examples/using-add-filestore\n\ngo 1.25.0\n\nrequire (\n\tgithub.com/stretchr/testify v1.11.1\n\tgo.uber.org/moc"
},
{
"path": "examples/using-add-filestore/go.sum",
"chars": 39581,
"preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.121.6 h1:waZiu"
},
{
"path": "examples/using-add-filestore/main.go",
"chars": 2346,
"preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"gofr.dev/pkg/gofr\"\n\t\"gofr.dev/pkg/gofr/datasource/file\"\n\t\"gofr.de"
},
{
"path": "examples/using-add-filestore/main_test.go",
"chars": 4050,
"preview": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/st"
},
{
"path": "examples/using-add-rest-handlers/Dockerfile",
"chars": 307,
"preview": "FROM golang:1.24\n\nRUN mkdir /src/\nWORKDIR /src/\nCOPY . .\nRUN go get ./...\nRUN go build -ldflags \"-linkmode external -ext"
},
{
"path": "examples/using-add-rest-handlers/README.md",
"chars": 412,
"preview": "# AddRESTHandlers Example\n\nThis GoFr example demonstrates a simple HTTP server with CRUD operations which are created by"
},
{
"path": "examples/using-add-rest-handlers/main.go",
"chars": 714,
"preview": "package main\n\nimport (\n\t\"gofr.dev/examples/using-add-rest-handlers/migrations\"\n\t\"gofr.dev/pkg/gofr\"\n)\n\ntype user struct "
},
{
"path": "examples/using-add-rest-handlers/main_test.go",
"chars": 1418,
"preview": "package main\n\nimport (\n\t\"bytes\"\n\t\"net/http\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com"
},
{
"path": "examples/using-add-rest-handlers/migrations/1721816030_create_user_table.go",
"chars": 467,
"preview": "package migrations\n\nimport (\n\t\"gofr.dev/pkg/gofr/migration\"\n)\n\nconst createTable = `CREATE TABLE IF NOT EXISTS user (\n "
},
{
"path": "examples/using-add-rest-handlers/migrations/1721816030_create_user_table_test.go",
"chars": 1172,
"preview": "package migrations\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n\n\t\"github.com/DATA-DOG/go-sqlmock\"\n\t\"github.com/stretchr/testify/assert\"\n"
},
{
"path": "examples/using-add-rest-handlers/migrations/all.go",
"chars": 179,
"preview": "package migrations\n\nimport (\n\t\"gofr.dev/pkg/gofr/migration\"\n)\n\nfunc All() map[int64]migration.Migrate {\n\treturn map[int6"
},
{
"path": "examples/using-add-rest-handlers/migrations/all_test.go",
"chars": 392,
"preview": "package migrations\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\n\t\"gofr.dev/pkg/gofr/migration\"\n)\n\nfunc T"
},
{
"path": "examples/using-cron-jobs/Readme.md",
"chars": 1902,
"preview": "# Using Cron Jobs in GoFr\n\nThis example demonstrates how to schedule and run background jobs using the **GoFr** framewor"
},
{
"path": "examples/using-cron-jobs/main.go",
"chars": 319,
"preview": "package main\n\nimport (\n\t\"sync\"\n\n\t\"gofr.dev/pkg/gofr\"\n)\n\nvar (\n\tn = 0\n\tmu sync.RWMutex\n)\n\nconst duration = 3\n\nfunc main("
},
{
"path": "examples/using-cron-jobs/main_test.go",
"chars": 486,
"preview": "package main\n\nimport (\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n\n\t\"gofr.dev/pkg/gofr/testutil\"\n)\n"
},
{
"path": "examples/using-custom-metrics/Dockerfile",
"chars": 307,
"preview": "FROM golang:1.24\n\nRUN mkdir /src/\nWORKDIR /src/\nCOPY . .\nRUN go get ./...\nRUN go build -ldflags \"-linkmode external -ext"
},
{
"path": "examples/using-custom-metrics/README.md",
"chars": 294,
"preview": "# Custom Metrics Example\n\nThis GoFr example demonstrates the use of custom metrics through a simple HTTP server that cre"
},
{
"path": "examples/using-custom-metrics/main.go",
"chars": 1722,
"preview": "package main\n\nimport (\n\t\"time\"\n\n\t\"gofr.dev/pkg/gofr\"\n)\n\n// This example simulates the usage of custom metrics for transa"
},
{
"path": "examples/using-custom-metrics/main_test.go",
"chars": 1854,
"preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n\n\t\"gofr."
},
{
"path": "examples/using-file-bind/Dockerfile",
"chars": 307,
"preview": "FROM golang:1.24\n\nRUN mkdir /src/\nWORKDIR /src/\nCOPY . .\nRUN go get ./...\nRUN go build -ldflags \"-linkmode external -ext"
},
{
"path": "examples/using-file-bind/README.md",
"chars": 695,
"preview": "# Using File Bind Example\n\nThis GoFr example demonstrates the use of context Bind where incoming request has multipart-f"
},
{
"path": "examples/using-file-bind/main.go",
"chars": 1469,
"preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"mime/multipart\"\n\t\"os\"\n\n\t\"gofr.dev/pkg/gofr\"\n\t\"gofr.dev/pkg/gofr/file\"\n)\n\nfunc main"
},
{
"path": "examples/using-file-bind/main_test.go",
"chars": 1978,
"preview": "package main\n\nimport (\n\t\"bytes\"\n\t\"io\"\n\t\"mime/multipart\"\n\t\"net/http\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/test"
},
{
"path": "examples/using-graphql/configs/schema.graphqls",
"chars": 189,
"preview": "type User {\n id: Int\n name: String\n role: String\n}\n\ntype Query {\n hello: String\n getUser(id: Int): User\n}"
},
{
"path": "examples/using-graphql/main.go",
"chars": 2093,
"preview": "package main\n\nimport (\n\t\"gofr.dev/examples/using-graphql/migrations\"\n\t\"gofr.dev/pkg/gofr\"\n)\n\n// User is the domain type "
},
{
"path": "examples/using-graphql/main_test.go",
"chars": 4014,
"preview": "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.c"
},
{
"path": "examples/using-graphql/migrations/20240205125300_create_users_table.go",
"chars": 335,
"preview": "package migrations\n\nimport (\n\t\"gofr.dev/pkg/gofr/migration\"\n)\n\nfunc CreateUsersTable() migration.Migrate {\n\treturn migra"
},
{
"path": "examples/using-graphql/migrations/all.go",
"chars": 184,
"preview": "package migrations\n\nimport (\n\t\"gofr.dev/pkg/gofr/migration\"\n)\n\nfunc All() map[int64]migration.Migrate {\n\treturn map[int6"
},
{
"path": "examples/using-html-template/README.md",
"chars": 853,
"preview": "# Using HTML Template\n\nThis GoFr example demonstrates the use of html template, GoFr supports both static and dynamic ht"
},
{
"path": "examples/using-html-template/main.go",
"chars": 679,
"preview": "package main\n\nimport (\n\t\"gofr.dev/pkg/gofr\"\n\t\"gofr.dev/pkg/gofr/http/response\"\n)\n\nfunc main() {\n\tapp := gofr.New()\n\tapp."
},
{
"path": "examples/using-html-template/main_test.go",
"chars": 3305,
"preview": "package main\n\nimport (\n\t\"context\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/a"
},
{
"path": "examples/using-html-template/static/404.html",
"chars": 437,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width"
},
{
"path": "examples/using-html-template/static/index.html",
"chars": 296,
"preview": "<html>\n<head>\n <link rel=\"stylesheet\" href=\"style.css\">\n</head>\n<body>\n<div id=\"content\">\n <img src=\"/favicon.ico\""
},
{
"path": "examples/using-html-template/static/style.css",
"chars": 678,
"preview": "body,html {\n margin: 0;\n padding: 0;\n background: oklch(0.208 0.042 265.755);\n color: oklch(0.869 0.022 252."
},
{
"path": "examples/using-html-template/templates/todo.html",
"chars": 289,
"preview": "<html>\n<head>\n <link rel=\"stylesheet\" href=\"style.css\">\n</head>\n<body>\n<div id=\"content\">\n\n<h2>{{.PageTitle}}</h2>\n<u"
},
{
"path": "examples/using-http-auth-middleware/ReadMe.md",
"chars": 2163,
"preview": "# HTTP Auth Middleware\n\nThis GoFr example demonstrates the usage of auth middlewares in Gofr. Gofr supports the followin"
},
{
"path": "examples/using-http-auth-middleware/main.go",
"chars": 1273,
"preview": "package main\n\nimport (\n\t\"gofr.dev/pkg/gofr\"\n\t\"gofr.dev/pkg/gofr/container\"\n)\n\nfunc main() {\n\ta := gofr.New()\n\n\t//For Bas"
},
{
"path": "examples/using-http-auth-middleware/main_test.go",
"chars": 3726,
"preview": "package main\n\nimport (\n\t\"github.com/stretchr/testify/assert\"\n\t\"gofr.dev/pkg/gofr/testutil\"\n\t\"net/http\"\n\t\"testing\"\n\t\"time"
},
{
"path": "examples/using-http-service/Dockerfile",
"chars": 307,
"preview": "FROM golang:1.24\n\nRUN mkdir /src/\nWORKDIR /src/\nCOPY . .\nRUN go get ./...\nRUN go build -ldflags \"-linkmode external -ext"
},
{
"path": "examples/using-http-service/main.go",
"chars": 1538,
"preview": "package main\n\nimport (\n\t\"encoding/json\"\n\t\"io\"\n\t\"time\"\n\n\t\"gofr.dev/pkg/gofr\"\n\t\"gofr.dev/pkg/gofr/service\"\n)\n\nfunc main() "
},
{
"path": "examples/using-http-service/main_test.go",
"chars": 3433,
"preview": "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"git"
},
{
"path": "examples/using-http-service/readme.md",
"chars": 499,
"preview": "# Http-Service Example\n\nThis GoFr example demonstrates an inter-service HTTP communication along with circuit-breaker as"
},
{
"path": "examples/using-migrations/Dockerfile",
"chars": 307,
"preview": "FROM golang:1.24\n\nRUN mkdir /src/\nWORKDIR /src/\nCOPY . .\nRUN go get ./...\nRUN go build -ldflags \"-linkmode external -ext"
},
{
"path": "examples/using-migrations/go.sum",
"chars": 39662,
"preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.118.1 h1:b8RAT"
},
{
"path": "examples/using-migrations/main.go",
"chars": 1747,
"preview": "package main\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\n\t\"gofr.dev/examples/using-migrations/migrations\"\n\t\"gofr.dev/pkg/gofr\"\n)\n\nconst "
},
{
"path": "examples/using-migrations/main_test.go",
"chars": 1696,
"preview": "package main\n\nimport (\n\t\"bytes\"\n\t\"net/http\"\n\t\"os\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com"
},
{
"path": "examples/using-migrations/migrations/1722507126_create_employee_table.go",
"chars": 840,
"preview": "package migrations\n\nimport (\n\t\"gofr.dev/pkg/gofr/migration\"\n)\n\nconst createTable = `CREATE TABLE IF NOT EXISTS employee\n"
},
{
"path": "examples/using-migrations/migrations/1722507126_create_employee_table_test.go",
"chars": 2179,
"preview": "package migrations\n\nimport (\n\t\"fmt\"\n\t\"testing\"\n\n\t\"github.com/DATA-DOG/go-sqlmock\"\n\t\"github.com/stretchr/testify/assert\"\n"
},
{
"path": "examples/using-migrations/migrations/1722507180_redis_add_employee_name.go",
"chars": 332,
"preview": "package migrations\n\nimport (\n\t\"context\"\n\n\t\"gofr.dev/pkg/gofr/migration\"\n)\n\nfunc addEmployeeInRedis() migration.Migrate {"
},
{
"path": "examples/using-migrations/migrations/1722507180_redis_add_employee_name_test.go",
"chars": 946,
"preview": "package migrations\n\nimport (\n\t\"errors\"\n\t\"testing\"\n\n\t\"github.com/go-redis/redismock/v9\"\n\t\"github.com/stretchr/testify/req"
},
{
"path": "examples/using-migrations/migrations/all.go",
"chars": 219,
"preview": "package migrations\n\nimport (\n\t\"gofr.dev/pkg/gofr/migration\"\n)\n\nfunc All() map[int64]migration.Migrate {\n\treturn map[int6"
},
{
"path": "examples/using-migrations/migrations/all_test.go",
"chars": 432,
"preview": "package migrations\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\n\t\"gofr.dev/pkg/gofr/migration\"\n)\n\nfunc T"
},
{
"path": "examples/using-migrations/readme.md",
"chars": 1116,
"preview": "# Migrations Example\n\nThis GoFr example demonstrates the use of `migrations` through a simple HTTP server using MySQL, R"
},
{
"path": "examples/using-publisher/Dockerfile",
"chars": 307,
"preview": "FROM golang:1.24\n\nRUN mkdir /src/\nWORKDIR /src/\nCOPY . .\nRUN go get ./...\nRUN go build -ldflags \"-linkmode external -ext"
},
{
"path": "examples/using-publisher/main.go",
"chars": 1042,
"preview": "package main\n\nimport (\n\t\"encoding/json\"\n\n\t\"gofr.dev/examples/using-publisher/migrations\"\n\t\"gofr.dev/pkg/gofr\"\n)\n\nfunc ma"
},
{
"path": "examples/using-publisher/main_test.go",
"chars": 4607,
"preview": "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"gofr.dev/pkg/gofr/testutil\"\n\t\"net/http\"\n\t\"net/http/"
},
{
"path": "examples/using-publisher/migrations/1721801313_create_topics.go",
"chars": 367,
"preview": "package migrations\n\nimport (\n\t\"context\"\n\n\t\"gofr.dev/pkg/gofr/migration\"\n)\n\nfunc createTopics() migration.Migrate {\n\tretu"
}
]
// ... and 658 more files (download for full content)
About this extraction
This page contains the full source code of the gofr-dev/gofr GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 858 files (7.6 MB), approximately 2.0M tokens, and a symbol index with 15011 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.