jmoiron / modl

golang database modelling library
MIT License
479 stars 48 forks source link

Added TypeMap support #49

Closed icholy closed 6 years ago

icholy commented 6 years ago

This is just a proof of concept, but if I get the go-ahead i'll add docs/tests. Here's how it would work.

dbmap := modl.NewDbMap(db, modl.PostgresDialect{
    TypeMap: map[reflect.Type]string{
        reflect.TypeOf(sql.NullInt64{}):   "bigint",
        reflect.TypeOf(sql.NullFloat64{}): "double precision",
    },
})

This addresses #45

tmc commented 6 years ago

@icholy I think this would be a nice addition

icholy commented 6 years ago

@tmc I'm using the SqlTyper interface.