sqlx-gen
codegen for sqlx structs from CREATE TABLE statements
Example Usage
❯ go build -o main.bin main.go
❯ ./main.bin -schema create_commerce_schema.sql
2021/07/28 21:30:04 [warn] select * from corder is not a CreateTable (type: *sqlparser.Select), skipping ...
// Code generated by sqlx-gen. DO NOT EDIT.
package models
type Product struct {
Sku []byte `json:"sku" db:"sku"`
Description []byte `json:"description" db:"description"`
Price int64 `json:"price" db:"price"`
}
type Customer struct {
CustomerId int64 `json:"customer_id" db:"customer_id"`
Email []byte `json:"email" db:"email"`
IsActive bool `json:"is_active" db:"is_active"`
}
type Corder struct {
OrderId int64 `json:"order_id" db:"order_id"`
CustomerId int64 `json:"customer_id" db:"customer_id"`
Sku []byte `json:"sku" db:"sku"`
Price int64 `json:"price" db:"price"`
}