github.com/goravel/framework@v1.13.9/testing/docker/docker.go (about) 1 package docker 2 3 import ( 4 "github.com/goravel/framework/contracts/foundation" 5 "github.com/goravel/framework/contracts/testing" 6 "github.com/goravel/framework/database/gorm" 7 ) 8 9 type Docker struct { 10 app foundation.Application 11 } 12 13 func NewDocker(app foundation.Application) *Docker { 14 return &Docker{ 15 app: app, 16 } 17 } 18 19 func (receiver *Docker) Database(connection ...string) (testing.Database, error) { 20 if len(connection) == 0 { 21 return NewDatabase(receiver.app, "", gorm.NewInitializeImpl()) 22 } else { 23 return NewDatabase(receiver.app, connection[0], gorm.NewInitializeImpl()) 24 } 25 }