sqlgen2

command module
v0.79.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: BSD-2-Clause Imports: 18 Imported by: 0

README

sqlgen2

GoDoc Build Status Issues

sqlgen generates SQL statements from your Go structs, used along with sqlapi database helper functions. It takes the place of a simple ORM or hand-written SQL.

See the demo directory for examples. Look in the generated files *_sql.go and the hand-crafted files (hook.go, issue.go, user.go).

Features

  • Auto-generates DAO-style table-support code for SQL databases.
  • Sophisticated parsing of a Go struct that describes records in the table.
  • Allows nesting of structs, fields that are structs or pointers to structs etc.
  • Struct tags give fine control over the semantics of each field.
  • Supports indexes and constraints.
  • Supports foreign key relationships between tables.
  • Helps you develop code for joins and views.
  • Supports JSON-encoded columns, allowing a more no-SQL model when needed.
  • Provides a builder-style API for constructing where-clauses and query constraints.
  • Allows declarative requirements on the expected result of each query, enhancing error checking.
  • Very flexible configuration.
  • Fast and easy to use.

Currently, support is included for MySQL, PostgreSQL and SQLite. Other database/sql dialects can be added relatively easy - send a Pull Request!

There is also direct support for pgx, which differs somewhat from the database/sql but is noteworthy and worth supporting here.

Install

-- this is being revised --

Usage

See the command line usage.

Tutorial

See the tutorial.

Credits

This tool was derived from sqlgen by drone.io, which was itself inspired by scaneo.

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