mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-29 21:26:10 +01:00
Fix doc for 1.19 backend guideline (#24942)
Port the file change in https://github.com/go-gitea/gitea/pull/24925/files from `main` to `v1.19` to fix docs
This commit is contained in:
parent
d1af0a3e4c
commit
b4cd1028d9
|
@ -35,7 +35,7 @@ To maintain understandable code and avoid circular dependencies it is important
|
||||||
- `cmd`: All Gitea actual sub commands includes web, doctor, serv, hooks, admin and etc. `web` will start the web service. `serv` and `hooks` will be invoked by Git or OpenSSH. Other sub commands could help to maintain Gitea.
|
- `cmd`: All Gitea actual sub commands includes web, doctor, serv, hooks, admin and etc. `web` will start the web service. `serv` and `hooks` will be invoked by Git or OpenSSH. Other sub commands could help to maintain Gitea.
|
||||||
- `tests`: Common test utility functions
|
- `tests`: Common test utility functions
|
||||||
- `tests/integration`: Integration tests, to test back-end regressions
|
- `tests/integration`: Integration tests, to test back-end regressions
|
||||||
- `tests/e2e`: E2e tests, to test test front-end <> back-end compatibility and visual regressions.
|
- `tests/e2e`: E2e tests, to test front-end and back-end compatibility and visual regressions.
|
||||||
- `models`: Contains the data structures used by xorm to construct database tables. It also contains functions to query and update the database. Dependencies to other Gitea code should be avoided. You can make exceptions in cases such as logging.
|
- `models`: Contains the data structures used by xorm to construct database tables. It also contains functions to query and update the database. Dependencies to other Gitea code should be avoided. You can make exceptions in cases such as logging.
|
||||||
- `models/db`: Basic database operations. All other `models/xxx` packages should depend on this package. The `GetEngine` function should only be invoked from `models/`.
|
- `models/db`: Basic database operations. All other `models/xxx` packages should depend on this package. The `GetEngine` function should only be invoked from `models/`.
|
||||||
- `models/fixtures`: Sample data used in unit tests and integration tests. One `yml` file means one table which will be loaded into database when beginning the tests.
|
- `models/fixtures`: Sample data used in unit tests and integration tests. One `yml` file means one table which will be loaded into database when beginning the tests.
|
||||||
|
@ -70,7 +70,6 @@ So services must be allowed to create a database transaction. Here is some examp
|
||||||
// services/repository/repository.go
|
// services/repository/repository.go
|
||||||
func CreateXXXX() error {
|
func CreateXXXX() error {
|
||||||
return db.WithTx(func(ctx context.Context) error {
|
return db.WithTx(func(ctx context.Context) error {
|
||||||
e := db.GetEngine(ctx)
|
|
||||||
// do something, if err is returned, it will rollback automatically
|
// do something, if err is returned, it will rollback automatically
|
||||||
if err := issues.UpdateIssue(ctx, repoID); err != nil {
|
if err := issues.UpdateIssue(ctx, repoID); err != nil {
|
||||||
// ...
|
// ...
|
||||||
|
|
Loading…
Reference in a new issue