sqlx-gen

command module
v0.0.0-...-7eeabce Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 8 Imported by: 0

README

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"`
}

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