Effect CommunityEC
Effect Community2y ago
38 replies
bsluther

Challenges in Extending Schema Class with `S.pick` for Table Joining

Trying to extend a schema class but can't use S.pick as I'd hoped. Basically I'm joining some tables and want to extend one table with the columns selected from another table. I can do it manually, but would expect there is a way to use S.pick or something similar?

const SelectedTemporalColumns = TemporalTable.pipe(
  S.pick('created_at', 'start', 'start_precision', 'end', 'end_precision')
)
// this works
class SiWithTemporal extends SequenceInstanceTable.extend<SiWithTemporal>('SiWithTemporal')
({
  created_at: TemporalTable.fields.created_at,
  start: TemporalTable.fields.start,
  start_precision: TemporalTable.fields.start_precision,
  end: TemporalTable.fields.end,
  end_precision: TemporalTable.fields.end_precision,
}){}
// would like to do something like this
class SiWithTemporal extends SequenceInstanceTable.extend<SiWithTemporal>('SiWithTemporal')
(SelectedTemporalColumns){}
Was this page helpful?