Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ajm188/sqlx-gen
codegen for sqlx structs from CREATE TABLE statements
https://github.com/ajm188/sqlx-gen
Last synced: 4 days ago
JSON representation
codegen for sqlx structs from CREATE TABLE statements
- Host: GitHub
- URL: https://github.com/ajm188/sqlx-gen
- Owner: ajm188
- License: mit
- Created: 2021-07-29T01:28:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-29T01:30:40.000Z (over 3 years ago)
- Last Synced: 2024-06-20T03:55:03.151Z (8 months ago)
- Language: Go
- Size: 42 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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"`
}
```