InitMigrator a Migrator singleton
(basicRes context.BasicRes)
| 31 | |
| 32 | // InitMigrator a Migrator singleton |
| 33 | func InitMigrator(basicRes context.BasicRes) (plugin.Migrator, errors.Error) { |
| 34 | lock.Lock() |
| 35 | defer lock.Unlock() |
| 36 | |
| 37 | if migrator != nil { |
| 38 | return nil, errors.Internal.New("migrator singleton has already been initialized") |
| 39 | } |
| 40 | var err errors.Error |
| 41 | migrator, err = migration.NewMigrator(basicRes) |
| 42 | return migrator, err |
| 43 | } |
| 44 | |
| 45 | // GetMigrator returns the shared Migrator singleton |
| 46 | func GetMigrator() plugin.Migrator { |