Skip to content

optiopay/sqlgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sqlgen

This tool generates sql.Scanner and sql.Valuer interfaces for your own structs and type aliases. It is tested with Postgres and lib/pq library, others might work. The command is quite self explanatory, use the --help option to understand the parameters.

Trying it out

The example folder provides you with tests and structs to understand how this tool works. Run go generate in the example folder to generate the interfaces. Then you can run go test to see if all works. It tries to connect to a local postgres instance and needs a database named ⁠⁠⁠⁠custom.

The -array⁠⁠⁠⁠ param generates array types as well, the -sql⁠⁠⁠⁠ param adds a Init function that can be used to create the composite type in postgres.

Aliases

There is support for type aliases. To generate scanner and valuer for type aliases you can pass them through the alias param.

About

A sql.Scanner and sql.Valuer generator for Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages