(ctx context.Context, oref waveobj.ORef)
| 149 | } |
| 150 | |
| 151 | func DBGetORef(ctx context.Context, oref waveobj.ORef) (waveobj.WaveObj, error) { |
| 152 | return WithTxRtn(ctx, func(tx *TxWrap) (waveobj.WaveObj, error) { |
| 153 | table := tableNameFromOType(oref.OType) |
| 154 | query := fmt.Sprintf("SELECT oid, version, data FROM %s WHERE oid = ?", table) |
| 155 | var row idDataType |
| 156 | found := tx.Get(&row, query, oref.OID) |
| 157 | if !found { |
| 158 | return nil, nil |
| 159 | } |
| 160 | rtn, err := waveobj.FromJson(row.Data) |
| 161 | if err != nil { |
| 162 | return rtn, err |
| 163 | } |
| 164 | waveobj.SetVersion(rtn, row.Version) |
| 165 | return rtn, nil |
| 166 | }) |
| 167 | } |
| 168 | |
| 169 | func dbSelectOIDs(ctx context.Context, otype string, oids []string) ([]waveobj.WaveObj, error) { |
| 170 | return WithTxRtn(ctx, func(tx *TxWrap) ([]waveobj.WaveObj, error) { |
no test coverage detected