Schemint

paste PostgreSQL or JSON, get your schema reviewed like a senior would

PostgreSQL CREATE TABLE to Go struct

Paste a CREATE TABLE, get a Go struct. Nothing you paste is stored.

Paste a PostgreSQL CREATE TABLE and get a Go struct with json tags matching the column names. Nullable columns become pointers with ,omitempty, timestamps become time.Time, and NUMERIC maps to string (Go has no stdlib decimal and float64 corrupts money math).

Mapped from your real DDL, on the server, discarded after the response.

Try it on your own schema

Example

PostgreSQL in:

CREATE TABLE product (
    id BIGSERIAL PRIMARY KEY,
    sku VARCHAR(40) UNIQUE NOT NULL,
    name VARCHAR(200) NOT NULL,
    price NUMERIC(12, 2) NOT NULL,
    in_stock BOOLEAN NOT NULL DEFAULT true,
    created_at TIMESTAMP NOT NULL DEFAULT now()
);

Generated:

product.go

package models

import (
	"time"
)

type Product struct {
	Id        int64     `json:"id"`
	Sku       string    `json:"sku"`
	Name      string    `json:"name"`
	Price     string    `json:"price"`
	InStock   bool      `json:"in_stock"`
	CreatedAt time.Time `json:"created_at"`
}

Related