Effect CommunityEC
Effect Community17mo ago
9 replies
Tom

Utilizing Encode/Decode Functionality in Effect Schema for API to Database Flow

I've just started playing around with effect schema and I'm trying to wrap my head around how to utilise the encode/decode functionality. Suppose I have a flow such as View -> Business Logic -> Database, how should I define the schemas? I currently have 3 schemas, view schema, "business" schema, and model schema (for the database structure). My first instinct it to try to define a chain of schemas with encoding/decoding moving up and down the chain: unknown <--> view <--> business <--> model <--> unknown where the first unknown is the HTTP response body and the last unknown is the database response. Is this the right idea? And if so, how would this be achieved with some custom mappings?
Was this page helpful?