mirror of
https://github.com/rjNemo/go-wiki
synced 2026-06-10 04:26:40 +00:00
21 lines
495 B
Go
21 lines
495 B
Go
package data
|
|
|
|
const (
|
|
// QueryCreateTable is the SQL command used to create the users table if it
|
|
// not exists.
|
|
QueryCreateTable = `
|
|
CREATE TABLE IF NOT EXISTS users (
|
|
id SERIAL PRIMARY KEY,
|
|
age INT,
|
|
first_name TEXT,
|
|
last_name TEXT,
|
|
email TEXT UNIQUE NOT NULL)
|
|
`
|
|
// QueryInsertUser is the SQL command used to insert a user in the table.
|
|
// Returning the new ID.
|
|
QueryInsertUser = `
|
|
INSERT INTO users (age, email, first_name, last_name)
|
|
VALUES ($1, $2, $3, $4)
|
|
RETURNING id
|
|
`
|
|
)
|