(ctx context.Context, oid string)
| 238 | } |
| 239 | |
| 240 | func DBResolveEasyOID(ctx context.Context, oid string) (*waveobj.ORef, error) { |
| 241 | return WithTxRtn(ctx, func(tx *TxWrap) (*waveobj.ORef, error) { |
| 242 | for _, rtype := range waveobj.AllWaveObjTypes() { |
| 243 | otype := reflect.Zero(rtype).Interface().(waveobj.WaveObj).GetOType() |
| 244 | table := tableNameFromOType(otype) |
| 245 | var fullOID string |
| 246 | if len(oid) == 8 { |
| 247 | query := fmt.Sprintf("SELECT oid FROM %s WHERE oid LIKE ?", table) |
| 248 | fullOID = tx.GetString(query, oid+"%") |
| 249 | } else { |
| 250 | query := fmt.Sprintf("SELECT oid FROM %s WHERE oid = ?", table) |
| 251 | fullOID = tx.GetString(query, oid) |
| 252 | } |
| 253 | if fullOID != "" { |
| 254 | oref := waveobj.MakeORef(otype, fullOID) |
| 255 | return &oref, nil |
| 256 | } |
| 257 | } |
| 258 | return nil, ErrNotFound |
| 259 | }) |
| 260 | } |
| 261 | |
| 262 | func DBSelectMap[T waveobj.WaveObj](ctx context.Context, ids []string) (map[string]T, error) { |
| 263 | rtnArr, err := dbSelectOIDs(ctx, getOTypeGen[T](), ids) |
no test coverage detected