Initial commit
This commit is contained in:
4
sqlc/query.sql
Normal file
4
sqlc/query.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
-- name: CreateFoodItem :one
|
||||
INSERT INTO food_items(title, description)
|
||||
VALUES ($1, $2)
|
||||
RETURNING *;
|
||||
7
sqlc/schema.sql
Normal file
7
sqlc/schema.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
|
||||
|
||||
CREATE TABLE IF NOT EXISTS food_items (
|
||||
guid UUID PRIMARY KEY,
|
||||
title VARCHAR(50) UNIQUE NOT NULL,
|
||||
description VARCHAR(500) NOT NULL
|
||||
);
|
||||
17
sqlc/sqlc.yml
Normal file
17
sqlc/sqlc.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
version: "2"
|
||||
sql:
|
||||
- schema: "schema.sql"
|
||||
queries: "query.sql"
|
||||
engine: "postgresql"
|
||||
gen:
|
||||
go:
|
||||
out: "../backend/internal/db"
|
||||
sql_package: "pgx/v5"
|
||||
emit_prepared_queries: true
|
||||
emit_pointers_for_null_types: true
|
||||
database:
|
||||
# managed: true
|
||||
uri: "postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable"
|
||||
rules:
|
||||
- sqlc/db-prepare
|
||||
|
||||
Reference in New Issue
Block a user