| 362 | } |
| 363 | |
| 364 | func primaryKeyValueFromObject(obj map[string]interface{}, sel *qcode.Select) (interface{}, bool) { |
| 365 | if sel == nil || sel.Ti.PrimaryCol.Name == "" { |
| 366 | return nil, false |
| 367 | } |
| 368 | pkName := sel.Ti.PrimaryCol.Name |
| 369 | for _, f := range sel.Fields { |
| 370 | if f.Type != qcode.FieldTypeCol || !strings.EqualFold(f.Col.Name, pkName) { |
| 371 | continue |
| 372 | } |
| 373 | fieldName := f.FieldName |
| 374 | if fieldName == "" { |
| 375 | fieldName = f.Col.Name |
| 376 | } |
| 377 | id, ok := obj[fieldName] |
| 378 | return id, ok |
| 379 | } |
| 380 | return nil, false |
| 381 | } |
| 382 | |
| 383 | // stringifyID converts various ID types to string |
| 384 | func stringifyID(id interface{}) string { |