sqlgen

command module
v0.0.0-...-bf7e435 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2016 License: MIT Imports: 15 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL