1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-11-24 08:22:42 +02:00
crud_generator/bin/templates
2024-04-02 11:54:01 +03:00
..
api сделал Read_ctx(ctx context.Context, db *gorm.DB, m *calendars.Calendar) 2024-04-02 11:54:01 +03:00
bin сделал CopyAllFiles_Exclude_() 2023-11-15 17:59:21 +03:00
cmd сделал make mod 2023-12-27 14:28:11 +03:00
configs_ сделал FillRowsCount() 2024-03-21 11:25:12 +03:00
internal/app сделал Read_ctx(ctx context.Context, db *gorm.DB, m *calendars.Calendar) 2024-04-02 11:54:01 +03:00
pkg сделал Read_ctx(ctx context.Context, db *gorm.DB, m *calendars.Calendar) 2024-04-02 11:54:01 +03:00
scripts сделал CopyAllFiles_Exclude_() 2023-11-15 17:59:21 +03:00
.env_ сделал готовый микросервис 2023-11-20 17:08:58 +03:00
.gitignore сделал CopyAllFiles_Exclude_() 2023-11-15 17:59:21 +03:00
Makefile_ сделал объединил templates_main и templates 2024-02-09 15:17:57 +03:00
README.md сделал README.md 2024-03-22 16:26:01 +03:00
readme.rus сделал README.md 2024-03-22 16:26:01 +03:00

The service implements synchronous data exchange.

Service for exchanging data with Postgres SQL database Data exchange is done using different methods:

  1. Commands in NATS for reading, changing, etc.
  2. DB CRUD operations - direct exchange with the database (each table model has methods Read(), Update(), Create(), Save(), Delete(), Restore())
  3. GRPC - exchange with the database using the GRPC protocol (the client service that needs to exchange with the database connects to the sync_exchange server service, the latter exchanges with the database)
  4. NRPC - exchange with the database using the NRPC protocol (the client service that needs to exchange with the database connects to the NATS service, which sends commands to the sync_exchange server, the latter exchanges with the database)

Before starting CRUD operations, you must specify the transport over which the exchange will take place (CRUD, GRPC, NRPC) using one of the commands: InitCrudTransport_DB() InitCrudTransport_GRPC() InitCrudTransport_NRPC() from module "gitlab.aescorp.ru/dsp_dev/claim/sync_service/pkg/crud_starter"

Also, to get started, the environment variables must be filled in:

  1. for DB CRUD: DB_HOST="10.1.9.23" DB_NAME="claim" DB_SCHEME="public" DB_PORT="5432" DB_USER="" DB_PASSWORD=""

  2. for GRPC: SYNC_SERVICE_HOST=10.1.9.150 SYNC_SERVICE_PORT=30031

  3. for NRPC: BUS_LOCAL_HOST="10.1.9.150" BUS_LOCAL_PORT=30222

For NRPC (GRPC) it is advisable to connect there first and disconnect at the end nrpc_client.Connect() defer nrpc_client.CloseConnection() otherwise, the code will still connect there and will not disconnect at the end of the microservice.