mirror of
https://github.com/ManyakRus/crud_generator.git
synced 2025-02-20 08:08:17 +02:00
сделал find_by_functions.json
This commit is contained in:
parent
34b476600f
commit
67f8a10eb1
58
README.md
58
README.md
@ -2,32 +2,48 @@ The crud_generator application is designed to automatically generate source code
|
||||
in golang language to perform CRUD operations.
|
||||
A completely ready-made microservice is created that can be launched immediately.
|
||||
|
||||
For each table in the Postgres SQL database, files will be created to perform crud operations:
|
||||
- Create(), Read(), Update(), Delete() (or Delete() + Restore(), if there is an is_deleted field)
|
||||
- Save() - creating a new record when ID=0, or updating a record when ID<>0
|
||||
For each table in the Postgres SQL database, functions will be automatic created to perform crud operations:
|
||||
- Create()
|
||||
- Read()
|
||||
- Update()
|
||||
- Delete() (or Delete() + Restore(), if there is an is_deleted field)
|
||||
- Save() - creating a new record when ID is empty, or updating a record when ID is not empty
|
||||
- ReadFromCache() - reading from cache or database
|
||||
- Update_ColumnName() - changing only one column with the name ColumnName,
|
||||
separate function for each column of each table
|
||||
- UpdateManyFields() - change several columns listed in an array
|
||||
- FindBy_ColumnName() - search for a record by one or more columns (if you fill in the findby_functions.json file)
|
||||
- FindMassBy_ColumnName() - search for multiple records by one or more columns (if you fill in the findmassby_functions.json file)
|
||||
|
||||
files are generated:
|
||||
1. table - struct structure with all fields from the database, and gorm + json annotations
|
||||
Tables with fields in the database must be created manually in advance.
|
||||
The code generator will find all the tables and their fields in the database and use them.
|
||||
2. model - struct structure, including table, with crud operations functions
|
||||
2. crud - files for performing crud operations, exchange with the database,
|
||||
as well as files with tests
|
||||
3. grpc server - files for performing crud operations over the network, using the GRPC protocol,
|
||||
as well as files with tests
|
||||
4. grpc client - client files for using GRPC by third-party services,
|
||||
as well as files with tests
|
||||
5. nrpc server - files for performing crud operations over the network, using the NRPC protocol (via the NATS message broker),
|
||||
as well as files with tests
|
||||
6. nrpc client - client files for use by NRPC third-party services,
|
||||
as well as files with tests
|
||||
7. crud_starter - a file with functions for switching to the desired protocol db or grpc or nrpc
|
||||
8. main.go and other .go files
|
||||
9. Makefile - script launch configuration file
|
||||
10. .env - file for filling in the microservice configuration (database connection parameters, etc.)
|
||||
Tables with fields in the database must be created manually in advance.
|
||||
The code generator will find all the tables and their fields in the database and use them.
|
||||
|
||||
2. entities - struct structure, including table, with crud operations functions
|
||||
|
||||
3. crud - files for performing crud operations, exchange with the database,
|
||||
as well as files with tests
|
||||
|
||||
4. grpc server - files for performing crud operations over the network, using the GRPC protocol,
|
||||
as well as files with tests
|
||||
|
||||
5. grpc client - client files for using GRPC by third-party services,
|
||||
as well as files with tests
|
||||
|
||||
6. nrpc server - files for performing crud operations over the network, using the NRPC protocol (via the NATS message broker),
|
||||
as well as files with tests
|
||||
|
||||
7. nrpc client - client files for use by NRPC third-party services,
|
||||
as well as files with tests
|
||||
|
||||
8. crud_starter - a file with functions for switching to the desired protocol db or grpc or nrpc
|
||||
|
||||
9. main.go and other .go files
|
||||
|
||||
10. Makefile - script launch configuration file
|
||||
|
||||
11. .env - file for filling in the microservice configuration (database connection parameters, etc.)
|
||||
|
||||
|
||||
Code templates are stored in the bin/templates folder.
|
||||
@ -64,7 +80,7 @@ Start microservice:
|
||||
|
||||
|
||||
P.S.
|
||||
I generated myself 350,000 lines of code, from 70 tables in the database, for my service.
|
||||
I generated myself 420,000 lines of code, from 70 tables in the database, for my service.
|
||||
|
||||
|
||||
Source code in Golang language.
|
||||
|
60
readme.rus
60
readme.rus
@ -2,32 +2,48 @@
|
||||
на языке golang для выполнения операций CRUD.
|
||||
Создаётся полностью готовый микросервис, который можно сразу запустить.
|
||||
|
||||
Для каждой таблицы в базе данных Postgres SQL будут сделаны файлы для выполнения crud операций:
|
||||
- Create(), Read(), Update(), Delete() (или Delete() + Restore() если есть поле is_deleted)
|
||||
- Save() - создание новой записи при ID=0, или обновление записи при ID<>0
|
||||
Для каждой таблицы в базе данных Postgres SQL автоматически будут сделаны функции для выполнения crud операций:
|
||||
- Create()
|
||||
- Read()
|
||||
- Update()
|
||||
- Delete() (или Delete() + Restore() если есть поле is_deleted)
|
||||
- Save() - создание новой записи при пустом ID, или обновление записи при не пустом ID
|
||||
- ReadFromCache() - чтение из кэша или базы данных
|
||||
- Update_ColumnName() - изменение только одной колонки с именем ColumnName,
|
||||
отдельная функция для каждой колонки каждой таблицы.
|
||||
- UpdateManyFields() - изменение нескольких колонок, перечисленных в массиве
|
||||
- FindBy_ColumnName() - поиск записи по одной или нескольким колонкам (если заполнить файл findby_functions.json)
|
||||
- FindMassBy_ColumnName() - поиск несколько записей по одной или нескольким колонкам (если заполнить файл findmassby_functions.json)
|
||||
|
||||
генерируются файлы:
|
||||
1. table - структура struct со всеми полями из БД, и аннотациями gorm + json
|
||||
Таблицы с полями в базе данных должны быть созданы заранее вручную.
|
||||
Кодогенератор найдёт в базе все таблицы и их поля, и использует их.
|
||||
2. model - структура struct, включающая table, с функциями crud операций
|
||||
2. crud - файлы выполнения crud операций, обмен с базой данных,
|
||||
а также файлы с тестами
|
||||
3. grpc server - файлы для выполнения crud операций по сети, по протоколу GRPC,
|
||||
а также файлы с тестами
|
||||
4. grpc client - файлы клиенты для использования GRPC сторонними сервисами,
|
||||
а также файлы с тестами
|
||||
5. nrpc server - файлы для выполнения crud операций по сети, по протоколу NRPC (через брокер сообщений NATS),
|
||||
а также файлы с тестами
|
||||
6. nrpc client - файлы клиенты для использования NRPC сторонними сервисами,
|
||||
а также файлы с тестами
|
||||
7. crud_starter - файл с функциями переключения на нужный протокол db или grpc или nrpc
|
||||
8. main.go и другие .go файлы
|
||||
9. Makefile - файл настройки запуска скриптов
|
||||
10. .env - файл для заполнения конфигурации микросервиса (параметры подключения к БД и др.)
|
||||
1. tables - структура struct со всеми полями из БД, и аннотациями gorm + json
|
||||
Таблицы с полями в базе данных должны быть созданы заранее вручную.
|
||||
Кодогенератор найдёт в базе все таблицы и их поля, и использует их.
|
||||
|
||||
2. entities - структура struct, включающая table, с функциями crud операций
|
||||
|
||||
3. crud - файлы выполнения crud операций, обмен с базой данных,
|
||||
а также файлы с тестами
|
||||
|
||||
4. grpc server - файлы для выполнения crud операций по сети, по протоколу GRPC,
|
||||
а также файлы с тестами
|
||||
|
||||
5. grpc client - файлы клиенты для использования GRPC сторонними сервисами,
|
||||
а также файлы с тестами
|
||||
|
||||
6. nrpc server - файлы для выполнения crud операций по сети, по протоколу NRPC (через брокер сообщений NATS),
|
||||
а также файлы с тестами
|
||||
|
||||
7. nrpc client - файлы клиенты для использования NRPC сторонними сервисами,
|
||||
а также файлы с тестами
|
||||
|
||||
8. crud_starter - файл с функциями переключения на нужный протокол db или grpc или nrpc
|
||||
|
||||
9. main.go и другие .go файлы
|
||||
|
||||
10. Makefile - файл настройки запуска скриптов
|
||||
|
||||
11. .env - файл для заполнения конфигурации микросервиса (параметры подключения к БД и др.)
|
||||
|
||||
|
||||
Шаблоны кода хранятся в папке bin/templates.
|
||||
@ -63,7 +79,7 @@
|
||||
|
||||
|
||||
P.S.
|
||||
Я сгенерировал себе 170000 строк кода, из 70 таблиц в базе данных, для своего сервиса.
|
||||
Я сгенерировал себе 420000 строк кода, из 70 таблиц в базе данных, для своего сервиса.
|
||||
|
||||
|
||||
Исходный код на языке Golang.
|
||||
|
Loading…
x
Reference in New Issue
Block a user