This commit is contained in:
parent
500bf48295
commit
f3a139b809
6 changed files with 103 additions and 34 deletions
|
@ -18,14 +18,6 @@ import (
|
|||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
)
|
||||
|
||||
// "git.mstar.dev/mstar/linstrom/config"
|
||||
|
||||
// "context"
|
||||
// "time"
|
||||
// postgresContainer "github.com/testcontainers/testcontainers-go/modules/postgres"
|
||||
// "github.com/testcontainers/testcontainers-go"
|
||||
// "github.com/testcontainers/testcontainers-go/wait"
|
||||
|
||||
const (
|
||||
dbName = "linstrom"
|
||||
dbUser = "linstrom"
|
||||
|
@ -38,31 +30,6 @@ func main() {
|
|||
other.ConfigureLogging(nil)
|
||||
config.ReadAndWriteToGlobal(*shared.FlagConfigFile)
|
||||
|
||||
// Set up a temporary postgres container for gorm-gen to do its thing
|
||||
// log.Info().Msg("Starting temporary postgres container")
|
||||
// pgContainer, err := postgresContainer.Run(
|
||||
// context.Background(),
|
||||
// "postgres:16.4-alpine",
|
||||
// postgresContainer.WithDatabase(dbName),
|
||||
// postgresContainer.WithUsername(dbUser),
|
||||
// postgresContainer.WithPassword(dbPass),
|
||||
// testcontainers.WithWaitStrategyAndDeadline(
|
||||
// time.Minute,
|
||||
// wait.ForLog("database system is ready to accept connections").
|
||||
// WithOccurrence(2).
|
||||
// WithStartupTimeout(time.Second*5),
|
||||
// ),
|
||||
// )
|
||||
// if err != nil {
|
||||
// log.Fatal().Err(err).Msg("Failed to setup temporary postgres container")
|
||||
// }
|
||||
// log.Info().Msg("Temporary postgres container started")
|
||||
// defer func() {
|
||||
// if err := testcontainers.TerminateContainer(pgContainer); err != nil {
|
||||
// log.Fatal().Err(err).Msg("Failed to terminate temporary postgres container")
|
||||
// }
|
||||
// log.Info().Msg("Temporary postgres container stopped")
|
||||
// }()
|
||||
db, err := gorm.Open(
|
||||
postgres.Open(config.GlobalConfig.Storage.BuildPostgresDSN()),
|
||||
// postgres.Open(pgContainer.MustConnectionString(context.Background())),
|
||||
|
@ -84,7 +51,10 @@ func main() {
|
|||
log.Info().Msg("Applying basic operations on all datatypes")
|
||||
g.ApplyBasic(models.AllTypes...)
|
||||
|
||||
log.Info().Msg("Starting generation")
|
||||
log.Info().Msg("Basic operations applied, applying extra features")
|
||||
g.ApplyInterface(func(models.INotification) {}, models.Notification{})
|
||||
|
||||
log.Info().Msg("Extra features applied, starting generation")
|
||||
g.Execute()
|
||||
log.Info().Msg("Code generation complete")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue