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

Fixed race condition when running selects within go routines. #17

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions crud_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ type (
selectResults []Record
)

var struct_map_cache = make(map[interface{}]columnMap)

func newCrudExec(database database, err error, sql string, args ...interface{}) *CrudExec {
return &CrudExec{database: database, err: err, Sql: sql, Args: args}
}
Expand Down Expand Up @@ -278,10 +276,7 @@ func getColumnMap(i interface{}) (columnMap, error) {
if valKind != reflect.Struct {
return nil, NewGoquError(fmt.Sprintf("Cannot SELECT into this type: %v", t))
}
if _, ok := struct_map_cache[t]; !ok {
struct_map_cache[t] = createColumnMap(t)
}
return struct_map_cache[t], nil
return createColumnMap(t), nil
}

func createColumnMap(t reflect.Type) columnMap {
Expand Down