Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.7.0 #651

Merged
merged 205 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
4828338
Bump google.golang.org/api from 0.170.0 to 0.171.0 (#405)
dependabot[bot] Mar 26, 2024
e2cd266
add Access Control Allow Headers to CORS middleware. (#407)
Umang01-hash Mar 27, 2024
1948546
Remove double spaces from SQL logs and make error logs uniform (#404)
vipul-rawat Mar 27, 2024
18fc298
convert microseconds to milliseconds in logs
Umang01-hash Apr 1, 2024
baf9ce7
Create pull_request_template.md
Umang01-hash Apr 1, 2024
afb6627
Rename pull_request_template.md to .github/pull_request_template.md
Umang01-hash Apr 1, 2024
e0da003
Merge pull request #410 from gofr-dev/improve-logs
aryanmehrotra Apr 1, 2024
3079619
Merge branch 'development' into PR-template
aryanmehrotra Apr 1, 2024
a3aae1c
Merge pull request #411 from gofr-dev/PR-template
aryanmehrotra Apr 1, 2024
3738f8a
add env support for diff environments. (#403)
Umang01-hash Apr 1, 2024
1bc6612
Bump google.golang.org/api from 0.171.0 to 0.172.0 (#414)
dependabot[bot] Apr 2, 2024
82f1b56
Bump github.com/go-sql-driver/mysql from 1.8.0 to 1.8.1 (#413)
dependabot[bot] Apr 2, 2024
4614fcb
remove error for .local.env
rokerzfirst101 Apr 3, 2024
dfeef55
refactor if statement
rokerzfirst101 Apr 4, 2024
d1c7f7b
Merge pull request #419 from rokerzfirst101/development
vikash Apr 4, 2024
3d39b22
Update README.md
vikash Apr 4, 2024
7b8c028
change datasources as interface in container (#426)
srijan-27 Apr 5, 2024
0f856cc
have a len check instead of len check for subscriptions (#436)
vipul-rawat Apr 5, 2024
9bc92e7
add README.md for using-file-bind example (#439)
vipul-rawat Apr 5, 2024
16c8dc8
Fix/documentation (#438)
Umang01-hash Apr 5, 2024
9bb6319
[EN] Refactor Migrations (#412)
srijan-27 Apr 5, 2024
7784379
Externalize mongo (#435)
vipul-rawat Apr 5, 2024
d41ee71
Remove mock_datasource from test coverage (#441)
aryanmehrotra Apr 5, 2024
599bb69
Add CRUD from struct (#406)
srijan-27 Apr 6, 2024
4551dc7
add and fix missing DockerFiles for examples (#453)
vipul-rawat Apr 10, 2024
c59a2df
Fix status code for response of Post and Delete requests (#452)
ssshekhu53 Apr 10, 2024
59fea84
fix file name for REST handlers doc (#455)
vipul-rawat Apr 10, 2024
ee43d34
En/add jaeger exporter (#454)
Umang01-hash Apr 10, 2024
b5ca461
Fixed typos and spelling mistakes in multiple docs
SuyeshBadge Apr 14, 2024
a96df19
change keyword basic to Basic while checking auth header (#464)
Umang01-hash Apr 16, 2024
70f75c4
Bump google.golang.org/grpc from 1.63.0 to 1.63.2 (#466)
dependabot[bot] Apr 16, 2024
7ddadb8
Bump golang.org/x/oauth2 from 0.18.0 to 0.19.0 (#468)
dependabot[bot] Apr 16, 2024
be8da72
Merge branch 'development' into spell-fixes
vikash Apr 16, 2024
1faec42
Remove auth for /.well-known routes (#476)
srijan-27 Apr 16, 2024
0d108ac
Refactor prettyprint (#480)
vipul-rawat Apr 16, 2024
2a42a40
En/add tracing for sql (#462)
Umang01-hash Apr 16, 2024
e284494
Add code-climate yaml file (#478)
srijan-27 Apr 17, 2024
25b573d
fix buckets for redis & sql metrics (#485)
srijan-27 Apr 17, 2024
70520f5
revert updation of complexity threshold (#487)
srijan-27 Apr 17, 2024
b4882c5
add security policy (#486)
aryanmehrotra Apr 17, 2024
bfc5be2
fix formatting of pubsub initialize/connect logs
vipul-rawat Apr 17, 2024
a5bb273
add pubsub structured logging and pretty print
vipul-rawat Apr 17, 2024
1f54940
log google publish and subscribe using structured log
vipul-rawat Apr 17, 2024
797f253
remove unused logger parameter from mqtt
vipul-rawat Apr 17, 2024
4fd839f
Merge branch 'development' into spell-fixes
vikash Apr 18, 2024
d573837
Merge pull request #460 from SuyeshBadge/spell-fixes
vikash Apr 18, 2024
0200f16
Fix/env override (#491)
Umang01-hash Apr 18, 2024
cef7727
Add support for labels in gauge metrics (#490)
srijan-27 Apr 18, 2024
1bd92fe
refactor initTracer method to integrate with Gofr tracer (#481)
Umang01-hash Apr 19, 2024
3b5df29
Add app_info metric (#513)
srijan-27 Apr 19, 2024
42812a9
Refactor SQL Mock and add test (#514)
aryanmehrotra Apr 19, 2024
3c7f849
Update website deployment workflow (#517)
aryanmehrotra Apr 20, 2024
fe1a345
Bump google.golang.org/api from 0.172.0 to 0.176.0
dependabot[bot] Apr 22, 2024
cf40f1e
Merge pull request #521 from gofr-dev/dependabot/go_modules/google.go…
vikash Apr 23, 2024
fd7d3ca
Move mock config from testutil to configs directory (#527)
aryanmehrotra Apr 23, 2024
893346a
Add panic recovery for subscription and migrations to prevent server …
aryanmehrotra Apr 26, 2024
356a6c0
Add SQL connection Retry (#530)
aryanmehrotra Apr 26, 2024
75f73b9
Fix migration fail to create entry in gofr_migrations (#532)
aryanmehrotra Apr 27, 2024
bd8ba4d
Add tests for GRPC logs (#533)
aryanmehrotra Apr 27, 2024
61c3cd1
Overriding default docs page.
illenko Apr 28, 2024
420fc26
Overriding default docs page.
illenko Apr 29, 2024
3d06958
Merge branch 'development' into en/overriding-default-doc
illenko Apr 29, 2024
a5bed25
Id field naming change.
illenko Apr 29, 2024
a4fe287
Merge remote-tracking branch 'origin/en/overriding-default-doc' into …
illenko Apr 29, 2024
cb6995c
fix pretty print and standardize spacing for all logs
vipul-rawat Apr 29, 2024
3505df4
Merge branch 'development' of github.com:gofr-dev/gofr into fix-pubsu…
vipul-rawat Apr 29, 2024
9bc9302
fix tracer names and remove constants
vipul-rawat Apr 29, 2024
bbb13a3
Merge pull request #539 from gofr-dev/fix-pubsub-logs
vikash Apr 29, 2024
62248d0
Merge branch 'development' into en/overriding-default-doc
aryanmehrotra Apr 30, 2024
9e1b0a5
Merge pull request #536 from illenko/en/overriding-default-doc
vikash Apr 30, 2024
12afdc1
Fix PostgreSQL support in AddRESTHandlers. (#549)
illenko May 2, 2024
3ceed5e
Add google form (#553)
aryanmehrotra May 2, 2024
1483dbc
add discord join badge (#555)
vipul-rawat May 2, 2024
315e5fd
Fix configurations path
00harald May 2, 2024
1777deb
Increase Migration test coverage (#557)
aryanmehrotra May 2, 2024
99d567d
Add support for custom middleware (#554)
Umang01-hash May 2, 2024
e5f2704
Merge branch 'development' into patch-fix_configurations_path
aryanmehrotra May 2, 2024
f82c2bd
update linter version to v1.57.2
surajitpore0 May 2, 2024
6d4a721
update linter version to v1.57.2
surajitpore0 May 2, 2024
5b92f51
Merge branch 'development' of github.com:surajitpore0/gofr into en-li…
surajitpore0 May 2, 2024
12fbda0
fix linter
surajitpore0 May 2, 2024
a759ca0
add middlware test (#561)
aryanmehrotra May 2, 2024
fda4231
Merge branch 'development' into patch-fix_configurations_path
Umang01-hash May 3, 2024
b554403
Merge branch 'development' into en-linter-version-update
aryanmehrotra May 3, 2024
0ae8e25
fix linter
surajitpore0 May 3, 2024
82a536f
remove name return where we are using _
surajitpore0 May 3, 2024
f3ee953
Merge pull request #560 from surajitpore0/en-linter-version-update
aryanmehrotra May 3, 2024
0c1e435
Merge branch 'development' into patch-fix_configurations_path
00harald May 3, 2024
71865ca
Merge pull request #556 from 00harald/patch-fix_configurations_path
vikash May 3, 2024
58a4e23
SQL Keywords support in CRUD handlers.
illenko May 3, 2024
fe9c590
Merge branch 'refs/heads/development' into feature/sql-keywords-support
illenko May 3, 2024
4073949
SQL Keywords support in CRUD handlers (tests).
illenko May 4, 2024
223a1c8
Update CONTRIBUTING with Documentation
GuyKh May 5, 2024
8b72ffb
SQL Keywords support in CRUD handlers (Review fixes).
illenko May 6, 2024
cf19755
SQL Keywords support in CRUD handlers (Review fixes).
illenko May 6, 2024
49b5f52
change trigger for website.yaml (#559)
Umang01-hash May 6, 2024
43e37d6
Merge branch 'development' into feature/sql-keywords-support
Umang01-hash May 6, 2024
a9445f2
Add readme for datasource (#565)
aryanmehrotra May 6, 2024
bcb0564
Merge branch 'development' into feature/sql-keywords-support
illenko May 6, 2024
dddf147
Add support for custom favicon.ico (#571)
Umang01-hash May 6, 2024
8078ab4
Database tables and columns naming in snake-case.
illenko May 6, 2024
d2cbd24
Merge branch 'development' into feature/sql-keywords-support
illenko May 6, 2024
de5105e
Fix typos
AchimGrolimund May 6, 2024
063797e
update code semantics
AchimGrolimund May 6, 2024
5951804
test workflow with new image (#580)
Umang01-hash May 7, 2024
a65f813
Merge branch 'development' into feature/sql-keywords-support
vipul-rawat May 7, 2024
f7815ef
Code style.
illenko May 7, 2024
41f77e8
make CONSUMER_ID optional when publishing (#581)
Umang01-hash May 7, 2024
a3602da
DB table fix.
illenko May 7, 2024
bc5ff2a
Merge branch 'development' into feature/sql-keywords-support
illenko May 7, 2024
3dd50bd
Replace `‘` with `\``
AchimGrolimund May 7, 2024
ffef36a
remove comment
AchimGrolimund May 7, 2024
d518826
Merge branch 'development' into development
AchimGrolimund May 7, 2024
b00ef4f
found missing replaces for `\``
AchimGrolimund May 7, 2024
332c838
Merge pull request #566 from illenko/feature/sql-keywords-support
aryanmehrotra May 8, 2024
0337fc8
Update Documentation contribution
GuyKh May 8, 2024
5ea38db
Merge branch 'development' into Contribute-Documentation
GuyKh May 8, 2024
66cfbc9
Code review
GuyKh May 8, 2024
ef53748
move mock logger from testutil to logger
srijan-27 May 8, 2024
af589fa
add notes for future reference
srijan-27 May 8, 2024
0f20461
Merge pull request #567 from GuyKh/Contribute-Documentation
vikash May 8, 2024
0598b7a
Merge branch 'development' into development
vikash May 8, 2024
e86dba7
replace `\`` with `'` for the right wording
AchimGrolimund May 8, 2024
78eda13
refactor logging package
srijan-27 May 9, 2024
d152870
add context to subscribed message for Kafka (#585)
aryanmehrotra May 9, 2024
ab53462
Merge branch 'development' into development
AchimGrolimund May 9, 2024
7192c1c
Merge pull request #573 from AchimGrolimund/development
vikash May 9, 2024
34aecc5
implement swagger endpoint
Umang01-hash May 10, 2024
2e03d87
refactor code and add comments
Umang01-hash May 10, 2024
37eecfb
Merge branch 'development' into fix/mock-logger
srijan-27 May 10, 2024
a67b8d1
add swagger handler tests
Umang01-hash May 10, 2024
58e1738
add more tests for swagger handlers
Umang01-hash May 10, 2024
b68dd1f
add swagger file for http-server example
Umang01-hash May 10, 2024
afe7ee0
fix tests
Umang01-hash May 10, 2024
b700c07
correct file name
Umang01-hash May 10, 2024
eb16754
add issue template for bug, feature and questiosn (#593)
aryanmehrotra May 10, 2024
f3c4737
change directory from api to static for rendering swagger files
Umang01-hash May 10, 2024
97d73cb
fix typos
Umang01-hash May 10, 2024
01b7250
rename NewRemoteLogger to New
srijan-27 May 10, 2024
bfb324b
add docs
Umang01-hash May 10, 2024
1957247
Delete pkg/gofr/pkg/gofr/api/openapi.json
Umang01-hash May 10, 2024
5944fca
remove unwanted file
Umang01-hash May 10, 2024
51eb37e
Merge branch 'development' of github.com:gofr-dev/gofr into en/swagge…
Umang01-hash May 10, 2024
6dec7c3
Merge branch 'en/swagger_endpoint' of github.com:gofr-dev/gofr into e…
Umang01-hash May 10, 2024
45d56d8
remove css mapping file
Umang01-hash May 10, 2024
91f1567
Update page.md
srijan-27 May 10, 2024
d28b12f
Merge branch 'development' into fix/mock-logger
aryanmehrotra May 10, 2024
ce8f21e
Add cron job scheduling (#592)
vipul-rawat May 10, 2024
ceb878b
Merge branch 'development' into fix/mock-logger
srijan-27 May 10, 2024
c4c86f6
Merge branch 'development' into en/swagger_endpoint
srijan-27 May 10, 2024
91d7eeb
Merge pull request #594 from gofr-dev/en/swagger_endpoint
vikash May 10, 2024
0010335
Merge branch 'development' into fix/mock-logger
vikash May 10, 2024
4918573
Merge pull request #582 from gofr-dev/fix/mock-logger
vikash May 10, 2024
335f153
update go.sum
srijan-27 May 10, 2024
7be2fdb
Merge pull request #595 from gofr-dev/fix/go.sum
aryanmehrotra May 10, 2024
86a90ff
add patch route registration
vipul-rawat May 13, 2024
1d24459
add godoc for PATCH, and lint fixes
vipul-rawat May 13, 2024
e7219b5
fix cron documentation path
vipul-rawat May 13, 2024
d06c303
Merge pull request #598 from gofr-dev/add-Patch-route
aryanmehrotra May 13, 2024
5c8827a
Merge branch 'development' into fix-cron-docs
aryanmehrotra May 13, 2024
d692032
fix undefined code block
vipul-rawat May 13, 2024
a986825
Merge branch 'fix-cron-docs' of github.com:gofr-dev/gofr into fix-cro…
vipul-rawat May 13, 2024
df4e06b
Merge pull request #599 from gofr-dev/fix-cron-docs
vikash May 13, 2024
e859c14
add PATCH method to cors Allow methods (#602)
vipul-rawat May 13, 2024
b13b73e
Bump golang.org/x/term from 0.19.0 to 0.20.0 (#608)
dependabot[bot] May 14, 2024
eff4d88
Bump github.com/prometheus/client_golang from 1.19.0 to 1.19.1 (#610)
dependabot[bot] May 14, 2024
a823bd4
Bump google.golang.org/protobuf from 1.33.0 to 1.34.1 (#609)
dependabot[bot] May 14, 2024
c26543b
Bump cloud.google.com/go/pubsub from 1.37.0 to 1.38.0 (#607)
dependabot[bot] May 14, 2024
50c8138
update setXApiKey function to return updated headers (#612)
srijan-27 May 14, 2024
fd81747
fixed log formatting for service call logs (#615)
srijan-27 May 14, 2024
386dc11
updated readme file for exmaples/using-migrations to run kafka
aditya028 May 15, 2024
d87c0f6
Merge pull request #622 from aditya028/ref/examples/using-migrations/…
aryanmehrotra May 15, 2024
2eae63f
Fix Kafka log (#618)
srijan-27 May 15, 2024
4af1b05
Add mongo DB with observability (#616)
aryanmehrotra May 15, 2024
6371fda
add jeager exporter documentation
Umang01-hash May 16, 2024
0756817
update tracer documentation in docs
Umang01-hash May 16, 2024
9b4657d
Merge pull request #626 from gofr-dev/en/jaeger_documentation
vikash May 16, 2024
c9840db
add check for internal server to do error log (#625)
vipul-rawat May 17, 2024
5724275
[EN] Datasource Metrics (#630)
srijan-27 May 17, 2024
3df8fd6
Improved datasource logs (#632)
srijan-27 May 17, 2024
022a49c
EN/Custom Header for HTTP Client (#611)
PiyushSingh-ZS May 17, 2024
a2cec6c
made unccessary exported struct unexported (#635)
srijan-27 May 20, 2024
025e1aa
add configs documentation
Umang01-hash May 20, 2024
d9214ad
add timeout for http requests(#628)
Umang01-hash May 20, 2024
0bdc160
Merge branch 'development' into en/add_configs_documentation
vipul-rawat May 20, 2024
2af3855
---
dependabot[bot] May 20, 2024
8d964b6
Merge pull request #640 from gofr-dev/dependabot/go_modules/google.go…
vikash May 21, 2024
76668aa
Merge branch 'development' into en/add_configs_documentation
vikash May 21, 2024
3e9ab62
--- (#642)
dependabot[bot] May 21, 2024
471ebee
fix typos (#639)
ccoVeille May 21, 2024
cbddfca
Merge branch 'development' of github.com:gofr-dev/gofr into en/add_co…
Umang01-hash May 21, 2024
9d40a37
minor refactorations
Umang01-hash May 21, 2024
04c8672
fix typo
Umang01-hash May 21, 2024
64b4e9f
Add mongo provider interface for injecting mongo drivers (#627)
aryanmehrotra May 21, 2024
5a6f376
Merge branch 'development' into en/add_configs_documentation
vipul-rawat May 21, 2024
d7a19b8
Merge pull request #638 from gofr-dev/en/add_configs_documentation
vikash May 21, 2024
4601bb6
change table format
Umang01-hash May 22, 2024
1f54bd1
Feature: Kafka Producer Batch Confguration. (#631)
illenko May 22, 2024
0d5e8cc
Merge branch 'development' into en/reafctor_config_documentation
vikash May 22, 2024
faf286c
Merge pull request #644 from gofr-dev/en/reafctor_config_documentation
vikash May 22, 2024
041c8d7
make use mongo deprecated (#649)
aryanmehrotra May 27, 2024
2331407
Add SQLite support (#646)
rokerzfirst101 May 27, 2024
2288337
errors package for custom and predefined errors (#604)
Umang01-hash May 27, 2024
bfff847
update version to v1.7.0
aryanmehrotra May 27, 2024
581dc9d
Merge branch 'main' of ssh://github.com/gofr-dev/gofr into release/v1…
aryanmehrotra May 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
## Contribution Guidelines
* Minor changes can be done directly by editing code on github. Github automatically creates a temporary branch and
* 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, following steps are recommended.
* (Optional) If you want to discuss your implementation with the users of Gofr, use the github discussions of this repo.
* (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 goimport and golangci-lint on file changes. Any code which is not formatted using these
tools, will fail on the pipeline.
* All code contributions should have associated tests and all new line additions should be covered in those testcases.
No PR should ever decrease the overall code coverage.
* Once your code changes are done along with the testcases, submit a PR to development branch. Please note that all PRs
are merged from feature branches to development first.
* All PRs need to be reviewed by at least 2 Gofr developers. They might reach out to you for any clarfication.
* 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:
Expand Down Expand Up @@ -87,7 +87,7 @@ Please note that the recommended local port for the services are different than
* 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 its
- 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.
Expand All @@ -113,4 +113,4 @@ Please note that the recommended local port for the services are different than
- 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]([url](https://gofr.dev/docs)) site is updated upon push to `/docs` path in the repo. Verify your changes are live after next gofr version.
* The [gofr.dev documentation]([url](https://gofr.dev/docs)) site is updated upon push to `/docs` path in the repo. Verify your changes are live after next GoFr version.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

<br>

Gofr is an opinionated microservice development framework. Listed in [CNCF Landscape](https://landscape.cncf.io/?selected=go-fr).
GoFr is an opinionated microservice development framework. Listed in [CNCF Landscape](https://landscape.cncf.io/?selected=go-fr).

Visit <a href="https://gofr.dev"/>https://gofr.dev</a> for more details and documentation.

## 🎯 Goal
Even though generic applications can be written using Gofr, our main focus is to simplify the development of microservices.
We will focus ourselves towards deployment in kubernetes and aspire to provide out-of-the-box observability.
Even though generic applications can be written using GoFr, our main focus is to simplify the development of microservices.
We will focus ourselves towards deployment in Kubernetes and aspire to provide out-of-the-box observability.

## 💡 Advantages/Features

Expand Down
16 changes: 12 additions & 4 deletions docs/advanced-guide/dealing-with-datasources/page.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Dealing with SQL

GoFr simplifies the process of connecting to SQL databases where one needs to add respective configs in .env,
which allows to connect to different SQL dialects(MYSQL, PostgreSQL) without going into complexity of configuring connections.
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.
For instance, to connect with PostgreSQL, set `DB_DIALECT` to `postgres`. Similarly, To connect with MySQL, simply set `DB_DIALECT` to `mysql`.

## Usage
Add the following configs in .env file.
## 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
Expand All @@ -17,4 +16,13 @@ DB_NAME=test_db
DB_PORT=3306

DB_DIALECT=postgres
```

## Usage for SQLite
To connect with PostgreSQL, 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
```
56 changes: 56 additions & 0 deletions docs/advanced-guide/gofr-errors/page.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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:

- `ErrorInvalidParam`: Represents an error due to an invalid parameter.
- `ErrorMissingParam`: Represents an error due to a missing parameter.
- `ErrorEntityNotFound`: Represents an error due to a not found entity.

#### Usage:
To use the predefined http errors,users can simply call them using GoFr's http package:
```go
err := http.ErrorMissingParam{Param: []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.

#### Usage:
```go
// 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.

#### 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
}
```
12 changes: 6 additions & 6 deletions docs/advanced-guide/grpc/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ framework initially developed by Google.
$ apt install -y protobuf-compiler
$ protoc --version # Ensure compiler version is 3+
```
- MacOS, using homebrew
- macOS, using Homebrew
```shell
$ brew install protobuf
$ protoc --version # Ensure compiler version is 3+
```
- Install **Go Plugins** for protocol compiler:
1. Install prtocol compiler plugins for Go
1. Install protocol compiler plugins for Go
```shell
$ 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
Expand All @@ -30,7 +30,7 @@ framework initially developed by Google.
## Creating protocol buffers
For a detailed guide, please take a look at the {% new-tab-link title="Tutorial" href="https://grpc.io/docs/languages/go/basics/" /%} at official gRPC docs.

We need to create a `customer.proto` file to define our service and the rpc methods that the service provides.
We need to create a `customer.proto` file to define our service and the RPC methods that the service provides.
```protobuf
// Indicates the protocol buffer version that is being used
syntax = "proto3";
Expand Down Expand Up @@ -76,7 +76,7 @@ protoc \
--go-grpc_opt=paths=source_relative \
customer.proto
```
Above command will generate two files `customer.pb.go` and `customer_grpc.pb.go` and these contain necessary code to perform rpc calls.
Above command will generate two files `customer.pb.go` and `customer_grpc.pb.go` and these contain necessary code to perform RPC calls.
In `customer.pb.go` you can find `CustomerService` interface-
```go
// CustomerServiceServer is the server API for CustomerService service.
Expand All @@ -102,8 +102,8 @@ func (h *Handler) GetCustomer(ctx context.Context, filter *CustomerFilter) (*Cus
}
```

Lastly to register the gRPC service to the gofr server, user can call the `RegisterCustomerServiceServer` in `customer_grpc.pb.go`
to register the service giving gofr app and the Handler struct.
Lastly to register the gRPC service to the GoFr server, user can call the `RegisterCustomerServiceServer` in `customer_grpc.pb.go`
to register the service giving GoFr app and the Handler struct.
```go
package main

Expand Down
6 changes: 3 additions & 3 deletions docs/advanced-guide/handling-data-migrations/page.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Handling Data Migrations

Suppose you manually make changes to your database, and now it's your responsibility to inform other developers to execute them. 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 and Redis which allows to alter the state of a database, be it adding a new column to existing table or modifying the data type of existing column or adding constraints to an existing table, setting and removing keys etc.
GoFr supports data migrations for MySQL, Postgres and Redis which allows altering the state of a database, be it adding a new column to existing table or modifying the data type of existing column or adding constraints to an existing table, setting and removing keys etc.

## Usage

### Creating Migration Files

It is recommended to maintain a migrations directory in your project root to enhance readability and maintainability.
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 helps prevent numbering conflicts and allows for maintaining the correct sort order by name in different filesystem views.

Create the following file in migrations directory.
Create the following file in `migrations` directory.

**Filename : 20240226153000_create_employee_table.go**

Expand Down
2 changes: 1 addition & 1 deletion docs/advanced-guide/http-authentication/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Authentication is a crucial aspect of web applications, controlling access to re
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 offer various approaches to implement authorization.
GoFr offers various approaches to implement authorization.

## 1. HTTP Basic Auth
*Basic Authentication* is a simple HTTP authentication scheme where the user's credentials (username and password) are
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced-guide/http-communication/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Registration of multiple dependent services is quite easier, which is a common u

> 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
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.
Expand Down
15 changes: 7 additions & 8 deletions docs/advanced-guide/injecting-databases-drivers/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ 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!

## Mongo DB
Gofr supports injecting Mongo DB that supports the following interface. Any driver that implements the interface can be added
using `app.UseMongo()` method, and user's can use MongoDB across application with `gofr.Context`.
## MongoDB
GoFr supports injecting MongoDB that supports the following interface. Any driver that implements the interface can be added
using `app.AddMongo()` method, and user's can use MongoDB across application with `gofr.Context`.
```go
type Mongo interface {
Find(ctx context.Context, collection string, filter interface{}, results interface{}) error
Expand Down Expand Up @@ -42,7 +42,7 @@ compromising the extensibility to use multiple databases.
package main

import (
mongo "github.com/vipul-rawat/gofr-mongo"
"gofr.dev/pkg/gofr/datasource/mongo"
"go.mongodb.org/mongo-driver/bson"

"gofr.dev/pkg/gofr"
Expand All @@ -56,13 +56,12 @@ type Person struct {

func main() {
app := gofr.New()

// using the mongo driver from `vipul-rawat/gofr-mongo`
db := mongo.New(app.Config, app.Logger(), app.Metrics())

db := mongo.New(Config{URI: "mongodb://localhost:27017", Database: "test"})

// inject the mongo into gofr to use mongoDB across the application
// using gofr context
app.UseMongo(db)
app.AddMongo(db)

app.POST("/mongo", Insert)
app.GET("/mongo", Get)
Expand Down
4 changes: 2 additions & 2 deletions docs/advanced-guide/middlewares/page.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Middleware in GoFr

Middleware allows you to intercept and manipulate HTTP requests and responses flowing through your application's
router. Middlewares can perform tasks such as authentication, authorization, caching etc. before
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.

## Adding Custom Middleware in GoFr
Expand Down
6 changes: 3 additions & 3 deletions docs/advanced-guide/overriding-default/page.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Overriding Default

GoFr allows to override default behavior of its features.
GoFr allows overriding default behavior of its features.

## Raw response format

Expand Down Expand Up @@ -74,7 +74,7 @@ Response example:

## Favicon.ico

By default GoFr load it's own `favicon.ico` present in root directory for an application. To override `favicon.ico` user
can place it's custom icon in the **static** directory of it's application.
By default GoFr load its own `favicon.ico` present in root directory for an application. To override `favicon.ico` user
can place its custom icon in the **static** directory of its application.

> NOTE: The custom favicon should also be named as `favicon.ico` in the static directory of application.
2 changes: 1 addition & 1 deletion docs/advanced-guide/publishing-custom-metrics/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
GoFr publishes some {% new-tab-link newtab=false title="default metrics" href="/docs/quick-start/observability" /%}.

GoFr can handle multiple different metrics concurrently, each uniquely identified by its name during initialization.
It supports the following {% new-tab-link title="metrics" href="https://opentelemetry.io/docs/specs/otel/metrics/" /%} types in prometheus format:
It supports the following {% new-tab-link title="metrics" href="https://opentelemetry.io/docs/specs/otel/metrics/" /%} types in Prometheus format:

1. Counter
2. UpDownCounter
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced-guide/remote-log-level-change/page.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Remote Log Level Change

Gofr makes it easy to adjust the details captured in the application's logs, even while it's running!
GoFr makes it easy to adjust the details captured in the application's logs, even while it's running!

This feature allows users to effortlessly fine-tune logging levels without the need for redeployment, enhancing the monitoring and debugging experience.
It is facilitated through simple configuration settings.
Expand Down
6 changes: 3 additions & 3 deletions docs/advanced-guide/using-cron/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ What can users automate with cron?
Basically, any task that can be expressed as a command or script can be automated with cron.

Writing a cron job!
On linux like systems cron jobs can be added by adding a line to the crontab file, specifying the schedule and the command
On Linux like systems cron jobs can be added by adding a line to the crontab file, specifying the schedule and the command
that needs to be run at that schedule. The cron schedule is expressed in the following format.

`minute hour day_of_month month day_of_week`
Expand All @@ -22,8 +22,8 @@ Each field can take a specific value or combination of values to define the sche
`*` (asterisk) to represent **any** value and `,` (comma) to separate multiple values. It also supports `0-n` to define a
range of values for which the cron should run and `*/n` to define number of times the cron should run. Here n is an integer.

## Adding cron jobs in gofr applications
Adding cron jobs to gofr applications is made easy with a simple injection of user's function to the cron table maintained
## Adding cron jobs in GoFr applications
Adding cron jobs to GoFr applications is made easy with a simple injection of user's function to the cron table maintained
by the gofr. The minimum time difference between cron job's two consecutive runs is a minute as it is the least significant
scheduling time parameter.
```go
Expand Down
Loading
Loading