github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/test/patch_models/project.go (about) 1 package patch_models 2 3 import ( 4 "reflect" 5 6 "github.com/agiledragon/gomonkey/v2" 7 8 "github.com/machinefi/w3bstream/pkg/depends/kit/sqlx" 9 "github.com/machinefi/w3bstream/pkg/models" 10 ) 11 12 var _targetModelProject = reflect.TypeOf(&models.Project{}) 13 14 func ProjectFetchByProjectID(patch *gomonkey.Patches, overwrite *models.Project, err error) *gomonkey.Patches { 15 return patch.ApplyMethod( 16 _targetModelProject, 17 "FetchByProjectID", 18 func(receiver *models.Project, _ sqlx.DBExecutor) error { 19 if overwrite != nil { 20 *receiver = *overwrite 21 } 22 return err 23 }, 24 ) 25 }