Skip to content

Add parameter support for IN (...) #143

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

Closed
wants to merge 3 commits into from
Closed

Conversation

ttacon
Copy link

@ttacon ttacon commented Mar 2, 2014

Add support for expansion of a slice of values if the slice was tagged wrapped with gorp.List{}. It should be noted that for sqlite this only works if '?' are the only used placeholders.

Review on Reviewable

@@ -1540,7 +1543,9 @@ func maybeExpandNamedQuery(m *DbMap, query string, args []interface{}) (string,
return arg.MapIndex(reflect.ValueOf(key))
})
// #84 - ignore time.Time structs here - there may be a cleaner way to do this
case arg.Kind() == reflect.Struct && !(arg.Type().PkgPath() == "time" && arg.Type().Name() == "Time"):
case arg.Kind() == reflect.Struct &&
!(arg.Type().PkgPath() == "time" && arg.Type().Name() == "Time") &&
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 doing something like

var (
  timeType = reflect.TypeOf(time.Time{})
  listType = reflect.TypeOf(List{})
)

func ..
  if arg.Type() != timeType && arg.Type() != listType { 
    ..
  }

could be cleaner

Copy link
Author

Choose a reason for hiding this comment

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

I totally agree, good point.

@ttacon
Copy link
Author

ttacon commented Mar 18, 2014

Just bumping this, any comments on it?

@ttacon
Copy link
Author

ttacon commented Mar 22, 2014

Hi, I was just wondering if I could get some feedback on this pull request? Thanks in advance!

"strings"
)

const (
NOT_POSTGRES = -2
Copy link
Contributor

Choose a reason for hiding this comment

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

Despite being constant, this should be lowerCamel, to avoid exporting it

Copy link
Contributor

Choose a reason for hiding this comment

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

this is meant to indicate absence of an index. The builtin string index functions use -1 -- any reason you chose -2 ?

@GeertJohan GeertJohan added this to the v2.1-maybe milestone Jul 1, 2015
@ttacon ttacon closed this Dec 21, 2023
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.

4 participants