0.0.47 • Published 2 months ago

effect-db-schema v0.0.47

Weekly downloads
-
License
-
Repository
-
Last release
2 months ago

Requirements

  • Being able to reuse a Effect Schema to a db schema through a magic function
  • We want to be able to map multiple flavors, including representing a struct just as a string column, or a json column
  • The system takes care of transforming the struct into the db shape and back
  • Concrete DB flavours (e.g. SQLite, Postgres, etc) are implemented separately

High-level API

export const User = Schema.struct({
  id: Schema.string,
  name: Schema.string,
})

const user: User = Schema.decodeSnyc({
  id: 'bob',
  name: 'Bob',
})(User)

// save user
await magicDbFunction.persist(user)

// get user
const myUser: User = await magicDbFunction.get(user)

tableFromStruct: DB Table derived from Struct Schema

  • Caveats
    • Only works for structs
    • No control of number types (always uses reals/floats)

Codegen

dbcli codegen --schema ./src/db-schema.ts --output ./src/drizzle-db-schema.ts
import {gen} from 'framework'

gen(struct, './lol.ts')

MVP

Contributors

  • Thanks a lot to @timsuchanek for contributing the initial version of the Drizzle codegen tool
0.0.47

2 months ago

0.0.47-dev.0

2 months ago

0.0.46

2 months ago

0.0.46-dev.4

2 months ago

0.0.46-dev.3

2 months ago

0.0.46-dev.2

2 months ago

0.0.46-dev.1

2 months ago

0.0.46-dev.0

2 months ago

0.0.44

2 months ago

0.0.45

2 months ago

0.0.43

2 months ago

0.0.42

3 months ago

0.0.42-dev.0

3 months ago

0.0.41

3 months ago

0.0.41-dev.2

3 months ago

0.0.41-dev.1

3 months ago

0.0.41-dev.0

3 months ago

0.0.40

3 months ago

0.0.39

4 months ago

0.0.39-dev.3

4 months ago

0.0.39-dev.2

4 months ago

0.0.36

4 months ago

0.0.37

4 months ago

0.0.38

4 months ago

0.0.35

5 months ago

0.0.34

5 months ago

0.0.30

5 months ago

0.0.31

5 months ago

0.0.32

5 months ago

0.0.28

5 months ago

0.0.29

5 months ago

0.0.27

6 months ago

0.0.25

6 months ago

0.0.24

6 months ago

0.0.23

6 months ago

0.0.22

6 months ago

0.0.21

6 months ago

0.0.1

6 months ago

0.0.19

7 months ago

0.0.16

7 months ago