Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deleteExisting metadata tag #48

Merged
merged 12 commits into from
Aug 29, 2018
Merged

Conversation

mochacat
Copy link
Contributor

No description provided.

testing.go Outdated
@@ -70,6 +77,22 @@ func (eh ExpectationHelper) getUpdateDBColumns() []string {
return tableMetadata.getColumnNamesForUpdate()
}

/*func (eh ExpectationHelper) getDeletePrimaryKeyValue(object reflect.Value) interface{} {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this?

picard.go Outdated

// already exists in updates so delete the existing update that
// matches the delete
newUpdates := updates[:0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand why this last section is necessary. Let's talk about it when you're at the office.

picard.go Outdated
if multitenancyKeyColumnName != "" {
query = query.Where(fmt.Sprintf("%v.%v = $2", tableName, multitenancyKeyColumnName), p.multitenancyValue)
arg := "$1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I may know of a way that we can avoid doing this. I'll see if I can get it to work.

@@ -28,6 +29,41 @@ func (p PersistenceORM) FilterModel(filterModel interface{}) ([]interface{}, err
return p.FilterModelAssociations(filterModel, nil)
}

// FilterModels returns models that match the provided struct, multiple models can be provided
func (p PersistenceORM) FilterModels(filterModels interface{}, transaction *sql.Tx) ([]interface{}, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This basically lets you send multiple models into a "FilterModel" call, and will put their where clauses in parenthesis separated by ORs.

@@ -5,7 +5,6 @@ workspace:
pipeline:
test:
image: golang:1.9-alpine
pull: true
environment:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this was helping any.

@plusplusben plusplusben merged commit e80b916 into master Aug 29, 2018
@plusplusben plusplusben deleted the delete-existing-generate-changes branch August 29, 2018 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants