1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-12-16 21:52:42 +02:00
crud_generator/internal/logic/logic.go

96 lines
2.0 KiB
Go
Raw Normal View History

2023-09-28 16:45:44 +02:00
package logic
import (
2023-10-26 16:03:50 +02:00
"github.com/ManyakRus/crud_generator/internal/create_files/crud_starter"
2023-10-25 15:22:30 +02:00
"github.com/ManyakRus/crud_generator/internal/create_files/db"
2023-10-26 10:33:12 +02:00
"github.com/ManyakRus/crud_generator/internal/create_files/grpc_client"
2023-10-26 13:18:38 +02:00
"github.com/ManyakRus/crud_generator/internal/create_files/grpc_proto"
2023-10-26 10:33:12 +02:00
"github.com/ManyakRus/crud_generator/internal/create_files/grpc_server"
2023-10-24 17:03:04 +02:00
"github.com/ManyakRus/crud_generator/internal/create_files/model"
2023-10-26 13:18:38 +02:00
"github.com/ManyakRus/crud_generator/internal/create_files/nrpc_client"
2023-09-28 16:45:44 +02:00
"github.com/ManyakRus/crud_generator/internal/postgres"
"github.com/ManyakRus/starter/log"
)
//var MassTable []types.Table
2023-10-24 17:03:04 +02:00
func StartFillAll() error {
var err error
2023-09-28 16:45:44 +02:00
//заполним MapAll
MapAll, err := postgres.FillMapTable()
if err != nil {
log.Error("FillMapTable() error: ", err)
2023-10-24 17:03:04 +02:00
return err
2023-09-28 16:45:44 +02:00
}
2023-10-24 17:03:04 +02:00
if len(MapAll) == 0 {
return err
2023-09-28 16:45:44 +02:00
}
2023-11-08 16:37:35 +02:00
////заполним типы TypeGo
//err = model.FillColumnsNameGo(&MapAll)
//if err != nil {
// return err
//}
2023-10-25 15:22:30 +02:00
//модель
2023-10-26 10:33:12 +02:00
err = model.CreateAllFiles(MapAll)
2023-10-25 15:22:30 +02:00
if err != nil {
return err
}
//db crud
2023-10-26 10:33:12 +02:00
err = db.CreateAllFiles(MapAll)
if err != nil {
return err
}
//grpc_server
err = grpc_server.CreateAllFiles(MapAll)
if err != nil {
return err
}
//grpc_client
err = grpc_client.CreateAllFiles(MapAll)
2023-10-25 15:22:30 +02:00
if err != nil {
return err
}
2023-09-28 16:45:44 +02:00
2023-10-26 13:18:38 +02:00
//grpc_client
err = nrpc_client.CreateAllFiles(MapAll)
if err != nil {
return err
}
//grpc_proto
err = grpc_proto.CreateAllFiles(MapAll)
if err != nil {
return err
}
2023-10-26 16:03:50 +02:00
//crud_starter
err = crud_starter.CreateAllFiles(MapAll)
if err != nil {
return err
}
2023-10-24 17:03:04 +02:00
return err
2023-09-28 16:45:44 +02:00
}
2023-09-28 17:08:00 +02:00
//// MassFromMapColumns - возвращает Slice из Map
//func MassFromMapColumns(MapColumns map[string]types.Column) []types.Column {
// Otvet := make([]types.Column, 0)
//
// for _, v := range MapColumns {
// Otvet = append(Otvet, v)
// }
//
// sort.Slice(Otvet[:], func(i, j int) bool {
// return Otvet[i].OrderNumber < Otvet[j].OrderNumber
// })
//
// return Otvet
//}